region0.getLog().closeAndDelete(); HLog wal = createWAL(this.conf); RegionServerServices mockRS = Mockito.mock(RegionServerServices.class);
private void closeWAL(final boolean delete) { try { if (this.hlog != null) { if (delete) { hlog.closeAndDelete(); } else { hlog.close(); } } } catch (Throwable e) { LOG.error("Close and delete failed", RemoteExceptionHandler.checkThrowable(e)); } }
void process() throws IOException { try { for (HRegionInfo[] regionsToMerge = next(); regionsToMerge != null; regionsToMerge = next()) { if (!merge(regionsToMerge)) { return; } } } finally { try { hlog.closeAndDelete(); } catch(IOException e) { LOG.error(e); } } }
if (this.log != null) { this.log.rollWriter(); this.log.closeAndDelete();
/** * This will do the necessary cleanup a call to {@link #createHRegion(HRegionInfo, Path, Configuration, HTableDescriptor)} * requires. This method will close the region and then close its * associated {@link HLog} file. You use it if you call the other createHRegion, * the one that takes an {@link HLog} instance but don't be surprised by the * call to the {@link HLog#closeAndDelete()} on the {@link HLog} the * HRegion was carrying. * @param r * @throws IOException */ public static void closeHRegion(final HRegion r) throws IOException { if (r == null) return; r.close(); if (r.getLog() == null) return; r.getLog().closeAndDelete(); }
/** * Creates, flushes, and closes a new region. */ public static HRegion createHDFSRegionDir(Configuration conf, HRegionInfo hri, HTableDescriptor htd) throws IOException { // Create HRegion Path root = FSUtils.getRootDir(conf); HRegion region = HRegion.createHRegion(hri, root, conf, htd); HLog hlog = region.getLog(); // Close the new region to flush to disk. Close log file too. region.close(); hlog.closeAndDelete(); return region; } }
private static void bootstrap(final Path rd, final Configuration c) throws IOException { LOG.info("BOOTSTRAP: creating ROOT and first META regions"); try { // Bootstrapping, make sure blockcache is off. Else, one will be // created here in bootstap and it'll need to be cleaned up. Better to // not make it in first place. Turn off block caching for bootstrap. // Enable after. HRegionInfo rootHRI = new HRegionInfo(HRegionInfo.ROOT_REGIONINFO); setInfoFamilyCachingForRoot(false); HRegionInfo metaHRI = new HRegionInfo(HRegionInfo.FIRST_META_REGIONINFO); setInfoFamilyCachingForMeta(false); HRegion root = HRegion.createHRegion(rootHRI, rd, c, HTableDescriptor.ROOT_TABLEDESC); HRegion meta = HRegion.createHRegion(metaHRI, rd, c, HTableDescriptor.META_TABLEDESC); setInfoFamilyCachingForRoot(true); setInfoFamilyCachingForMeta(true); // Add first region from the META table to the ROOT region. HRegion.addRegionToMETA(root, meta); root.close(); root.getLog().closeAndDelete(); meta.close(); meta.getLog().closeAndDelete(); } catch (IOException e) { e = RemoteExceptionHandler.checkIOException(e); LOG.error("bootstrap", e); throw e; } }
meta.getLog().closeAndDelete(); LOG.info("Success! .META. table rebuilt."); LOG.info("Old -ROOT- and .META. are moved into " + backupDir);
/** * This borrows code from MasterFileSystem.bootstrap() * * @return an open .META. HRegion */ private HRegion createNewRootAndMeta() throws IOException { Path rootdir = new Path(getConf().get(HConstants.HBASE_DIR)); Configuration c = getConf(); HRegionInfo rootHRI = new HRegionInfo(HRegionInfo.ROOT_REGIONINFO); MasterFileSystem.setInfoFamilyCachingForRoot(false); HRegionInfo metaHRI = new HRegionInfo(HRegionInfo.FIRST_META_REGIONINFO); MasterFileSystem.setInfoFamilyCachingForMeta(false); HRegion root = HRegion.createHRegion(rootHRI, rootdir, c, HTableDescriptor.ROOT_TABLEDESC); HRegion meta = HRegion.createHRegion(metaHRI, rootdir, c, HTableDescriptor.META_TABLEDESC); MasterFileSystem.setInfoFamilyCachingForRoot(true); MasterFileSystem.setInfoFamilyCachingForMeta(true); // Add first region from the META table to the ROOT region. HRegion.addRegionToMETA(root, meta); root.close(); root.getLog().closeAndDelete(); return meta; }