HBASE-21181 Use the same filesystem for wal archive directory and wal directory

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
TAK LON WU 2018-09-07 11:55:02 -07:00 committed by Andrew Purtell
parent 1c8c7e10f8
commit 2c19b04274
No known key found for this signature in database
GPG Key ID: 8597754DD5365CCD
2 changed files with 23 additions and 1 deletions

View File

@ -200,7 +200,8 @@ public class WALProcedureStore extends ProcedureStoreBase {
throws IOException {
this(conf,
new Path(CommonFSUtils.getWALRootDir(conf), MASTER_PROCEDURE_LOGDIR),
new Path(CommonFSUtils.getRootDir(conf), HConstants.HREGION_OLDLOGDIR_NAME), leaseRecovery);
new Path(CommonFSUtils.getWALRootDir(conf), HConstants.HREGION_OLDLOGDIR_NAME),
leaseRecovery);
}
@VisibleForTesting
@ -1189,6 +1190,11 @@ public class WALProcedureStore extends ProcedureStoreBase {
return this.walDir;
}
@VisibleForTesting
Path getWalArchiveDir() {
return this.walArchiveDir;
}
public FileSystem getFileSystem() {
return this.fs;
}

View File

@ -898,6 +898,22 @@ public class TestWALProcedureStore {
assertEquals("WALs=" + procStore.getActiveLogs(), 1, procStore.getActiveLogs().size());
}
@Test
public void testWALDirAndWALArchiveDir() throws IOException {
Configuration conf = htu.getConfiguration();
procStore = createWALProcedureStore(conf);
assertEquals(procStore.getFileSystem(), procStore.getWalArchiveDir().getFileSystem(conf));
}
private WALProcedureStore createWALProcedureStore(Configuration conf) throws IOException {
return new WALProcedureStore(conf, new WALProcedureStore.LeaseRecovery() {
@Override
public void recoverFileLease(FileSystem fs, Path path) throws IOException {
// no-op
}
});
}
private LoadCounter restartAndAssert(long maxProcId, long runnableCount,
int completedCount, int corruptedCount) throws Exception {
return ProcedureTestingUtility.storeRestartAndAssert(procStore, maxProcId,