You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/09/18 20:04:19 UTC

[GitHub] [accumulo] tynyttie commented on a change in pull request #1710: WIP #873 Remove Sync and added StripedLock

tynyttie commented on a change in pull request #1710:
URL: https://github.com/apache/accumulo/pull/1710#discussion_r491164394



##########
File path: server/base/src/main/java/org/apache/accumulo/server/zookeeper/TransactionWatcher.java
##########
@@ -128,44 +131,59 @@ public boolean transactionComplete(String type, long tid) throws Exception {
    * that task is not run and a debug message is logged indicating the task was ignored.
    */
   public void runQuietly(String ztxBulk, long tid, Runnable task) {
-    synchronized (counts) {
-      try {
-        if (!arbitrator.transactionAlive(ztxBulk, tid)) {
-          log.debug("Transaction " + tid + " of type " + ztxBulk + " is no longer active.");
-          return;
-        }
-      } catch (Exception e) {
-        log.warn("Unable to check if transaction " + tid + " of type " + ztxBulk + " is alive ", e);
+
+    Lock l = stripedLocks.get(tid);
+    l.lock();
+    try {
+      if (!arbitrator.transactionAlive(ztxBulk, tid)) {
+        log.debug("Transaction " + tid + " of type " + ztxBulk + " is no longer active.");
         return;
       }
-      increment(tid);
+    } catch (Exception e) {
+      log.warn("Unable to check if transaction " + tid + " of type " + ztxBulk + " is alive ", e);
+      return;
     }
+    increment(tid);
     try {
       task.run();
     } finally {
       decrement(tid);
+      l.lock();
     }
+

Review comment:
       Please check the latest commit. I sent the wrong version. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org