@Override protected void onShutdown() { // perform a final metrics emit txMetricsCollector.gauge("committing.size", committingChangeSets.size()); txMetricsCollector.gauge("committed.size", committedChangeSets.size()); txMetricsCollector.gauge("inprogress.size", inProgress.size()); txMetricsCollector.gauge("invalid.size", invalidArray.length); }
/** * Start a long transaction. Long transactions and do not participate in conflict detection. Also, aborting a long * transaction moves it to the invalid list because we assume that its writes cannot be rolled back. */ public Transaction startLong() { txMetricsCollector.rate("start.long"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(defaultLongTimeout); Transaction tx = startTx(expiration, TransactionType.LONG); txMetricsCollector.histogram("start.long.latency", (int) timer.elapsedMillis()); return tx; }
public TransactionManager(Configuration config) { this(config, new NoOpTransactionStateStorage(new SnapshotCodecProvider(config)), new DefaultMetricsCollector()); }
@Override protected AbstractTransactionStateStorage getStorage(Configuration conf) { return new HDFSTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); } }
/** * Start a long transaction. Long transactions and do not participate in conflict detection. Also, aborting a long * transaction moves it to the invalid list because we assume that its writes cannot be rolled back. */ public Transaction startLong() { txMetricsCollector.rate("start.long"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(defaultLongTimeout); Transaction tx = startTx(expiration, TransactionType.LONG); txMetricsCollector.histogram("start.long.latency", (int) timer.elapsedMillis()); return tx; }
@Override protected AbstractTransactionStateStorage getStorage(Configuration conf) { return new LocalFileTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); }
@Override public void doRun() { txMetricsCollector.gauge("committing.size", committingChangeSets.size()); txMetricsCollector.gauge("committed.size", committedChangeSets.size()); txMetricsCollector.gauge("inprogress.size", inProgress.size()); txMetricsCollector.gauge("invalid.size", invalidArray.length); }
public TransactionManager(Configuration config) { this(config, new NoOpTransactionStateStorage(new SnapshotCodecProvider(config)), new DefaultMetricsCollector()); }
/** * Start a short transaction with a given timeout. * @param timeoutInSeconds the time out period in seconds. */ public Transaction startShort(int timeoutInSeconds) { Preconditions.checkArgument(timeoutInSeconds > 0, "timeout must be positive but is %s", timeoutInSeconds); txMetricsCollector.rate("start.short"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(timeoutInSeconds); Transaction tx = startTx(expiration, TransactionType.SHORT); txMetricsCollector.histogram("start.short.latency", (int) timer.elapsedMillis()); return tx; }
@Before public void before() { conf.setInt(TxConstants.Manager.CFG_TX_CLEANUP_INTERVAL, 0); // no cleanup thread // todo should create two sets of tests, one with LocalFileTxStateStorage and one with InMemoryTxStateStorage txStateStorage = new InMemoryTransactionStateStorage(); txManager = new TransactionManager (conf, txStateStorage, new TxMetricsCollector()); txManager.startAndWait(); }
@Override public void doRun() { txMetricsCollector.gauge("committing.size", committingChangeSets.size()); txMetricsCollector.gauge("committed.size", committedChangeSets.size()); txMetricsCollector.gauge("inprogress.size", inProgress.size()); txMetricsCollector.gauge("invalid.size", invalidArray.length); }
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); } }
@BeforeClass public static void before() { txManager = new TransactionManager(conf, new InMemoryTransactionStateStorage(), new TxMetricsCollector()); txManager.startAndWait(); }
@Override protected void onShutdown() { // perform a final metrics emit txMetricsCollector.gauge("committing.size", committingChangeSets.size()); txMetricsCollector.gauge("committed.size", committedChangeSets.size()); txMetricsCollector.gauge("inprogress.size", inProgress.size()); txMetricsCollector.gauge("invalid.size", invalidArray.length); }
/** * Start a short transaction with a given timeout. * @param timeoutInSeconds the time out period in seconds. */ public Transaction startShort(int timeoutInSeconds) { Preconditions.checkArgument(timeoutInSeconds > 0, "timeout must be positive but is %s", timeoutInSeconds); txMetricsCollector.rate("start.short"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(timeoutInSeconds); Transaction tx = startTx(expiration, TransactionType.SHORT); txMetricsCollector.histogram("start.short.latency", (int) timer.elapsedMillis()); return tx; }
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(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 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 boolean invalidate(long tx) { // guard against changes to the transaction log while processing txMetricsCollector.rate("invalidate"); Stopwatch timer = new Stopwatch().start(); this.logReadLock.lock(); try { boolean success; synchronized (this) { ensureAvailable(); success = doInvalidate(tx); } appendToLog(TransactionEdit.createInvalid(tx)); txMetricsCollector.histogram("invalidate.latency", (int) timer.elapsedMillis()); return success; } finally { this.logReadLock.unlock(); } }
public boolean invalidate(long tx) { // guard against changes to the transaction log while processing txMetricsCollector.rate("invalidate"); Stopwatch timer = new Stopwatch().start(); this.logReadLock.lock(); try { boolean success; synchronized (this) { ensureAvailable(); success = doInvalidate(tx); } appendToLog(TransactionEdit.createInvalid(tx)); txMetricsCollector.histogram("invalidate.latency", (int) timer.elapsedMillis()); return success; } finally { this.logReadLock.unlock(); } }