@Test public void testSetWALRootDir() throws Exception { Path p = new Path("file:///hbase/root"); CommonFSUtils.setWALRootDir(conf, p); assertEquals(p.toString(), conf.get(CommonFSUtils.HBASE_WAL_DIR)); }
@Test(expected=IllegalStateException.class) public void testGetWALRootDirIllegalWALDir() throws IOException { Path root = new Path("file:///hbase/root"); Path invalidWALDir = new Path("file:///hbase/root/logroot"); CommonFSUtils.setRootDir(conf, root); CommonFSUtils.setWALRootDir(conf, invalidWALDir); CommonFSUtils.getWALRootDir(conf); }
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(conf, logDir); store.registerListener(stopProcedureListener); store.start(8); store.recoverLease(); }
@Test public void testRemoveWALRootPath() throws Exception { CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase")); Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile"); Path tmpFile = new Path("file:///test/testfile"); assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf)); assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf)); CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir")); assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf)); Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog"); assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf)); }
@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(); }
@Test public void testGetWALRootDir() throws IOException { Path root = new Path("file:///hbase/root"); Path walRoot = new Path("file:///hbase/logroot"); CommonFSUtils.setRootDir(conf, root); assertEquals(root, CommonFSUtils.getRootDir(conf)); assertEquals(root, CommonFSUtils.getWALRootDir(conf)); CommonFSUtils.setWALRootDir(conf, walRoot); assertEquals(walRoot, CommonFSUtils.getWALRootDir(conf)); }
@BeforeClass public static void setUpBeforeClass() throws Exception { CommonFSUtils.setWALRootDir(TEST_UTIL.getConfiguration(), new Path("file:///tmp/wal")); // Make block sizes small. TEST_UTIL.getConfiguration().setInt("dfs.blocksize", 1024 * 1024); // needed for testAppendClose() // quicker heartbeat interval for faster DN death notification TEST_UTIL.getConfiguration().setInt("dfs.namenode.heartbeat.recheck-interval", 5000); TEST_UTIL.getConfiguration().setInt("dfs.heartbeat.interval", 1); TEST_UTIL.getConfiguration().setInt("dfs.client.socket-timeout", 5000); // faster failover with cluster.shutdown();fs.close() idiom TEST_UTIL.getConfiguration() .setInt("hbase.ipc.client.connect.max.retries", 1); TEST_UTIL.getConfiguration().setInt( "dfs.client.block.recovery.retries", 1); TEST_UTIL.getConfiguration().setInt( "hbase.ipc.client.connection.maxidletime", 500); TEST_UTIL.getConfiguration().setInt("hbase.lease.recovery.timeout", 10000); TEST_UTIL.getConfiguration().setInt("hbase.lease.recovery.dfs.timeout", 1000); TEST_UTIL.getConfiguration().set(CoprocessorHost.WAL_COPROCESSOR_CONF_KEY, SampleRegionWALCoprocessor.class.getName()); TEST_UTIL.startMiniDFSCluster(3); conf = TEST_UTIL.getConfiguration(); cluster = TEST_UTIL.getDFSCluster(); hbaseDir = TEST_UTIL.createRootDir(); hbaseWALDir = TEST_UTIL.createWALRootDir(); }
String root2 = TEST_UTIL2.getConfiguration().get("fs.defaultFS"); Path p = new Path(new Path(root2), "/tmp/wal"); CommonFSUtils.setWALRootDir(TEST_UTIL2.getConfiguration(), p); TEST_UTIL2.startMiniCluster();
@Test public void testSetWALRootDir() throws Exception { Path p = new Path("file:///hbase/root"); CommonFSUtils.setWALRootDir(conf, p); assertEquals(p.toString(), conf.get(CommonFSUtils.HBASE_WAL_DIR)); }
@Test public void testSetWALRootDir() throws Exception { Path p = new Path("file:///hbase/root"); CommonFSUtils.setWALRootDir(conf, p); assertEquals(p.toString(), conf.get(CommonFSUtils.HBASE_WAL_DIR)); }
@Test(expected=IllegalStateException.class) public void testGetWALRootDirIllegalWALDir() throws IOException { Path root = new Path("file:///hbase/root"); Path invalidWALDir = new Path("file:///hbase/root/logroot"); CommonFSUtils.setRootDir(conf, root); CommonFSUtils.setWALRootDir(conf, invalidWALDir); CommonFSUtils.getWALRootDir(conf); }
@Test(expected=IllegalStateException.class) public void testGetWALRootDirIllegalWALDir() throws IOException { Path root = new Path("file:///hbase/root"); Path invalidWALDir = new Path("file:///hbase/root/logroot"); CommonFSUtils.setRootDir(conf, root); CommonFSUtils.setWALRootDir(conf, invalidWALDir); CommonFSUtils.getWALRootDir(conf); }
@Test public void testRemoveWALRootPath() throws Exception { CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase")); Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile"); Path tmpFile = new Path("file:///test/testfile"); assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf)); assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf)); CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir")); assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf)); Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog"); assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf)); }
@Test public void testRemoveWALRootPath() throws Exception { CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase")); Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile"); Path tmpFile = new Path("file:///test/testfile"); assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf)); assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf)); CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir")); assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf)); Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog"); assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf)); }
@Test public void testGetWALRootDir() throws IOException { Path root = new Path("file:///hbase/root"); Path walRoot = new Path("file:///hbase/logroot"); CommonFSUtils.setRootDir(conf, root); assertEquals(root, CommonFSUtils.getRootDir(conf)); assertEquals(root, CommonFSUtils.getWALRootDir(conf)); CommonFSUtils.setWALRootDir(conf, walRoot); assertEquals(walRoot, CommonFSUtils.getWALRootDir(conf)); }
@BeforeClass public static void setUpBeforeClass() throws Exception { CommonFSUtils.setWALRootDir(TEST_UTIL.getConfiguration(), new Path("file:///tmp/wal")); // Make block sizes small. TEST_UTIL.getConfiguration().setInt("dfs.blocksize", 1024 * 1024); // needed for testAppendClose() // quicker heartbeat interval for faster DN death notification TEST_UTIL.getConfiguration().setInt("dfs.namenode.heartbeat.recheck-interval", 5000); TEST_UTIL.getConfiguration().setInt("dfs.heartbeat.interval", 1); TEST_UTIL.getConfiguration().setInt("dfs.client.socket-timeout", 5000); // faster failover with cluster.shutdown();fs.close() idiom TEST_UTIL.getConfiguration() .setInt("hbase.ipc.client.connect.max.retries", 1); TEST_UTIL.getConfiguration().setInt( "dfs.client.block.recovery.retries", 1); TEST_UTIL.getConfiguration().setInt( "hbase.ipc.client.connection.maxidletime", 500); TEST_UTIL.getConfiguration().setInt("hbase.lease.recovery.timeout", 10000); TEST_UTIL.getConfiguration().setInt("hbase.lease.recovery.dfs.timeout", 1000); TEST_UTIL.getConfiguration().set(CoprocessorHost.WAL_COPROCESSOR_CONF_KEY, SampleRegionWALCoprocessor.class.getName()); TEST_UTIL.startMiniDFSCluster(3); conf = TEST_UTIL.getConfiguration(); cluster = TEST_UTIL.getDFSCluster(); hbaseDir = TEST_UTIL.createRootDir(); hbaseWALDir = TEST_UTIL.createWALRootDir(); }
@Test public void testGetWALRootDir() throws IOException { Path root = new Path("file:///hbase/root"); Path walRoot = new Path("file:///hbase/logroot"); CommonFSUtils.setRootDir(conf, root); assertEquals(root, CommonFSUtils.getRootDir(conf)); assertEquals(root, CommonFSUtils.getWALRootDir(conf)); CommonFSUtils.setWALRootDir(conf, walRoot); assertEquals(walRoot, CommonFSUtils.getWALRootDir(conf)); }