public void report(String status, String alias) { MetricNames names = env.getMetricNames(); MetricRegistry registry = env.getSharedResources().getMetricRegistry(); if (getLockWaitTime() > 0) { MetricsUtil.getTimer(env.getConfiguration(), registry, names.getTxLockWaitTime(alias)) .update(getLockWaitTime(), TimeUnit.MILLISECONDS); } MetricsUtil.getTimer(env.getConfiguration(), registry, names.getTxExecTime(alias)) .update(getReadTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) { registry.meter(names.getTxWithCollision(alias)).mark(); registry.meter(names.getTxCollisions(alias)).mark(getCollisions()); } registry.meter(names.getTxEntriesSet(alias)).mark(getEntriesSet()); registry.meter(names.getTxEntriesRead(alias)).mark(getEntriesReturned()); if (getTimedOutLocks() > 0) { registry.meter(names.getTxLocksTimedout(alias)).mark(getTimedOutLocks()); } if (getDeadLocks() > 0) { registry.meter(names.getTxLocksDead(alias)).mark(getDeadLocks()); } registry.meter(names.getTxStatus(status.toLowerCase(), alias)).mark(); }
@Override public void close() { log.trace("txid: {} close()", txid); if (summaryLog.isTraceEnabled()) { TxStats stats = tx.getStats(); String className = "N/A"; if (clazz != null) { className = clazz.getSimpleName(); } // TODO log total # read, see fluo-426 summaryLog.trace( "txid: {} thread : {} time: {} ({} {}) #ret: {} #set: {} #collisions: {} " + "waitTime: {} committed: {} class: {}", txid, Thread.currentThread().getId(), stats.getTime(), stats.getReadTime(), stats.getCommitTime(), stats.getEntriesReturned(), stats.getEntriesSet(), stats.getCollisions(), stats.getLockWaitTime(), committed, className); } tx.close(); }
@Override public void committed() { log.trace("txid: {} commit() -> SUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); committed = true; aco.committed(); }
private void logUnsuccessfulCommit() { log.trace("txid: {} commit() -> UNSUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); if (!log.isTraceEnabled() && notification != null) { collisionLog.trace("txid: {} trigger: {} {} {}", txid, notification.getRow(), notification.getColumn(), notification.getTimestamp()); } if (!log.isTraceEnabled() && clazz != null) { collisionLog.trace("txid: {} class: {}", txid, clazz.getName()); } collisionLog.trace("txid: {} collisions: {}", txid, toStringEncNonAsciiMBSC(tx.getStats().getRejected())); }
Assert.assertEquals(0, tx3.getStats().getDeadLocks()); Assert.assertEquals(0, tx3.getStats().getTimedOutLocks()); Assert.assertEquals(1, tx3.getStats().getDeadLocks()); Assert.assertEquals(0, tx3.getStats().getTimedOutLocks()); } else { Assert.assertEquals(0, tx3.getStats().getDeadLocks()); Assert.assertEquals(1, tx3.getStats().getTimedOutLocks());
public TransactionImpl(Environment env, Notification trigger, long startTs) { Objects.requireNonNull(env, "environment cannot be null"); Preconditions.checkArgument(startTs >= 0, "startTs cannot be negative"); this.env = env; this.stats = new TxStats(env); this.startTs = startTs; this.observedColumns = env.getConfiguredObservers().getObservedColumns(STRONG); if (trigger != null && env.getConfiguredObservers().getObservedColumns(WEAK).contains(trigger.getColumn())) { this.weakNotification = trigger; } else { this.notification = trigger; } if (notification != null) { Map<Column, Bytes> colUpdates = new HashMap<>(); colUpdates.put(notification.getColumn(), NTFY_VAL); updates.put(notification.getRow(), colUpdates); } }
private void logUnsuccessfulCommit() { log.trace("txid: {} commit() -> UNSUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); if (!log.isTraceEnabled() && notification != null) { collisionLog.trace("txid: {} trigger: {} {} {}", txid, notification.getRow(), notification.getColumn(), notification.getTimestamp()); } if (!log.isTraceEnabled() && clazz != null) { collisionLog.trace("txid: {} class: {}", txid, clazz.getName()); } collisionLog.trace("txid: {} collisions: {}", txid, toStringEncNonAsciiMBSC(tx.getStats().getRejected())); }
public TransactionImpl(Environment env, Notification trigger, long startTs) { Objects.requireNonNull(env, "environment cannot be null"); Preconditions.checkArgument(startTs >= 0, "startTs cannot be negative"); this.env = env; this.stats = new TxStats(env); this.startTs = startTs; this.observedColumns = env.getConfiguredObservers().getObservedColumns(STRONG); if (trigger != null && env.getConfiguredObservers().getObservedColumns(WEAK).contains(trigger.getColumn())) { this.weakNotification = trigger; } else { this.notification = trigger; } if (notification != null) { Map<Column, Bytes> colUpdates = new HashMap<>(); colUpdates.put(notification.getColumn(), NTFY_VAL); updates.put(notification.getRow(), colUpdates); } }
public void report(String status, String alias) { MetricNames names = env.getMetricNames(); MetricRegistry registry = env.getSharedResources().getMetricRegistry(); if (getLockWaitTime() > 0) { MetricsUtil.getTimer(env.getConfiguration(), registry, names.getTxLockWaitTime(alias)) .update(getLockWaitTime(), TimeUnit.MILLISECONDS); } MetricsUtil.getTimer(env.getConfiguration(), registry, names.getTxExecTime(alias)) .update(getReadTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) { registry.meter(names.getTxWithCollision(alias)).mark(); registry.meter(names.getTxCollisions(alias)).mark(getCollisions()); } registry.meter(names.getTxEntriesSet(alias)).mark(getEntriesSet()); registry.meter(names.getTxEntriesRead(alias)).mark(getEntriesReturned()); if (getTimedOutLocks() > 0) { registry.meter(names.getTxLocksTimedout(alias)).mark(getTimedOutLocks()); } if (getDeadLocks() > 0) { registry.meter(names.getTxLocksDead(alias)).mark(getDeadLocks()); } registry.meter(names.getTxStatus(status.toLowerCase(), alias)).mark(); }
@Override public void close() { log.trace("txid: {} close()", txid); if (summaryLog.isTraceEnabled()) { TxStats stats = tx.getStats(); String className = "N/A"; if (clazz != null) { className = clazz.getSimpleName(); } // TODO log total # read, see fluo-426 summaryLog.trace( "txid: {} thread : {} time: {} ({} {}) #ret: {} #set: {} #collisions: {} " + "waitTime: {} committed: {} class: {}", txid, Thread.currentThread().getId(), stats.getTime(), stats.getReadTime(), stats.getCommitTime(), stats.getEntriesReturned(), stats.getEntriesSet(), stats.getCollisions(), stats.getLockWaitTime(), committed, className); } tx.close(); }
@Override public void committed() { log.trace("txid: {} commit() -> SUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); committed = true; aco.committed(); }
@Override public Collection<Mutation> createMutations(CommitData cd) { long commitTs = getStats().getCommitTs(); ArrayList<Mutation> mutations = new ArrayList<>(updates.size() + 1); for (Entry<Bytes, Map<Column, Bytes>> rowUpdates : updates.entrySet()) { Flutation m = new Flutation(env, rowUpdates.getKey()); boolean isTriggerRow = isTriggerRow(rowUpdates.getKey()); for (Entry<Column, Bytes> colUpdates : rowUpdates.getValue().entrySet()) { ColumnUtil.commitColumn(env, isTriggerRow && colUpdates.getKey().equals(notification.getColumn()), false, colUpdates.getKey(), isWrite(colUpdates.getValue()), isDelete(colUpdates.getValue()), isReadLock(colUpdates.getValue()), startTs, commitTs, observedColumns, m); } mutations.add(m); } return mutations; }
@Override public Collection<Mutation> createMutations(CommitData cd) { long commitTs = getStats().getCommitTs(); ArrayList<Mutation> mutations = new ArrayList<>(updates.size() + 1); for (Entry<Bytes, Map<Column, Bytes>> rowUpdates : updates.entrySet()) { Flutation m = new Flutation(env, rowUpdates.getKey()); boolean isTriggerRow = isTriggerRow(rowUpdates.getKey()); for (Entry<Column, Bytes> colUpdates : rowUpdates.getValue().entrySet()) { ColumnUtil.commitColumn(env, isTriggerRow && colUpdates.getKey().equals(notification.getColumn()), false, colUpdates.getKey(), isWrite(colUpdates.getValue()), isDelete(colUpdates.getValue()), isReadLock(colUpdates.getValue()), startTs, commitTs, observedColumns, m); } mutations.add(m); } return mutations; }
@Override public void commit() throws CommitException { try { tx.commit(); committed = true; log.trace("txid: {} commit() -> SUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); } catch (CommitException ce) { logUnsuccessfulCommit(); throw ce; } }
@Override public void commit() throws CommitException { try { tx.commit(); committed = true; log.trace("txid: {} commit() -> SUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); } catch (CommitException ce) { logUnsuccessfulCommit(); throw ce; } }
@Override public Collection<Mutation> createMutations(CommitData cd) { long commitTs = getStats().getCommitTs(); HashMap<Bytes, Mutation> mutations = new HashMap<>();
@Override public Collection<Mutation> createMutations(CommitData cd) { long commitTs = getStats().getCommitTs(); ArrayList<Mutation> afterFlushMutations = new ArrayList<>(2); Flutation m = new Flutation(env, cd.prow); // mark transaction as complete for garbage collection purposes m.put(cd.pcol, ColumnConstants.TX_DONE_PREFIX | commitTs, EMPTY); afterFlushMutations.add(m); if (weakNotification != null) { afterFlushMutations.add(weakNotification.newDelete(env, startTs)); } if (notification != null) { afterFlushMutations.add(notification.newDelete(env, startTs)); } return afterFlushMutations; }
@Override public Collection<Mutation> createMutations(CommitData cd) { long commitTs = getStats().getCommitTs(); HashMap<Bytes, Mutation> mutations = new HashMap<>();
@Override public Collection<Mutation> createMutations(CommitData cd) { long commitTs = getStats().getCommitTs(); ArrayList<Mutation> afterFlushMutations = new ArrayList<>(2); Flutation m = new Flutation(env, cd.prow); // mark transaction as complete for garbage collection purposes m.put(cd.pcol, ColumnType.TX_DONE.encode(commitTs), EMPTY); afterFlushMutations.add(m); if (weakNotification != null) { afterFlushMutations.add(weakNotification.newDelete(env, startTs)); } if (notification != null) { afterFlushMutations.add(notification.newDelete(env, startTs)); } return afterFlushMutations; }
long commitTs = getStats().getCommitTs(); Result result = Iterators.getOnlyElement(results); Status ms = result.getStatus();