protected void validateNestedRead(Map.Entry<VBox, InplaceWrite> read) { InplaceWrite inplaceRead = read.getValue(); InplaceWrite iter = read.getKey().inplace; do { if (iter == inplaceRead) { break; } int maxVersion = retrieveAncestorVersion(iter.orec.owner); if (maxVersion >= 0) { manualAbort(); TransactionSignaller.SIGNALLER.signalCommitFail(iter.orec.owner); } iter = iter.next; } while (iter != null); }
protected <T> VBoxBody<T> newerVersionDetected(VBoxBody<T> body) { // signal early transaction abort TransactionSignaller.SIGNALLER.signalEarlyAbort(); throw new AssertionError("Impossible condition - Commit fail signalled!"); }
/** * This method has some redundant tasks with the setBoxValue of the InevitableTransaction. * Yet, this is the most simple way of preserving the original InevitableTransaction and * without requiring any subclass specialization. */ private static <T extends VBoxAom<T>> T getTargetForInnevitable(T ref, int txNumber){ VBoxBody<T> vbody = ref.body; if ((vbody != null) && (vbody.version == txNumber)) { // In this case we already have written to this VBox during // current Inevitable transaction (strange in this scenario - // maybe possible in others). // So we already have replicated the last value. return vbody.value; } else { VBoxBody<T> body = ref.body; if (body!= null && body.version > txNumber) { TransactionSignaller.SIGNALLER.signalCommitFail(); throw new AssertionError("Impossible condition - Commit fail signalled!"); } if(body == null) return ref.replicate(); else return body.value.replicate(); } }
protected <T> T readGlobal(VBox<T> vbox) { VBoxBody<T> body = vbox.body; if (body.version > number) { TransactionSignaller.SIGNALLER.signalEarlyAbort(); } ReadBlock readBlock = null; if (next < 0) { if (blocksFree.get().get() > 0) { for (ReadBlock poolBlock : blocksPool.get()) { if (poolBlock.free) { poolBlock.free = false; readBlock = poolBlock; blocksFree.get().decrementAndGet(); break; } } } else { readBlock = new ReadBlock(blocksFree.get()); } next = 999; globalReads = globalReads.cons(readBlock); } else { readBlock = globalReads.first(); } readBlock.entries[next--] = vbox; return body.value; }
TransactionSignaller.SIGNALLER.signalCommitFail(); throw new AssertionError("Impossible condition - Commit fail signalled!");
VBoxBody body = array[i].body; if (body != null && body.version > myNumber) { TransactionSignaller.SIGNALLER.signalCommitFail(); VBoxBody body = ar[i].body; if (body != null && body.version > myNumber) { TransactionSignaller.SIGNALLER.signalCommitFail(); VBoxBody body = array[i].body; if (body != null && body.version > myNumber) { TransactionSignaller.SIGNALLER.signalCommitFail(); VBoxBody body = array[i].body; if (body != null && body.version > myNumber) { TransactionSignaller.SIGNALLER.signalCommitFail(); TransactionSignaller.SIGNALLER.signalCommitFail();
TransactionSignaller.SIGNALLER.signalCommitFail(inplaceOrec.owner);
protected Cons<VArrayEntry<?>> validateNestedArrayReads() { Map<VArrayEntry<?>, VArrayEntry<?>> parentArrayWrites = getRWParent().arrayWrites; Cons<VArrayEntry<?>> parentArrayReads = getRWParent().arraysRead; int maxVersionOnParent = retrieveAncestorVersion(parent); for (VArrayEntry<?> entry : arraysRead) { // If the read was performed on an ancestor of the parent, then // propagate it for further validation if (entry.owner != parent) { parentArrayReads = parentArrayReads.cons(entry); } synchronized (parent) { if (parentArrayWrites != EMPTY_MAP) { // Verify if the parent contains a more recent write for the // read that we performed somewhere in our ancestors VArrayEntry<?> parentWrite = parentArrayWrites.get(entry); if (parentWrite == null) { continue; } if (parentWrite.nestedVersion > maxVersionOnParent) { TransactionSignaller.SIGNALLER.signalCommitFail(parent); } } } } return parentArrayReads; } }
protected void validateGlobalReads(Cons<ReadBlock> reads, int startIdx) { VBox[] array = reads.first().entries; // the first may not be full for (int i = startIdx + 1; i < array.length; i++) { InplaceWrite iter = array[i].inplace; do { int maxVersion = retrieveAncestorVersion(iter.orec.owner); if (maxVersion >= 0) { manualAbort(); TransactionSignaller.SIGNALLER.signalCommitFail(iter.orec.owner); } iter = iter.next; } while (iter != null); } // the rest are full for (ReadBlock block : reads.rest()) { array = block.entries; for (int i = 0; i < array.length; i++) { InplaceWrite iter = array[i].inplace; do { int maxVersion = retrieveAncestorVersion(iter.orec.owner); if (maxVersion >= 0) { manualAbort(); TransactionSignaller.SIGNALLER.signalCommitFail(iter.orec.owner); } iter = iter.next; } while (iter != null); } } }
TransactionSignaller.SIGNALLER.signalCommitFail(); throw new AssertionError("Impossible condition - Commit fail signalled!");
logger.debug("Commit request {} was found already INVALID", this.commitRequest.getId()); TransactionSignaller.SIGNALLER.signalCommitFail(); throw new AssertionError("Impossible condition - Commit fail signalled!"); TransactionSignaller.SIGNALLER.signalCommitFail(); throw new AssertionError("Impossible condition - Commit fail signalled!"); } else { } else { logger.debug("Some helper already found commit request {} to be INVALID", this.commitRequest.getId()); TransactionSignaller.SIGNALLER.signalCommitFail(); throw new AssertionError("Impossible condition - Commit fail signalled!");
@Override protected <T> T getLocalArrayValue(VArrayEntry<T> entry) { if (this.arrayWrites != EMPTY_MAP) { VArrayEntry<T> wsEntry = (VArrayEntry<T>) this.arrayWrites.get(entry); if (wsEntry != null) { return (wsEntry.getWriteValue() == null ? (T) NULL_VALUE : wsEntry.getWriteValue()); } } ReadWriteTransaction iter = getRWParent(); while (iter != null) { synchronized (iter) { if (iter.arrayWrites != EMPTY_MAP) { VArrayEntry<T> wsEntry = (VArrayEntry<T>) iter.arrayWrites.get(entry); if (wsEntry == null) { iter = iter.getRWParent(); continue; } if (wsEntry.nestedVersion <= retrieveAncestorVersion(iter)) { this.arraysRead = this.arraysRead.cons(entry); entry.setReadOwner(iter); return (wsEntry.getWriteValue() == null ? (T) NULL_VALUE : wsEntry.getWriteValue()); } else { TransactionSignaller.SIGNALLER.signalCommitFail(iter); } } } iter = iter.getRWParent(); } return null; }