Skip to content

Commit 6e9626b

Browse files
committed
HBASE-26586 The MigrateStoreFileTrackerProcedure should not rely on the global config when setting SFT implementation for a table
1 parent baeb51f commit 6e9626b

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/MigrateStoreFileTrackerProcedure.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.util.Optional;
2121
import org.apache.hadoop.hbase.client.TableDescriptor;
22+
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
2223
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
2324
import org.apache.hadoop.hbase.master.procedure.ModifyTableDescriptorProcedure;
2425
import org.apache.hadoop.hbase.procedure2.util.StringUtils;
@@ -39,8 +40,11 @@ public MigrateStoreFileTrackerProcedure(MasterProcedureEnv env, TableDescriptor
3940
@Override
4041
protected Optional<TableDescriptor> modify(MasterProcedureEnv env, TableDescriptor current) {
4142
if (StringUtils.isEmpty(current.getValue(StoreFileTrackerFactory.TRACKER_IMPL))) {
43+
// no tracker impl means it is a table created in previous version, the tracker impl can only
44+
// be default.
4245
TableDescriptor td =
43-
StoreFileTrackerFactory.updateWithTrackerConfigs(env.getMasterConfiguration(), current);
46+
TableDescriptorBuilder.newBuilder(current).setValue(StoreFileTrackerFactory.TRACKER_IMPL,
47+
StoreFileTrackerFactory.Trackers.DEFAULT.name()).build();
4448
return Optional.of(td);
4549
}
4650
return Optional.empty();

hbase-server/src/test/java/org/apache/hadoop/hbase/master/migrate/TestMigrateStoreFileTracker.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.apache.hadoop.hbase.master.migrate;
2020

21+
import static org.junit.Assert.assertEquals;
22+
2123
import java.io.IOException;
2224
import org.apache.commons.lang3.StringUtils;
2325
import org.apache.hadoop.conf.Configuration;
@@ -55,9 +57,12 @@ public class TestMigrateStoreFileTracker {
5557
@Before
5658
public void setUp() throws Exception {
5759
conf = HBaseConfiguration.create();
58-
//Speed up the launch of RollingUpgradeChore
60+
// Speed up the launch of RollingUpgradeChore
5961
conf.setInt(RollingUpgradeChore.ROLLING_UPGRADE_CHORE_PERIOD_SECONDS_KEY, 1);
6062
conf.setLong(RollingUpgradeChore.ROLLING_UPGRADE_CHORE_DELAY_SECONDS_KEY, 1);
63+
// Set the default implementation to file instead of default, to confirm we will not migrate to
64+
// file
65+
conf.set(StoreFileTrackerFactory.TRACKER_IMPL, StoreFileTrackerFactory.Trackers.FILE.name());
6166
HTU = new HBaseTestingUtil(conf);
6267
HTU.startMiniCluster();
6368
}
@@ -88,7 +93,7 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
8893
HTU.getMiniHBaseCluster().stopMaster(0).join();
8994
HTU.getMiniHBaseCluster().startMaster();
9095
HTU.getMiniHBaseCluster().waitForActiveAndReadyMaster(30000);
91-
//wait until all tables have been migrated
96+
// wait until all tables have been migrated
9297
TableDescriptors tds = HTU.getMiniHBaseCluster().getMaster().getTableDescriptors();
9398
HTU.waitFor(30000, () -> {
9499
try {
@@ -103,5 +108,10 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
103108
return false;
104109
}
105110
});
111+
for (String table : tables) {
112+
TableDescriptor td = tds.get(TableName.valueOf(table));
113+
assertEquals(StoreFileTrackerFactory.Trackers.DEFAULT.name(),
114+
td.getValue(StoreFileTrackerFactory.TRACKER_IMPL));
115+
}
106116
}
107117
}

0 commit comments

Comments
 (0)