michaellx1057 commented on code in PR #18645:
URL: 
https://github.com/apache/dolphinscheduler/pull/18645#discussion_r4024531580


##########
dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/ha/AbstractHAServer.java:
##########
@@ -51,24 +56,23 @@ public AbstractHAServer(final Registry registry, final 
String selectorPath, fina
         this.registry = registry;
         this.selectorPath = checkNotNull(selectorPath);
         this.serverIdentify = checkNotNull(serverIdentify);

Review Comment:
   Thanks for the suggestion. I originally used a UUID to avoid relying on 
different construction timestamps for instances at the same address. For normal 
process restarts, I agree that a millisecond timestamp is a reasonable 
simplification here.
   
   Updated in d15ce27 to use `serverIdentify` directly with 
`System.currentTimeMillis()`, removing the extra field and UUID.



##########
dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/ha/AbstractHAServer.java:
##########
@@ -39,7 +40,11 @@ public abstract class AbstractHAServer implements HAServer {
 
     private final String serverIdentify;
 
-    private ServerStatus serverStatus;
+    private final String electionIdentity;
+
+    private volatile ServerStatus serverStatus;
+
+    private volatile boolean closed;

Review Comment:
   Thanks for the feedback. I agree that the broader lifecycle changes are not 
needed for this fix. In 
[7fab651](https://github.com/apache/dolphinscheduler/pull/18645/commits/7fab65108f1a5f270d4eb42e075a0ff93df51d60),
 I removed the immediate demotion on election exceptions, the `closed` 
handling, and the related Alert resource-cleanup changes. No new lifecycle 
states are added to `ServerStatus`.
   
   The startup election and Registry callbacks can run on different threads, so 
their election results and role updates are still serialized. The coordinator 
thread handoff protection from 3bb22b2 is also retained: subsequent tests 
reproduced overlap during normal loss and reacquisition of leadership, without 
injecting an election exception. I've added the focused test and deployment 
results in [validation 
results](https://github.com/apache/dolphinscheduler/pull/18645#issuecomment-5699157892).
   



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

Reply via email to