You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2023/07/21 22:54:59 UTC

[accumulo] branch 2.1 updated: Capture lock sessionId after lock acquisition for reuse (#3638)

This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new dfbb05f254 Capture lock sessionId after lock acquisition for reuse (#3638)
dfbb05f254 is described below

commit dfbb05f25468da71ff68d49c63cbef5d7f96398b
Author: Dave Marion <dl...@apache.org>
AuthorDate: Fri Jul 21 18:54:54 2023 -0400

    Capture lock sessionId after lock acquisition for reuse (#3638)
---
 .../src/main/java/org/apache/accumulo/tserver/TabletServer.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 74176696e2..46bbbb5480 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -230,6 +230,7 @@ public class TabletServer extends AbstractServer implements TabletHostingServer
   private DistributedWorkQueue bulkFailedCopyQ;
 
   private String lockID;
+  private long lockSessionId = -1;
 
   public static final AtomicLong seekCount = new AtomicLong(0);
 
@@ -707,6 +708,7 @@ public class TabletServer extends AbstractServer implements TabletHostingServer
           log.debug("Obtained tablet server lock {}", tabletServerLock.getLockPath());
           lockID = tabletServerLock.getLockID()
               .serialize(getContext().getZooKeeperRoot() + Constants.ZTSERVERS + "/");
+          lockSessionId = tabletServerLock.getSessionId();
           return;
         }
         log.info("Waiting for tablet server lock");
@@ -1007,9 +1009,12 @@ public class TabletServer extends AbstractServer implements TabletHostingServer
     if (address == null) {
       return null;
     }
+    if (lockSessionId == -1) {
+      return null;
+    }
 
     try {
-      return new TServerInstance(address, tabletServerLock.getSessionId());
+      return new TServerInstance(address, lockSessionId);
     } catch (Exception ex) {
       log.warn("Unable to read session from tablet server lock" + ex);
       return null;