1818 */
1919package org .apache .hadoop .hbase .master .migrate ;
2020
21+ import static org .junit .Assert .assertEquals ;
22+
2123import java .io .IOException ;
2224import org .apache .commons .lang3 .StringUtils ;
2325import org .apache .hadoop .conf .Configuration ;
3133import org .apache .hadoop .hbase .client .TableDescriptor ;
3234import org .apache .hadoop .hbase .client .TableDescriptorBuilder ;
3335import org .apache .hadoop .hbase .regionserver .storefiletracker .StoreFileTrackerFactory ;
36+ import org .apache .hadoop .hbase .testclassification .MasterTests ;
3437import org .apache .hadoop .hbase .testclassification .MediumTests ;
3538import org .apache .hadoop .hbase .util .Bytes ;
3639import org .junit .After ;
4043import org .junit .Test ;
4144import org .junit .experimental .categories .Category ;
4245
43- @ Category (MediumTests .class )
44- public class TestMigrateStoreFileTracker {
46+ @ Category ({ MediumTests .class , MasterTests . class } )
47+ public class TestInitializeStoreFileTracker {
4548 @ ClassRule
4649 public static final HBaseClassTestRule CLASS_RULE =
47- HBaseClassTestRule .forClass (TestMigrateStoreFileTracker .class );
50+ HBaseClassTestRule .forClass (TestInitializeStoreFileTracker .class );
4851 private final static String [] tables = new String [] { "t1" , "t2" , "t3" , "t4" , "t5" , "t6" };
4952 private final static String famStr = "f1" ;
5053 private final static byte [] fam = Bytes .toBytes (famStr );
@@ -56,9 +59,12 @@ public class TestMigrateStoreFileTracker {
5659 @ Before
5760 public void setUp () throws Exception {
5861 conf = HBaseConfiguration .create ();
59- //Speed up the launch of RollingUpgradeChore
62+ // Speed up the launch of RollingUpgradeChore
6063 conf .setInt (RollingUpgradeChore .ROLLING_UPGRADE_CHORE_PERIOD_SECONDS_KEY , 1 );
6164 conf .setLong (RollingUpgradeChore .ROLLING_UPGRADE_CHORE_DELAY_SECONDS_KEY , 1 );
65+ // Set the default implementation to file instead of default, to confirm we will not set SFT to
66+ // file
67+ conf .set (StoreFileTrackerFactory .TRACKER_IMPL , StoreFileTrackerFactory .Trackers .FILE .name ());
6268 HTU = new HBaseTestingUtility (conf );
6369 HTU .startMiniCluster ();
6470 }
@@ -89,7 +95,7 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
8995 HTU .getMiniHBaseCluster ().stopMaster (0 ).join ();
9096 HTU .getMiniHBaseCluster ().startMaster ();
9197 HTU .getMiniHBaseCluster ().waitForActiveAndReadyMaster (30000 );
92- //wait until all tables have been migrated
98+ // wait until all tables have been migrated
9399 TableDescriptors tds = HTU .getMiniHBaseCluster ().getMaster ().getTableDescriptors ();
94100 HTU .waitFor (30000 , () -> {
95101 try {
@@ -104,5 +110,10 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
104110 return false ;
105111 }
106112 });
113+ for (String table : tables ) {
114+ TableDescriptor td = tds .get (TableName .valueOf (table ));
115+ assertEquals (StoreFileTrackerFactory .Trackers .DEFAULT .name (),
116+ td .getValue (StoreFileTrackerFactory .TRACKER_IMPL ));
117+ }
107118 }
108119}
0 commit comments