wcmolin opened a new issue, #18197: URL: https://github.com/apache/dolphinscheduler/issues/18197
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3oissue) and found no similar issues. ### What happened In `FailoverCoordinator.doMasterFailover()`, the lock path used by `getLock` and `releaseLock` is inconsistent: ```java // getLock uses a per-master-address lock path registryClient.getLock(RegistryUtils.getMasterFailoverLockPath(masterAddress)); try { // ... failover logic } finally { // releaseLock uses the global enum path, which differs from getLock registryClient.releaseLock(RegistryNodeType.MASTER_FAILOVER_LOCK.getRegistryPath()); } ``` ### What you expected to happen `getLock` and `releaseLock` should use the same lock path to ensure the lock is properly acquired and released. ### Root cause This issue was introduced by PR #16953 (commit `b6b04617`). That PR changed `getLock` from the global lock path `RegistryNodeType.MASTER_FAILOVER_LOCK.getRegistryPath()` to a per-master-address fine-grained lock path `RegistryUtils.getMasterFailoverLockPath(masterAddress)`, but missed updating the corresponding `releaseLock` call in the `finally` block. ### Suggested fix Extract the lock path into a local variable to ensure `getLock` and `releaseLock` use the same path: ```java final String masterFailoverLockPath = RegistryUtils.getMasterFailoverLockPath(masterAddress); registryClient.getLock(masterFailoverLockPath); try { // ... failover logic } finally { registryClient.releaseLock(masterFailoverLockPath); } ``` ### How to reproduce Triggered when a Master node undergoes failover. ### Version 3.4.1-release / dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct). -- 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]
