Skip to content

Commit 9f40e4f

Browse files
committed
update target tier for segments if tierConfigs is provided
1 parent f2afe21 commit 9f40e4f

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/relocation/SegmentRelocator.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ private void rebalanceTable(String tableNameWithType) {
175175
relocate = true;
176176
LOGGER.info("Relocating COMPLETED segments for table: {}", tableNameWithType);
177177
}
178-
if (_enableLocalTierMigration) {
179-
relocate = true;
180-
LOGGER.info("Migrating segment tiers on servers locally for table: {}", tableNameWithType);
181-
}
182178
if (!relocate) {
183179
LOGGER.debug("No need to relocate segments of table: {}", tableNameWithType);
184180
return;
@@ -205,7 +201,9 @@ private void rebalanceTable(String tableNameWithType) {
205201
// instead of using a separate task.
206202
// TODO: can add some sanity checks on the server side when reloading segments to be more defensive, e.g. only
207203
// migrating segment to new tier when the hosting server is in the server pool configured for that tier.
208-
updateTargetTier(tableNameWithType);
204+
if (TierConfigUtils.shouldRelocateToTiers(tableConfig)) {
205+
updateTargetTier(tableNameWithType, tableConfig);
206+
}
209207

210208
RebalanceResult rebalance = _pinotHelixResourceManager.rebalanceTable(tableNameWithType, rebalanceConfig, false);
211209
switch (rebalance.getStatus()) {
@@ -230,13 +228,7 @@ private void rebalanceTable(String tableNameWithType) {
230228
* Calculate the target tier the segment belongs to and set it in segment ZK metadata as goal state, which can be
231229
* checked by servers when loading the segment to put it onto the target storage tier.
232230
*/
233-
private void updateTargetTier(String tableNameWithType) {
234-
if (!_enableLocalTierMigration) {
235-
LOGGER.debug("Skipping updating target tier for segments of table: {}", tableNameWithType);
236-
return;
237-
}
238-
TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType);
239-
Preconditions.checkState(tableConfig != null, "Failed to find table config for table: {}", tableNameWithType);
231+
private void updateTargetTier(String tableNameWithType, TableConfig tableConfig) {
240232
List<TierConfig> tierCfgs = tableConfig.getTierConfigsList();
241233
List<Tier> sortedTiers = tierCfgs == null ? Collections.emptyList()
242234
: TierConfigUtils.getSortedTiers(tierCfgs, _pinotHelixResourceManager.getHelixZkManager());

0 commit comments

Comments
 (0)