@Override public void close() throws IOException { T log = this.wal; if (log != null) { log.close(); } }
@Override public T getWAL(RegionInfo region) throws IOException { T walCopy = wal; if (walCopy != null) { return walCopy; } walCreateLock.writeLock().lock(); try { walCopy = wal; if (walCopy != null) { return walCopy; } walCopy = createWAL(); boolean succ = false; try { walCopy.init(); succ = true; } finally { if (!succ) { walCopy.close(); } } wal = walCopy; return walCopy; } finally { walCreateLock.writeLock().unlock(); } }
@Test(expected = WALClosedException.class) public void testRollWriterForClosedWAL() throws IOException { String testName = currentTest.getMethodName(); AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), testName, CONF, null, true, null, null); wal.close(); wal.rollWriter(); } }
@Test public void testSyncNoAppend() throws IOException { String testName = currentTest.getMethodName(); AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), testName, CONF, null, true, null, null); try { wal.sync(); } finally { wal.close(); } }
/** * A loaded WAL coprocessor won't break existing WAL test cases. */ @Test public void testWALCoprocessorLoaded() throws Exception { // test to see whether the coprocessor is loaded or not. AbstractFSWAL<?> wal = null; try { wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), HConstants.HREGION_OLDLOGDIR_NAME, CONF, null, true, null, null); WALCoprocessorHost host = wal.getCoprocessorHost(); Coprocessor c = host.findCoprocessor(SampleRegionWALCoprocessor.class); assertNotNull(c); } finally { if (wal != null) { wal.close(); } } }
AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), testName, CONF, null, true, null, null); wal.close(); TableDescriptor td = TableDescriptorBuilder.newBuilder(TableName.valueOf("table")) .setColumnFamily(ColumnFamilyDescriptorBuilder.of("row")).build();
} finally { region.close(true); wal.close();
} finally { if (wal != null) { wal.close();
@Test public void testSyncNoAppend() throws IOException { String testName = currentTest.getMethodName(); AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), testName, CONF, null, true, null, null); try { wal.sync(); } finally { wal.close(); } }
/** * A loaded WAL coprocessor won't break existing WAL test cases. */ @Test public void testWALCoprocessorLoaded() throws Exception { // test to see whether the coprocessor is loaded or not. AbstractFSWAL<?> wal = null; try { wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), HConstants.HREGION_OLDLOGDIR_NAME, CONF, null, true, null, null); WALCoprocessorHost host = wal.getCoprocessorHost(); Coprocessor c = host.findCoprocessor(SampleRegionWALCoprocessor.class); assertNotNull(c); } finally { if (wal != null) { wal.close(); } } }
AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), DIR.toString(), testName, CONF, null, true, null, null); wal.close(); TableDescriptor td = TableDescriptorBuilder.newBuilder(TableName.valueOf("table")) .setColumnFamily(ColumnFamilyDescriptorBuilder.of("row")).build();
} finally { region.close(true); wal.close();
} finally { if (wal != null) { wal.close();