18
18
*/
19
19
package org .apache .hadoop .hbase .master .migrate ;
20
20
21
+ import static org .junit .Assert .assertEquals ;
22
+
21
23
import java .io .IOException ;
22
24
import org .apache .commons .lang3 .StringUtils ;
23
25
import org .apache .hadoop .conf .Configuration ;
31
33
import org .apache .hadoop .hbase .client .TableDescriptor ;
32
34
import org .apache .hadoop .hbase .client .TableDescriptorBuilder ;
33
35
import org .apache .hadoop .hbase .regionserver .storefiletracker .StoreFileTrackerFactory ;
36
+ import org .apache .hadoop .hbase .testclassification .MasterTests ;
34
37
import org .apache .hadoop .hbase .testclassification .MediumTests ;
35
38
import org .apache .hadoop .hbase .util .Bytes ;
36
39
import org .junit .After ;
40
43
import org .junit .Test ;
41
44
import org .junit .experimental .categories .Category ;
42
45
43
- @ Category (MediumTests .class )
44
- public class TestMigrateStoreFileTracker {
46
+ @ Category ({ MediumTests .class , MasterTests . class } )
47
+ public class TestInitializeStoreFileTracker {
45
48
@ ClassRule
46
49
public static final HBaseClassTestRule CLASS_RULE =
47
- HBaseClassTestRule .forClass (TestMigrateStoreFileTracker .class );
50
+ HBaseClassTestRule .forClass (TestInitializeStoreFileTracker .class );
48
51
private final static String [] tables = new String [] { "t1" , "t2" , "t3" , "t4" , "t5" , "t6" };
49
52
private final static String famStr = "f1" ;
50
53
private final static byte [] fam = Bytes .toBytes (famStr );
@@ -56,9 +59,12 @@ public class TestMigrateStoreFileTracker {
56
59
@ Before
57
60
public void setUp () throws Exception {
58
61
conf = HBaseConfiguration .create ();
59
- //Speed up the launch of RollingUpgradeChore
62
+ // Speed up the launch of RollingUpgradeChore
60
63
conf .setInt (RollingUpgradeChore .ROLLING_UPGRADE_CHORE_PERIOD_SECONDS_KEY , 1 );
61
64
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 ());
62
68
HTU = new HBaseTestingUtility (conf );
63
69
HTU .startMiniCluster ();
64
70
}
@@ -89,7 +95,7 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
89
95
HTU .getMiniHBaseCluster ().stopMaster (0 ).join ();
90
96
HTU .getMiniHBaseCluster ().startMaster ();
91
97
HTU .getMiniHBaseCluster ().waitForActiveAndReadyMaster (30000 );
92
- //wait until all tables have been migrated
98
+ // wait until all tables have been migrated
93
99
TableDescriptors tds = HTU .getMiniHBaseCluster ().getMaster ().getTableDescriptors ();
94
100
HTU .waitFor (30000 , () -> {
95
101
try {
@@ -104,5 +110,10 @@ public void testMigrateStoreFileTracker() throws IOException, InterruptedExcepti
104
110
return false ;
105
111
}
106
112
});
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
+ }
107
118
}
108
119
}
0 commit comments