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


##########
meta-client/src/main/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionClient.java:
##########
@@ -257,6 +258,7 @@ private void relinquishLeaderHelper(String leaderPath, 
Boolean exitLeaderElectio
     }
     // check if current participant is the leader
     // read data and stats, check, and multi check + delete
+    try{

Review Comment:
   NIT: space.



##########
meta-client/src/main/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionClient.java:
##########
@@ -271,6 +273,8 @@ private void relinquishLeaderHelper(String leaderPath, 
Boolean exitLeaderElectio
           LOG.info("Someone else is already leader");
         }
       }
+    }} catch (MetaClientNoNodeException ex) {

Review Comment:
   NIT: format, two brackets.



##########
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:
   Would this change ZNode stats? like ephemeral owner?
   
   Also, just be safe, shall we use updater incase we have any requirement to 
update data in this node. At least, it will not cause race condition.



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