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 ;
3032import org .apache .hadoop .hbase .client .TableDescriptor ;
3133import org .apache .hadoop .hbase .client .TableDescriptorBuilder ;
3234import org .apache .hadoop .hbase .regionserver .storefiletracker .StoreFileTrackerFactory ;
35+ import org .apache .hadoop .hbase .testclassification .MasterTests ;
3336import org .apache .hadoop .hbase .testclassification .MediumTests ;
3437import org .apache .hadoop .hbase .util .Bytes ;
3538import org .junit .After ;
3942import org .junit .Test ;
4043import org .junit .experimental .categories .Category ;
4144
42- @ Category (MediumTests .class )
43- public class TestMigrateStoreFileTracker {
45+ @ Category ({ MediumTests .class , MasterTests . class } )
46+ public class TestInitializeStoreFileTracker {
4447 @ ClassRule
4548 public static final HBaseClassTestRule CLASS_RULE =
46- HBaseClassTestRule .forClass (TestMigrateStoreFileTracker .class );
49+ HBaseClassTestRule .forClass (TestInitializeStoreFileTracker .class );
4750 private final static String [] tables = new String [] { "t1" , "t2" , "t3" , "t4" , "t5" , "t6" };
4851 private final static String famStr = "f1" ;
4952 private final static byte [] fam = Bytes .toBytes (famStr );
@@ -55,9 +58,12 @@ public class TestMigrateStoreFileTracker {
5558 @ Before
5659 public void setUp () throws Exception {
5760 conf = HBaseConfiguration .create ();
58- //Speed up the launch of RollingUpgradeChore
61+ // Speed up the launch of RollingUpgradeChore
5962 conf .setInt (RollingUpgradeChore .ROLLING_UPGRADE_CHORE_PERIOD_SECONDS_KEY , 1 );
6063 conf .setLong (RollingUpgradeChore .ROLLING_UPGRADE_CHORE_DELAY_SECONDS_KEY , 1 );
64+ // Set the default implementation to file instead of default, to confirm we will not set SFT to
65+ // file
66+ conf .set (StoreFileTrackerFactory .TRACKER_IMPL , StoreFileTrackerFactory .Trackers .FILE .name ());
6167 HTU = new HBaseTestingUtil (conf );
6268 HTU .startMiniCluster ();
6369 }
@@ -88,7 +94,7 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
8894 HTU .getMiniHBaseCluster ().stopMaster (0 ).join ();
8995 HTU .getMiniHBaseCluster ().startMaster ();
9096 HTU .getMiniHBaseCluster ().waitForActiveAndReadyMaster (30000 );
91- //wait until all tables have been migrated
97+ // wait until all tables have been migrated
9298 TableDescriptors tds = HTU .getMiniHBaseCluster ().getMaster ().getTableDescriptors ();
9399 HTU .waitFor (30000 , () -> {
94100 try {
@@ -103,5 +109,10 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
103109 return false ;
104110 }
105111 });
112+ for (String table : tables ) {
113+ TableDescriptor td = tds .get (TableName .valueOf (table ));
114+ assertEquals (StoreFileTrackerFactory .Trackers .DEFAULT .name (),
115+ td .getValue (StoreFileTrackerFactory .TRACKER_IMPL ));
116+ }
106117 }
107118}
0 commit comments