private void appendToLog(List<TransactionEdit> edits) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edits); txMetricsCollector.rate("wal.append.count", edits.size()); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
private static void printLog(TransactionLog log) { try { System.out.println("TransactionLog " + log.getName()); TransactionLogReader reader = log.getReader(); TransactionEdit edit; long seq = 0; while ((edit = reader.next()) != null) { System.out.println(String.format(" %d: %s", seq++, edit.toString())); } } catch (IOException ioe) { System.err.println("ERROR reading log " + log.getName() + ": " + ioe.getMessage()); ioe.printStackTrace(); } } }
public synchronized TransactionSnapshot getSnapshot() throws IOException { TransactionSnapshot snapshot = null; if (!isRunning() && !isStopping()) { return null; } long now = System.currentTimeMillis(); // avoid duplicate snapshots at same timestamp if (now == lastSnapshotTime || (currentLog != null && now == currentLog.getTimestamp())) { try { TimeUnit.MILLISECONDS.sleep(1); } catch (InterruptedException ie) { } } // copy in memory state snapshot = getCurrentState(); LOG.debug("Starting snapshot of transaction state with timestamp {}", snapshot.getTimestamp()); LOG.debug("Returning snapshot of state: " + snapshot); return snapshot; }
oldLog.close();
oldLog.close();
private static void printLog(TransactionLog log) { try { System.out.println("TransactionLog " + log.getName()); TransactionLogReader reader = log.getReader(); TransactionEdit edit; long seq = 0; while ((edit = reader.next()) != null) { System.out.println(String.format(" %d: %s", seq++, edit.toString())); } } catch (IOException ioe) { System.err.println("ERROR reading log " + log.getName() + ": " + ioe.getMessage()); ioe.printStackTrace(); } } }
private void appendToLog(List<TransactionEdit> edits) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edits); txMetricsCollector.rate("wal.append.count", edits.size()); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
public synchronized TransactionSnapshot getSnapshot() throws IOException { TransactionSnapshot snapshot = null; if (!isRunning() && !isStopping()) { return null; } long now = System.currentTimeMillis(); // avoid duplicate snapshots at same timestamp if (now == lastSnapshotTime || (currentLog != null && now == currentLog.getTimestamp())) { try { TimeUnit.MILLISECONDS.sleep(1); } catch (InterruptedException ie) { } } // copy in memory state snapshot = getCurrentState(); LOG.debug("Starting snapshot of transaction state with timestamp {}", snapshot.getTimestamp()); LOG.debug("Returning snapshot of state: " + snapshot); return snapshot; }
private void appendToLog(TransactionEdit edit) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edit); txMetricsCollector.rate("wal.append.count"); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
private void appendToLog(TransactionEdit edit) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edit); txMetricsCollector.rate("wal.append.count"); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }