Skip to content

[Fix-18292][Registry] Carry deleted node value in JDBC registry REMOVE event#18296

Merged
ruanwenjun merged 1 commit into
apache:devfrom
ruanwenjun:dev_wenjun_fix18292
May 26, 2026
Merged

[Fix-18292][Registry] Carry deleted node value in JDBC registry REMOVE event#18296
ruanwenjun merged 1 commit into
apache:devfrom
ruanwenjun:dev_wenjun_fix18292

Conversation

@ruanwenjun
Copy link
Copy Markdown
Member

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 REMOVE event was built without eventData. Downstream subscribers rely on it:

  • AbstractClusterSubscribeListener#notify calls parseServerFromHeartbeat(event.getEventData()); on null it logs "Unknown cluster change event" and returns before onServerRemove(...).
  • AbstractHAServer compares serverIdentify.equals(event.getEventData()).

So the removal is effectively missed: Master instances keep stale registry data in memory (e.g. MasterSlotManager referencing slots that no longer exist), and commands assigned to those slots are never fetched.

The ZooKeeper and Etcd registries already populate eventData on REMOVE events — the JDBC registry was the only one dropping it. The deleted value is available (the DELETE change-event persists the full row and round-trips it through JSON); it simply was not threaded through to the event.

Brief change log

  • JdbcRegistryDataChangeListener#onJdbcRegistryDataDeleted now takes (String key, String value), symmetric with onJdbcRegistryDataChanged / onJdbcRegistryDataAdded.
  • JdbcRegistryServer#onRegistryRowDeleted passes data.getDataValue().
  • JdbcRegistryDataChangeListenerAdapter#onJdbcRegistryDataDeleted injects the value into the REMOVE Event via .eventData(value).

Verify this pull request

This change added tests and can be verified as follows:

  • Added JdbcRegistryDataChangeListenerAdapterTest, asserting the REMOVE event carries the deleted node value as eventData.
  • Verified red-green: removing the .eventData(value) line makes the test fail (getEventData() expected <value> but was null); with the fix it passes. spotless:check is 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.md is required.

@ruanwenjun ruanwenjun requested a review from Gallardot as a code owner May 26, 2026 06:01
@ruanwenjun ruanwenjun added the bug Something isn't working label May 26, 2026
@ruanwenjun ruanwenjun added this to the 3.4.2 milestone May 26, 2026
…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.
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_fix18292 branch from 98bf06e to 7ff0163 Compare May 26, 2026 06:03
Copy link
Copy Markdown
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 60%)

See analysis details on SonarQube Cloud

@ruanwenjun ruanwenjun merged commit e973efa into apache:dev May 26, 2026
121 of 123 checks passed
@ruanwenjun ruanwenjun deleted the dev_wenjun_fix18292 branch May 26, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Master] JDBC registry may miss REMOVE events for expired ephemeral nodes

2 participants