Luo Chen has submitted this change and it was merged. Change subject: [ASTERIXDB-2522][TX] Skip WAIT record during lock conflicts ......................................................................
[ASTERIXDB-2522][TX] Skip WAIT record during lock conflicts - user model changes: no - storage format changes: no - interface changes: no Details: - A small optimization to our deadlock-free locking potocol by skipping the WAIT record. Once the partial frame has been flushed and previous records are committed, the locks held by the write thread will eventually be released by the log flusher thread. There is no need to force the writer thread to wait for the log flusher thread. Change-Id: I6ef3979d6393d45a6b7b2eb5f09f147299b5cd9f Reviewed-on: https://asterix-gerrit.ics.uci.edu/3232 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> --- M asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java 1 file changed, 3 insertions(+), 16 deletions(-) Approvals: Anon. E. Moose #1000171: Jenkins: Verified; No violations found; ; Verified Murtadha Hubail: Looks good to me, approved diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java index 3e41264..690ef1f 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/PrimaryIndexModificationOperationCallback.java @@ -62,11 +62,9 @@ * 3. if returnValue == false * 3-1. flush all entries (which already acquired locks) to the next operator * : this will make all those entries reach commit operator so that corresponding commit logs will be created. - * 3-2. create a WAIT log and wait until logFlusher thread will flush the WAIT log and gives notification - * : this notification guarantees that all locks acquired by this transactor (or all locks acquired for the entries) - * were released. - * 3-3. acquire lock using lock() instead of tryLock() for the failed entry - * : we know for sure this lock call will not cause deadlock since the transactor doesn't hold any other locks. + * 3-2. acquire lock using lock() instead of tryLock() for the failed entry + * : we know for sure this lock call will not cause deadlock since the locks held by the transactor + * will be eventually released by the log flusher. * 4. create an update log and insert the entry * From the above logic, step 2 and 3 are implemented in this before() method. **********************/ @@ -76,9 +74,6 @@ if (!tryLockSucceed) { //flush entries which have been inserted already to release locks hold by them operatorNodePushable.flushPartialFrame(); - - //create WAIT log and wait until the WAIT log is flushed and notified by LogFlusher thread - logWait(); //acquire lock lockManager.lock(datasetId, pkHash, LockMode.X, txnCtx); @@ -101,13 +96,5 @@ } catch (ACIDException e) { throw HyracksDataException.create(e); } - } - - private void logWait() throws ACIDException { - indexRecord.setLogType(LogType.WAIT); - indexRecord.computeAndSetLogSize(); - txnSubsystem.getLogManager().log(indexRecord); - // set the log type back to UPDATE for normal updates - indexRecord.setLogType(LogType.UPDATE); } } -- To view, visit https://asterix-gerrit.ics.uci.edu/3232 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6ef3979d6393d45a6b7b2eb5f09f147299b5cd9f Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Luo Chen <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Luo Chen <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]>
