waterWang opened a new pull request, #2529: URL: https://github.com/apache/shardingsphere-elasticjob/pull/2529
Fixes #2528 ## Problem `JobStatisticsAPIImpl.isAllDisabled()`, `JobStatisticsAPIImpl.getJobStatusByJobNameAndIp()`, and `ServerStatisticsAPIImpl.getAllServersBriefInfo()` read server status via `regCenter.get()`, which returns data from CuratorCache. After `JobOperateAPI.disable()` or `JobOperateAPI.enable()` writes the new value to ZooKeeper, the cache refresh is asynchronous — there is a window where the cached value is still the old one. For example, after a server node changes from `ENABLED` to `DISABLED`: - `JobStatisticsAPI.getJobsBriefInfo(ip)` can still return `OK` - `JobStatisticsAPI.getJobBriefInfo(jobName)` can fail to report that all servers are disabled - `ServerStatisticsAPI.getAllServersBriefInfo()` can undercount `disabledJobsNum` ## Fix Use `regCenter.getDirectly()` instead of `regCenter.get()` for server status reads in the three methods above. `getDirectly()` always reads the authoritative value from ZooKeeper, bypassing the local cache. ## Scope Only server status values under `/<jobName>/servers/<serverIp>`. Sharding assignment consistency and instance traversal races are not affected. ## Testing Updated existing unit tests to mock `getDirectly()` instead of `get()` for server status paths — the tests verify the same behavior (DISABLED → DISABLED, mixed → OK, per-IP → DISABLED) against the authoritative read path. -- 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]
