@@ -106,6 +106,7 @@ public static void setUpBaseConf(Configuration conf) {
106
106
// If a single node has enough failures (default 3), resource manager will blacklist it.
107
107
// With only 2 nodes and tests injecting faults, we don't want that.
108
108
conf .setInt ("mapreduce.job.maxtaskfailures.per.tracker" , 100 );
109
+ conf .setInt ("snapshot.export.default.map.group" , 1 );
109
110
}
110
111
111
112
@ BeforeClass
@@ -206,6 +207,48 @@ public void testExportFileSystemStateWithMergeRegion() throws Exception {
206
207
TEST_UTIL .deleteTable (tableName0 );
207
208
}
208
209
210
+ @ Test
211
+ public void testExportFileSystemStateWithSplitRegion () throws Exception {
212
+ // disable compaction
213
+ admin .compactionSwitch (false ,
214
+ admin .getRegionServers ().stream ().map (a -> a .getServerName ()).collect (Collectors .toList ()));
215
+ // create Table
216
+ TableName splitTableName = TableName .valueOf (testName .getMethodName ());
217
+ String splitTableSnap = "snapshot-" + testName .getMethodName ();
218
+ admin .createTable (TableDescriptorBuilder .newBuilder (splitTableName ).setColumnFamilies (
219
+ Lists .newArrayList (ColumnFamilyDescriptorBuilder .newBuilder (FAMILY ).build ())).build ());
220
+
221
+ // put some data
222
+ try (Table table = admin .getConnection ().getTable (splitTableName )) {
223
+ table .put (new Put (Bytes .toBytes ("row1" )).addColumn (FAMILY , null , Bytes .toBytes ("value1" )));
224
+ table .put (new Put (Bytes .toBytes ("row2" )).addColumn (FAMILY , null , Bytes .toBytes ("value2" )));
225
+ table .put (new Put (Bytes .toBytes ("row3" )).addColumn (FAMILY , null , Bytes .toBytes ("value3" )));
226
+ table .put (new Put (Bytes .toBytes ("row4" )).addColumn (FAMILY , null , Bytes .toBytes ("value4" )));
227
+ table .put (new Put (Bytes .toBytes ("row5" )).addColumn (FAMILY , null , Bytes .toBytes ("value5" )));
228
+ table .put (new Put (Bytes .toBytes ("row6" )).addColumn (FAMILY , null , Bytes .toBytes ("value6" )));
229
+ table .put (new Put (Bytes .toBytes ("row7" )).addColumn (FAMILY , null , Bytes .toBytes ("value7" )));
230
+ table .put (new Put (Bytes .toBytes ("row8" )).addColumn (FAMILY , null , Bytes .toBytes ("value8" )));
231
+ // Flush to HFile
232
+ admin .flush (tableName );
233
+ }
234
+
235
+ List <RegionInfo > regions = admin .getRegions (splitTableName );
236
+ assertEquals (1 , regions .size ());
237
+ tableNumFiles = regions .size ();
238
+
239
+ // split region
240
+ admin .split (splitTableName , Bytes .toBytes ("row5" ));
241
+ regions = admin .getRegions (splitTableName );
242
+ assertEquals (2 , regions .size ());
243
+
244
+ // take a snapshot
245
+ admin .snapshot (splitTableSnap , splitTableName );
246
+ // export snapshot and verify
247
+ testExportFileSystemState (splitTableName , splitTableSnap , splitTableSnap , tableNumFiles );
248
+ // delete table
249
+ TEST_UTIL .deleteTable (splitTableName );
250
+ }
251
+
209
252
@ Test
210
253
public void testExportFileSystemStateWithSkipTmp () throws Exception {
211
254
TEST_UTIL .getConfiguration ().setBoolean (ExportSnapshot .CONF_SKIP_TMP , true );
0 commit comments