void setNoLongerRebasable() { assert Thread.holdsLock(this.raft); assert this.rebasable == (this.view.getReads() != null); if (this.rebasable) { if (this.raft.logger.isTraceEnabled()) this.raft.trace("stopping rebasing for " + this); this.raft.setHighPriority(this, false); // if it's not longer rebasable, it can't be a victim of any conflicts this.view.disableReadTracking(); this.rebasable = false; } }
/** * Given a possible new transaction to commit, check for the existence of a high priority with which it conflicts. */ private String checkHighPriorityConflict(Writes writes, String dumpDescription) { // Sanity check assert Thread.holdsLock(this.raft); assert this.raft.highPrioTx != null; assert Thread.holdsLock(this.raft.highPrioTx.view); // Check for conflict final Reads reads = this.raft.highPrioTx.view.getReads(); final Conflict conflict = reads.findConflict(writes); if (conflict == null) return null; // Report conflicts if (dumpDescription != null) { this.dumpConflicts(reads, writes, dumpDescription + " fails due to conflicts with high priority transaction " + this.raft.highPrioTx); } // Fail return "transaction conflicts with a high priority transaction: " + conflict; }
assert !skipConflictCheck || !tx.view.getReads().isConflict(logEntry.getWrites()); final Conflict conflict; if (!skipConflictCheck && (conflict = tx.view.getReads().findConflict(logEntry.getWrites())) != null) { if (this.log.isDebugEnabled()) this.debug("cannot rebase " + tx + " past " + logEntry + ", failing: " + conflict); if (this.raft.dumpConflicts) { this.dumpConflicts(tx.view.getReads(), logEntry.getWrites(), "local txId=" + tx.txId + " fails due to conflicts with " + logEntry);
final Reads reads = tx.view.getReads(); final long readsDataSize = reads.serializedLength(); if (readsDataSize != (int)readsDataSize)
assert !this.rebasable || this.commitIndex == 0 || this.commitIndex > raftCommitIndex; assert !this.rebasable || this.commitIndex == 0 || !this.addsLogEntry(); assert this.rebasable == (this.view.getReads() != null); assert this.rebasable || this != this.raft.highPrioTx; assert this.consistency == Consistency.LINEARIZABLE || this != this.raft.highPrioTx;