|
25 | 25 | import java.util.List;
|
26 | 26 | import java.util.concurrent.CountDownLatch;
|
27 | 27 | import org.apache.hadoop.fs.FileStatus;
|
| 28 | +import org.apache.hadoop.fs.FileSystem; |
28 | 29 | import org.apache.hadoop.fs.Path;
|
29 | 30 | import org.apache.hadoop.hbase.HBaseClassTestRule;
|
30 | 31 | import org.apache.hadoop.hbase.HBaseTestingUtility;
|
@@ -233,11 +234,20 @@ private void splitLogsTestHelper(HBaseTestingUtility testUtil) throws Exception
|
233 | 234 | ProcedureTestingUtility.submitAndWait(masterPE, procedures.get(0));
|
234 | 235 | Assert.assertEquals(0, splitWALManager.getWALsToSplit(testServer, false).size());
|
235 | 236 |
|
| 237 | + // Validate the old WAL file archive dir |
| 238 | + Path walRootDir = hmaster.getMasterFileSystem().getWALRootDir(); |
| 239 | + Path walArchivePath = new Path(walRootDir, HConstants.HREGION_OLDLOGDIR_NAME); |
| 240 | + FileSystem walFS = hmaster.getMasterFileSystem().getWALFileSystem(); |
| 241 | + int archiveFileCount = walFS.listStatus(walArchivePath).length; |
| 242 | + |
236 | 243 | procedures = splitWALManager.splitWALs(metaServer, true);
|
237 | 244 | Assert.assertEquals(1, procedures.size());
|
238 | 245 | ProcedureTestingUtility.submitAndWait(masterPE, procedures.get(0));
|
239 | 246 | Assert.assertEquals(0, splitWALManager.getWALsToSplit(metaServer, true).size());
|
240 | 247 | Assert.assertEquals(1, splitWALManager.getWALsToSplit(metaServer, false).size());
|
| 248 | + // There should be archiveFileCount + 1 WALs after SplitWALProcedure finish |
| 249 | + Assert.assertEquals("Splitted WAL files should be archived", archiveFileCount + 1, |
| 250 | + walFS.listStatus(walArchivePath).length); |
241 | 251 | }
|
242 | 252 |
|
243 | 253 | @Test
|
|
0 commit comments