public static void main(String[] args) throws Exception { final Configuration conf = HBaseConfiguration.create(); int exitCode = ToolRunner.run(conf, new ProcedureWALPrettyPrinter(), args); System.exit(exitCode); } }
processFile(getConf(), file);
public void processProcedureWALFile(ProcedureWALFile log) throws IOException { log.open(); ProcedureWALHeader header = log.getHeader(); printHeader(header); FSDataInputStream stream = log.getStream(); try { boolean hasMore = true; while (hasMore) { ProcedureWALEntry entry = ProcedureWALFormat.readEntry(stream); if (entry == null) { out.println("No more entry, exiting with missing EOF"); hasMore = false; break; } switch (entry.getType()) { case PROCEDURE_WAL_EOF: hasMore = false; break; default: printEntry(entry); } } } catch (IOException e) { out.println("got an exception while reading the procedure WAL " + e.getMessage()); } finally { log.close(); } }
private void printEntry(final ProcedureWALEntry entry) throws IOException { out.println("EntryType=" + entry.getType()); int procCount = entry.getProcedureCount(); for (int i = 0; i < procCount; i++) { Procedure<?> proc = ProcedureUtil.convertToProcedure(entry.getProcedure(i)); printProcedure(proc); } }
/** * Reads a log file and outputs its contents. * * @param conf HBase configuration relevant to this log file * @param p path of the log file to be read * @throws IOException IOException */ public void processFile(final Configuration conf, final Path p) throws IOException { FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { System.err.println("ERROR, file doesnt exist: " + p); return; } if (!fs.isFile(p)) { System.err.println(p + " is not a file"); return; } FileStatus logFile = fs.getFileStatus(p); if (logFile.getLen() == 0) { out.println("Zero length file: " + p); return; } out.println("Opening procedure state-log: " + p); ProcedureWALFile log = new ProcedureWALFile(fs, logFile); processProcedureWALFile(log); }
private void printEntry(final ProcedureWALEntry entry) throws IOException { out.println("EntryType=" + entry.getType()); int procCount = entry.getProcedureCount(); for (int i = 0; i < procCount; i++) { Procedure<?> proc = ProcedureUtil.convertToProcedure(entry.getProcedure(i)); printProcedure(proc); } }
/** * Reads a log file and outputs its contents. * * @param conf HBase configuration relevant to this log file * @param p path of the log file to be read * @throws IOException IOException */ public void processFile(final Configuration conf, final Path p) throws IOException { FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { System.err.println("ERROR, file doesnt exist: " + p); return; } if (!fs.isFile(p)) { System.err.println(p + " is not a file"); return; } FileStatus logFile = fs.getFileStatus(p); if (logFile.getLen() == 0) { out.println("Zero length file: " + p); return; } out.println("Opening procedure state-log: " + p); ProcedureWALFile log = new ProcedureWALFile(fs, logFile); processProcedureWALFile(log); }
public void processProcedureWALFile(ProcedureWALFile log) throws IOException { log.open(); ProcedureWALHeader header = log.getHeader(); printHeader(header); FSDataInputStream stream = log.getStream(); try { boolean hasMore = true; while (hasMore) { ProcedureWALEntry entry = ProcedureWALFormat.readEntry(stream); if (entry == null) { out.println("No more entry, exiting with missing EOF"); hasMore = false; break; } switch (entry.getType()) { case PROCEDURE_WAL_EOF: hasMore = false; break; default: printEntry(entry); } } } catch (IOException e) { out.println("got an exception while reading the procedure WAL " + e.getMessage()); } finally { log.close(); } }
public static void main(String[] args) throws Exception { final Configuration conf = HBaseConfiguration.create(); int exitCode = ToolRunner.run(conf, new ProcedureWALPrettyPrinter(), args); System.exit(exitCode); } }
private void printEntry(final ProcedureWALEntry entry) throws IOException { out.println("EntryType=" + entry.getType()); int procCount = entry.getProcedureCount(); for (int i = 0; i < procCount; i++) { Procedure<?> proc = ProcedureUtil.convertToProcedure(entry.getProcedure(i)); printProcedure(proc); } }
/** * Reads a log file and outputs its contents. * * @param conf HBase configuration relevant to this log file * @param p path of the log file to be read * @throws IOException IOException */ public void processFile(final Configuration conf, final Path p) throws IOException { FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { System.err.println("ERROR, file doesnt exist: " + p); return; } if (!fs.isFile(p)) { System.err.println(p + " is not a file"); return; } FileStatus logFile = fs.getFileStatus(p); if (logFile.getLen() == 0) { out.println("Zero length file: " + p); return; } out.println("Opening procedure state-log: " + p); ProcedureWALFile log = new ProcedureWALFile(fs, logFile); processProcedureWALFile(log); }
public void processProcedureWALFile(ProcedureWALFile log) throws IOException { log.open(); ProcedureWALHeader header = log.getHeader(); printHeader(header); FSDataInputStream stream = log.getStream(); try { boolean hasMore = true; while (hasMore) { ProcedureWALEntry entry = ProcedureWALFormat.readEntry(stream); if (entry == null) { out.println("No more entry, exiting with missing EOF"); hasMore = false; break; } switch (entry.getType()) { case PROCEDURE_WAL_EOF: hasMore = false; break; default: printEntry(entry); } } } catch (IOException e) { out.println("got an exception while reading the procedure WAL " + e.getMessage()); } finally { log.close(); } }
public static void main(String[] args) throws Exception { final Configuration conf = HBaseConfiguration.create(); int exitCode = ToolRunner.run(conf, new ProcedureWALPrettyPrinter(), args); System.exit(exitCode); } }