private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir, FileSystem fs, Configuration conf) throws IOException { Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, true); if (regionedits == null) { return null; } if (fs.exists(regionedits)) { LOG.warn("Found existing old edits file. It could be the " + "result of a previous failed split attempt. Deleting " + regionedits + ", length=" + fs.getFileStatus(regionedits).getLen()); if (!HBaseFileSystem.deleteFileFromFileSystem(fs, regionedits)) { LOG.warn("Failed delete of old " + regionedits); } } Writer w = createWriter(fs, regionedits, conf); LOG.debug("Creating writer path=" + regionedits + " region=" + Bytes.toStringBinary(region)); return (new WriterAndPath(regionedits, w)); }
private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir, FileSystem fs, Configuration conf) throws IOException { Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, true); if (regionedits == null) { return null; } if (fs.exists(regionedits)) { LOG.warn("Found old edits file. It could be the " + "result of a previous failed split attempt. Deleting " + regionedits + ", length=" + fs.getFileStatus(regionedits).getLen()); if (!fs.delete(regionedits, false)) { LOG.warn("Failed delete of old " + regionedits); } } Writer w = createWriter(fs, regionedits, conf); LOG.debug("Creating writer path=" + regionedits + " region=" + Bytes.toStringBinary(region)); return (new WriterAndPath(regionedits, w)); }
private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir, FileSystem fs, Configuration conf) throws IOException { Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, true); if (regionedits == null) { return null; } if (fs.exists(regionedits)) { LOG.warn("Found old edits file. It could be the " + "result of a previous failed split attempt. Deleting " + regionedits + ", length=" + fs.getFileStatus(regionedits).getLen()); if (!fs.delete(regionedits, false)) { LOG.warn("Failed delete of old " + regionedits); } } Writer w = createWriter(fs, regionedits, conf); LOG.info("Creating writer path=" + regionedits + " region=" + Bytes.toStringBinary(region)); return (new WriterAndPath(regionedits, w)); }
private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir, FileSystem fs, Configuration conf) throws IOException { Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, true); if (regionedits == null) { return null; } if (fs.exists(regionedits)) { LOG.warn("Found existing old edits file. It could be the " + "result of a previous failed split attempt. Deleting " + regionedits + ", length=" + fs.getFileStatus(regionedits).getLen()); if (!fs.delete(regionedits, false)) { LOG.warn("Failed delete of old " + regionedits); } } Writer w = createWriter(fs, regionedits, conf); LOG.debug("Creating writer path=" + regionedits + " region=" + Bytes.toStringBinary(region)); return (new WriterAndPath(regionedits, w)); }
/** * Create a writer for the WAL. * @return A WAL writer. Close when done with it. * @throws IOException */ public static HLog.Writer createWriter(final FileSystem fs, final Path path, Configuration conf) throws IOException { try { if (logWriterClass == null) { logWriterClass = conf.getClass("hbase.regionserver.hlog.writer.impl", SequenceFileLogWriter.class, Writer.class); } HLog.Writer writer = (HLog.Writer) logWriterClass.newInstance(); writer.init(fs, path, conf); return writer; } catch (Exception e) { throw new IOException("cannot get log writer", e); } }
/** * Creates writer for the given path. * @param fs * @param conf * @param hlogFile * @return an init'ed writer for the given path. * @throws IOException */ public Writer createWriter(FileSystem fs, Configuration conf, Path hlogFile) throws IOException { int i = 0; IOException lastIOE = null; do { try { return HLog.createWriter(fs, hlogFile, conf); } catch (IOException ioe) { lastIOE = ioe; sleepBeforeRetry("Create Writer", i+1); } } while (++i <= hdfsClientRetriesNumber); throw new IOException("Exception in createWriter", lastIOE); }
private static HLog.Writer createWriter(final FileSystem fs, final Path path, Configuration conf, boolean overwritable) throws IOException { try { if (logWriterClass == null) { logWriterClass = conf.getClass("hbase.regionserver.hlog.writer.impl", ProtobufLogWriter.class, Writer.class); } HLog.Writer writer = (HLog.Writer)logWriterClass.newInstance(); writer.init(fs, path, conf, overwritable); return writer; } catch (Exception e) { throw new IOException("cannot get log writer", e); } }
private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir, String tmpname, FileSystem fs, Configuration conf) throws IOException { Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, tmpname==null); if (regionedits == null) { return null; } if ((tmpname == null) && fs.exists(regionedits)) { LOG.warn("Found existing old edits file. It could be the " + "result of a previous failed split attempt. Deleting " + regionedits + ", length=" + fs.getFileStatus(regionedits).getLen()); if (!fs.delete(regionedits, false)) { LOG.warn("Failed delete of old " + regionedits); } } Path editsfile; if (tmpname != null) { // During distributed log splitting the output by each // SplitLogWorker is written to a temporary area. editsfile = convertRegionEditsToTemp(rootdir, regionedits, tmpname); } else { editsfile = regionedits; } Writer w = createWriter(fs, editsfile, conf); LOG.debug("Creating writer path=" + editsfile + " region=" + Bytes.toStringBinary(region)); return (new WriterAndPath(editsfile, w)); }
private synchronized Writer getTrxWriter() throws IOException { if (trxWriter == null) { Path trxPath = new Path(logfile.getParent(), THLog.HREGION_OLD_THLOGFILE_NAME); trxWriter = THLog.createWriter(fs, trxPath, conf); } return trxWriter; }
/** * Create a new {@link Writer} for writing log splits. */ protected Writer createWriter(FileSystem fs, Path logfile, Configuration conf) throws IOException { return hlogFs.createWriter(fs, conf, logfile); }
WriterAndPath(final Path p, final Writer w) { this.p = p; this.w = w; }
/** * Create a new {@link Writer} for writing log splits. */ protected Writer createWriter(FileSystem fs, Path logfile, Configuration conf) throws IOException { return HLogFactory.createRecoveredEditsWriter(fs, logfile, conf); }
public static HLog.Writer createRecoveredEditsWriter(final FileSystem fs, final Path path, Configuration conf) throws IOException { return createWriter(fs, path, conf, true); }
/** * Create a new {@link Writer} for writing log splits. */ protected Writer createWriter(FileSystem fs, Path logfile, Configuration conf) throws IOException { return HLog.createWriter(fs, logfile, conf); }