Sean-Walker0 opened a new pull request, #7326: URL: https://github.com/apache/shenyu/pull/7326
<!-- Describe your PR here; e.g. Fixes #issueNo --> Found by code audit (no existing issue — happy to file one if maintainers prefer). `CuratorCacheListener`'s contract (Curator 5.x, the version this build uses): for `NODE_DELETED` the **new** `ChildData` is null and the deleted node is delivered in `oldData`. `ZookeeperInstanceRegisterRepository#watchInstances` guards `if (!Objects.nonNull(data) || !Objects.nonNull(data.getData())) return;` *before* the `switch (type)` — so every delete event returns early, the `case NODE_DELETED:` branch is unreachable dead code, and instance-removal events are never surfaced as `Event.DELETED`. Admin's discovery (which registers this listener through `DefaultDiscoveryProcessor`) keeps stale upstreams for Zookeeper-registered services until a full resync. The sibling `EtcdInstanceRegisterRepository` handles its DELETE from the event's key/value — the pattern this change applies for Zookeeper. <!-- Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request. --> Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw test -pl shenyu-registry/shenyu-registry-zookeeper -am and ./mvnw checkstyle:check -pl shenyu-registry/shenyu-registry-zookeeper` (module-scoped; full build left to CI). ### Modifications - In the watcher lambda, select `oldData` as the changed node when `type == NODE_DELETED` and `data` otherwise, then apply the existing null guards and downstream logic (path/data/stat/ephemeral check/switch) to that node. No other behavior changes. ### Verifying this change - New `testWatchInstancesEmitsDeletedEventForEphemeralNode` captures the registered `CuratorCacheListener` and fires `event(NODE_DELETED, oldChildData, null)` for an ephemeral node; it asserts `Event.DELETED` reaches the `ChangedEventListener`. It fails on current master with *"Wanted but not invoked … zero interactions"* and passes with this change. - Full `shenyu-registry-zookeeper` module suite green; checkstyle green. ### Notes - Behavior change: Zookeeper instance deletion now propagates as `Event.DELETED` (previously silently ignored) — admin discovery can drop offline upstreams instead of retaining them. - Orthogonal to open PRs: no open PR touches `ZookeeperInstanceRegisterRepository` or `shenyu-infra-zookeeper`'s `ZookeeperClient`. -- 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]
