michaellx1057 opened a new pull request, #18645:
URL: https://github.com/apache/dolphinscheduler/pull/18645

   ## Was this PR generated or assisted by AI?
   
   YES — Codex assisted with source analysis, implementation, regression tests 
and this description. Human review of the final diff is pending. No production 
deployment of this patch has been performed.
   
   ## Purpose of the pull request
   
   Closes #18644.
   
   Fix the remaining shared HA ownership issue. A restarted server with the 
same address must not accept its predecessor's selector, and a server that 
loses an election must not retain ACTIVE.
   
   This follows the identity-reuse analysis in #18624. The serial-coordinator 
restart fix #18623 and etcd REMOVE-value fix #18641 address different layers 
and are not replaced by this change.
   
   ## Brief change log
   
   - Give each HA server instance a unique election identity.
   - Reconcile the current selector on removal and serialize local 
election/status application.
   - Demote on unsuccessful election and release only acquired election locks.
   - Respect terminal HA shutdown in Master and Alert; prevent a retry or 
queued notification from reactivating a closed consumer.
   - Add shared HA and Alert lifecycle regression tests and document 
selector-value compatibility.
   
   ## Verify this pull request
   
   Executed on JDK 11 against dev `9839c418c1a6d7f2a8c3395552edcd99c2de1b37`:
   
   ```bash
   mvn -B -pl 
dolphinscheduler-alert/dolphinscheduler-alert-server,dolphinscheduler-master 
-am -Dtest=AbstractHAServerTest,AlertServerHATest 
-Dsurefire.failIfNoSpecifiedTests=false -Djacoco.skip=true -Drat.skip=true 
-Dcheckstyle.skip -Dos.detected.classifier=osx-x86_64 spotless:apply test
   mvn -B -pl 
dolphinscheduler-registry/dolphinscheduler-registry-api,dolphinscheduler-alert/dolphinscheduler-alert-server,dolphinscheduler-master
 spotless:check
   ```
   
   A local settings file selected Maven Central. The classifier override uses 
the available x86_64 protoc binary via Rosetta on Apple Silicon; no 
dependencies were changed. The full local invocation is recorded in the 
verification receipt.
   
   - Final build: 132-module reactor completed successfully, including Java 
production/test compilation; 16 shared HA tests and two Alert lifecycle cases 
passed. Other modules' complete test suites were not run by this focused 
command.
   - Baseline: before adding terminal-close cases, 13 shared tests against the 
original HA source produced 11 assertion failures and two passing controls, 
including failure of the startup/REMOVE ordering assertion.
   - Independent final Spotless checks and `git diff --check` passed. No 
Checkstyle, RAT or coverage result is claimed from the recorded skip flags.
   - Real-backend retained-predecessor comparison: etcd 3.5.21, ZooKeeper 
3.8.3, JDBC/MySQL 8.0.46 and JDBC/PostgreSQL 16.0. All eight original/final 
cases passed: original ACTIVE without owning the selector, fixed STAND_BY, with 
backend owner/revision or row metadata unchanged. Both JDBC backends 
additionally passed real removal-event/re-election checks, creating a new 
selector owned by the successor client.
   - These fixtures deliberately retain a predecessor client and seed its 
legacy bare-address selector. They verify common ownership behavior, not 
complete multi-Master deployments or identical downstream consequences. The 
ZooKeeper/etcd probes use mixed cached supporting dependencies; JDBC uses the 
compiled dev classes and native schemas.
   - Separate ZooKeeper/etcd close-from-watch probes passed ephemeral cleanup 
checks.
   - The repository wrapper also passed root plus all three changed Java 
modules: `./mvnw -B -pl 
.,dolphinscheduler-registry/dolphinscheduler-registry-api,dolphinscheduler-alert/dolphinscheduler-alert-server,dolphinscheduler-master
 spotless:apply spotless:check` (using the same local Maven Central settings).
   - Independent source review found no remaining blocking findings. Human 
review and upstream CI remain pending.
   
   ## Compatibility and limits
   
   Custom `AbstractHAServer` subclasses overriding `close()` must delegate to 
`super.close()` to preserve terminal shutdown. Alert shutdown now closes its 
Registry resources, including when heartbeat shutdown fails.
   
   Selector values become opaque instance identities rather than bare 
addresses. Registry paths and SPI are unchanged. External scripts parsing 
addresses must be adjusted. Unpatched peers in a mixed-version cluster retain 
their defects. This is not a distributed fencing mechanism and does not 
guarantee zero overlap during delayed watches or interrupted connectivity.
   
   ## 中文摘要
   
   在共享 HA 
层区分每次启动的协调器身份,防止新进程继承旧临时节点;收到删除通知后根据当前所有权更新角色,并把选举与本地状态应用按顺序处理。补充通用回归测试与 Alert 
关闭测试。真实 etcd、ZK、JDBC(MySQL/PostgreSQL)的原版/补丁对照均确认共同的旧身份误认已被阻止;这不代表每种后端都复现了完整双 
Master 后果。现有 etcd 删除事件 PR 保持独立;本补丁未部署生产。
   
   ## Pull Request Notice
   
   [Pull Request 
Notice](https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md)
   


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