gavinchou commented on code in PR #432:
URL: https://github.com/apache/doris-thirdparty/pull/432#discussion_r4728331489


##########
src/main/java/com/sleepycat/je/rep/impl/node/RepNode.java:
##########
@@ -1362,23 +1362,19 @@ private void 
checkLoopbackAddresses(Set<InetSocketAddress> helperSockets) {
     private void queryGroupForMembership()
         throws InterruptedException {
 
-        Set<InetSocketAddress> helperSockets = repImpl.getHelperSockets();
-
-        checkLoopbackAddresses(helperSockets);
-
-        /*
-         * Not in the rep group. Use the designated helpers and other members
-         * of the group to help us figure out how to get started.
-         */
-        final Set<InetSocketAddress> helpers = new HashSet<>(helperSockets);
-        helpers.addAll(group.getAllHelperSockets());
-        if (helpers.isEmpty()) {
-            throw EnvironmentFailureException.unexpectedState
-                ("Need a helper to add a new node into the group");
-        }
+        checkLoopbackAddresses(repImpl.getHelperSockets());
 
         NameIdPair groupMasterNameId;
         while (true) {
+            /* Resolve addresses again so retries can recover from DNS 
changes. */
+            final Set<InetSocketAddress> helpers =
+                new HashSet<>(repImpl.getHelperSockets());

Review Comment:
   **Minor: validate the refreshed helper addresses inside the retry loop.**
   
   `checkLoopbackAddresses(...)` is currently called only before the loop, 
using a separate `getHelperSockets()` result that is then discarded. The 
addresses actually queried are resolved again on every retry without this 
validation.
   
   For example, with a non-loopback local address, a helper that is initially 
unresolved passes the existing check (it is treated as non-loopback). If it 
later resolves to `127.0.0.1`, the refreshed address is used without rejecting 
the loopback/non-loopback mismatch.
   
   Please fetch the configured helper set once per iteration, run 
`checkLoopbackAddresses(helperSockets)` on that exact set, then copy it and add 
the group's helpers. This also avoids the extra resolution before the first 
iteration. A regression test covering this DNS transition would protect the 
invariant.



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