You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "xyuanlu (via GitHub)" <gi...@apache.org> on 2023/08/15 16:42:27 UTC
[GitHub] [helix] xyuanlu commented on a diff in pull request #2585: Leader election client - Proactively send leader gone event when disconnect from ZK
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org