xyuanlu commented on code in PR #2585:
URL: https://github.com/apache/helix/pull/2585#discussion_r1294862664


##########
meta-client/src/main/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionClient.java:
##########
@@ -404,6 +416,25 @@ public void handleConnectionEstablishmentError(Throwable 
error) throws Exception
     }
   }
 
+  private void touchLeaderNode() {
+    for (String leaderPath : _leaderGroups) {
+      String key = leaderPath;
+      ImmutablePair<LeaderInfo, MetaClientInterface.Stat> tup = 
_metaClient.getDataAndStat(key);
+      if (tup.left.getLeaderName().equalsIgnoreCase(_participant)) {
+        int expectedVersion = tup.right.getVersion();
+        try {
+          _metaClient.set(key, tup.left, expectedVersion);

Review Comment:
   Here when we touch current ZNode, 
   1. we get ZNode version and content at the same time. 
   2. Check content - if current participant is leader
   3. Update ZNode using set() with expected version. Meaning we only touch 
ZNode if no new change was made between step 1 and 3. 
   
   Since current participant is still leader, meaning client reconnect within 
expire time. Touching the ZNode wont change  ephemeral owner.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to