[Fix-18292][Registry] Carry deleted node value in JDBC registry REMOVE event#18296
Merged
Conversation
…E event The JDBC registry built REMOVE events without eventData, so downstream listeners (AbstractClusterSubscribeListener / AbstractHAServer) parsed a null heartbeat, logged "Unknown cluster change event" and dropped the event, leaving stale master/slot state in memory after ephemeral nodes were purged. Thread the deleted node value through onJdbcRegistryDataDeleted so the REMOVE event carries it as eventData, matching the ZooKeeper and Etcd registries.
98bf06e to
7ff0163
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Was this PR generated or assisted by AI?
YES. The root-cause investigation, the fix, and the unit test were produced with AI assistance (Claude Code) and reviewed by me before submitting.
Purpose of the pull request
This pull request fixes #18292.
When ephemeral nodes expire and are purged from the JDBC registry, the resulting
REMOVEevent was built withouteventData. Downstream subscribers rely on it:AbstractClusterSubscribeListener#notifycallsparseServerFromHeartbeat(event.getEventData()); onnullit logs"Unknown cluster change event"and returns beforeonServerRemove(...).AbstractHAServercomparesserverIdentify.equals(event.getEventData()).So the removal is effectively missed: Master instances keep stale registry data in memory (e.g.
MasterSlotManagerreferencing slots that no longer exist), and commands assigned to those slots are never fetched.The ZooKeeper and Etcd registries already populate
eventDataonREMOVEevents — the JDBC registry was the only one dropping it. The deleted value is available (theDELETEchange-event persists the full row and round-trips it through JSON); it simply was not threaded through to the event.Brief change log
JdbcRegistryDataChangeListener#onJdbcRegistryDataDeletednow takes(String key, String value), symmetric withonJdbcRegistryDataChanged/onJdbcRegistryDataAdded.JdbcRegistryServer#onRegistryRowDeletedpassesdata.getDataValue().JdbcRegistryDataChangeListenerAdapter#onJdbcRegistryDataDeletedinjects the value into theREMOVEEventvia.eventData(value).Verify this pull request
This change added tests and can be verified as follows:
JdbcRegistryDataChangeListenerAdapterTest, asserting theREMOVEevent carries the deleted node value aseventData..eventData(value)line makes the test fail (getEventData() expected <value> but was null); with the fix it passes.spotless:checkis clean.Pull Request Notice
Pull Request Notice
This change does not contain an incompatible change (the modified interface is internal to the JDBC registry plugin), so no update to
docs/docs/en/guide/upgrade/incompatible.mdis required.