HBASE-21466 WALProcedureStore uses wrong FileSystem if wal.dir is not under rootdir
This commit is contained in:
parent
362b5dd259
commit
f770081129
|
@ -248,8 +248,9 @@ public class WALProcedureStore extends ProcedureStoreBase {
|
|||
this.leaseRecovery = leaseRecovery;
|
||||
this.walDir = walDir;
|
||||
this.walArchiveDir = walArchiveDir;
|
||||
this.fs = walDir.getFileSystem(conf);
|
||||
this.enforceStreamCapability = conf.getBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE, true);
|
||||
this.fs = CommonFSUtils.getWALFileSystem(conf);
|
||||
this.enforceStreamCapability = conf.getBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE,
|
||||
true);
|
||||
|
||||
// Create the log directory for the procedure store
|
||||
if (!fs.exists(walDir)) {
|
||||
|
|
|
@ -19,7 +19,10 @@ package org.apache.hadoop.hbase.master.procedure;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
|
@ -36,6 +39,7 @@ import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility;
|
|||
import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;
|
||||
import org.apache.hadoop.hbase.testclassification.MasterTests;
|
||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
import org.apache.hadoop.hbase.util.CommonFSUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -61,14 +65,17 @@ public class TestMasterProcedureEvents {
|
|||
@Rule
|
||||
public TestName name = new TestName();
|
||||
|
||||
private static void setupConf(Configuration conf) {
|
||||
private static void setupConf(Configuration conf) throws IOException {
|
||||
conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1);
|
||||
conf.setBoolean(WALProcedureStore.USE_HSYNC_CONF_KEY, false);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setupCluster() throws Exception {
|
||||
Configuration conf = UTIL.getConfiguration();
|
||||
setupConf(UTIL.getConfiguration());
|
||||
UTIL.startMiniDFSCluster(3);
|
||||
CommonFSUtils.setWALRootDir(conf, new Path(conf.get("fs.defaultFS"), "/tmp/wal"));
|
||||
UTIL.startMiniCluster(2);
|
||||
UTIL.waitUntilNoRegionsInTransition();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;
|
|||
import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;
|
||||
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
||||
import org.apache.hadoop.hbase.testclassification.MasterTests;
|
||||
import org.apache.hadoop.hbase.util.CommonFSUtils;
|
||||
import org.apache.hadoop.hbase.util.Threads;
|
||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||
import org.apache.hadoop.hdfs.server.datanode.DataNode;
|
||||
|
@ -82,10 +83,12 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
|
||||
// No @Before because some tests need to do additional config first
|
||||
private void setupDFS() throws Exception {
|
||||
Configuration conf = UTIL.getConfiguration();
|
||||
MiniDFSCluster dfs = UTIL.startMiniDFSCluster(3);
|
||||
CommonFSUtils.setWALRootDir(conf, new Path(conf.get("fs.defaultFS"), "/tmp/wal"));
|
||||
|
||||
Path logDir = new Path(new Path(dfs.getFileSystem().getUri()), "/test-logs");
|
||||
store = ProcedureTestingUtility.createWalStore(UTIL.getConfiguration(), logDir);
|
||||
store = ProcedureTestingUtility.createWalStore(conf, logDir);
|
||||
store.registerListener(stopProcedureListener);
|
||||
store.start(8);
|
||||
store.recoverLease();
|
||||
|
|
Loading…
Reference in New Issue