@Override public final long getId() { long txnId = mTxnId; if (txnId == 0 && mRedo != null) { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { txnId = assignTransactionId(); } finally { shared.release(); } } return txnId < 0 ? 0 : txnId; }
/** * Caller does not need to hold db commit lock. * * @return savepoint */ final long scopeEnter() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { long savepoint = mLength; doScopeEnter(); return savepoint; } finally { shared.release(); } }
/** * Truncate all log entries. Caller does not need to hold db commit lock. * * @param commit pass true to indicate that top of stack is a commit op */ final void truncate(boolean commit) throws IOException { final CommitLock commitLock = mDatabase.commitLock(); CommitLock.Shared shared = commitLock.acquireShared(); try { shared = doTruncate(commitLock, shared, commit); } finally { shared.release(); } }
/** * Caller does not need to hold db commit lock. * * @return savepoint */ final long scopeCommit() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { doPush(OP_SCOPE_COMMIT); return mLength; } finally { shared.release(); } }
/** * Caller does not need to hold db commit lock. * * @return savepoint */ final long scopeCommit() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { doPush(OP_SCOPE_COMMIT); return mLength; } finally { shared.release(); } }
/** * Truncate all log entries. Caller does not need to hold db commit lock. * * @param commit pass true to indicate that top of stack is a commit op */ final void truncate(boolean commit) throws IOException { final CommitLock commitLock = mDatabase.commitLock(); CommitLock.Shared shared = commitLock.acquireShared(); try { shared = doTruncate(commitLock, shared, commit); } finally { shared.release(); } }
/** * Truncate all log entries. Caller does not need to hold db commit lock. * * @param commit pass true to indicate that top of stack is a commit op */ final void truncate(boolean commit) throws IOException { final CommitLock commitLock = mDatabase.commitLock(); CommitLock.Shared shared = commitLock.acquireShared(); try { shared = doTruncate(commitLock, shared, commit); } finally { shared.release(); } }
/** * Caller does not need to hold db commit lock. * * @return savepoint */ final long scopeEnter() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { long savepoint = mLength; doScopeEnter(); return savepoint; } finally { shared.release(); } }
/** * Rollback all log entries to the given savepoint. Pass zero to rollback * everything. Caller does not need to hold db commit lock. */ final void scopeRollback(long savepoint) throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { if (savepoint < mLength) { // Rollback the entire scope, including the enter op. doRollback(savepoint); } } finally { shared.release(); } }
/** * Caller does not need to hold db commit lock. * * @return savepoint */ final long scopeCommit() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { doPush(OP_SCOPE_COMMIT); return mLength; } finally { shared.release(); } }
/** * Rollback all log entries to the given savepoint. Pass zero to rollback * everything. Caller does not need to hold db commit lock. */ final void scopeRollback(long savepoint) throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { if (savepoint < mLength) { // Rollback the entire scope, including the enter op. doRollback(savepoint); } } finally { shared.release(); } }
/** * Rollback all log entries. Caller does not need to hold db commit lock. */ final void rollback() throws IOException { if (mLength == 0) { // Nothing to rollback, so return quickly. return; } final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { doRollback(0); } finally { shared.release(); } }
/** * Rollback all log entries. Caller does not need to hold db commit lock. */ final void rollback() throws IOException { if (mLength == 0) { // Nothing to rollback, so return quickly. return; } final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { doRollback(0); } finally { shared.release(); } }
/** * Rollback all log entries to the given savepoint. Pass zero to rollback * everything. Caller does not need to hold db commit lock. */ final void scopeRollback(long savepoint) throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { if (savepoint < mLength) { // Rollback the entire scope, including the enter op. doRollback(savepoint); } } finally { shared.release(); } }
/** * Caller does not need to hold db commit lock. * * @return savepoint */ final long scopeEnter() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { long savepoint = mLength; doScopeEnter(); return savepoint; } finally { shared.release(); } }
/** * Rollback all log entries, and then discard this UndoLog object. Caller does not need to * hold db commit lock. */ final void rollback() throws IOException { if (mLength == 0) { // Nothing to rollback, so return quickly. return; } final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { doRollback(0); } finally { shared.release(); } }
@Override public final void customUndo(byte[] message) throws IOException { if (mDatabase.mCustomTxnHandler == null) { throw new IllegalStateException("Custom transaction handler is not installed"); } check(); final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { undoLog().pushCustom(message); } finally { shared.release(); } }
private void pushUndoPrepare() throws IOException { final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { undoLog().pushPrepare(); } finally { shared.release(); } }
@Override public final void customUndo(byte[] message) throws IOException { if (mDatabase.mCustomTxnHandler == null) { throw new IllegalStateException("Custom transaction handler is not installed"); } check(); final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { undoLog().pushCustom(message); } catch (Throwable e) { borked(e, true, true); // rollback = true, rethrow = true } finally { shared.release(); } }
@Override public final void customUndo(byte[] message) throws IOException { if (mDatabase.mCustomTxnHandler == null) { throw new IllegalStateException("Custom transaction handler is not installed"); } check(); final CommitLock.Shared shared = mDatabase.commitLock().acquireShared(); try { undoLog().pushCustom(message); } catch (Throwable e) { borked(e, true, true); // rollback = true, rethrow = true } finally { shared.release(); } }