From 2c19b042745fd3de4c1600d1039282e28196873b Mon Sep 17 00:00:00 2001 From: TAK LON WU Date: Fri, 7 Sep 2018 11:55:02 -0700 Subject: [PATCH] HBASE-21181 Use the same filesystem for wal archive directory and wal directory Signed-off-by: Andrew Purtell --- .../procedure2/store/wal/WALProcedureStore.java | 8 +++++++- .../store/wal/TestWALProcedureStore.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java index 70c71f5589f..951f05e8357 100644 --- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java +++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/store/wal/WALProcedureStore.java @@ -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; } diff --git a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java index 64cf211161e..b1bd254b800 100644 --- a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java +++ b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/store/wal/TestWALProcedureStore.java @@ -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,