Skip to content

Comments

[server] Fix TableChangeWatcher missing CreateTableEvent due to CuratorCache async getData race#2710

Open
swuferhong wants to merge 1 commit intoapache:mainfrom
swuferhong:create-table-race-fix
Open

[server] Fix TableChangeWatcher missing CreateTableEvent due to CuratorCache async getData race#2710
swuferhong wants to merge 1 commit intoapache:mainfrom
swuferhong:create-table-race-fix

Conversation

@swuferhong
Copy link
Contributor

@swuferhong swuferhong commented Feb 24, 2026

Purpose

Linked issue: close #1018

When MetadataManager.createTable() creates a table node empty (via
creatingParentsIfNeeded) and immediately calls setData with real data,
CuratorCache's internal async getData() for the NodeCreated event may
read the post-setData state. This causes NODE_CREATED to carry full
data (version>0) while the subsequent NODE_CHANGED is suppressed
(same version already cached), resulting
in a lost CreateTableEvent.

Previously, processCreateTable was only called in the NODE_CHANGED
branch. This fix adds table path handling in the NODE_CREATED branch:
when NODE_CREATED fires with non-empty table data, processCreateTable
is called as a fallback, ensuring CreateTableEvent is always produced
regardless of whether NODE_CHANGED fires.

This also fixes the case where CuratorCache initial sync reports
existing table nodes as NODE_CREATED with full data.

  • Add table path + non-empty data check in NODE_CREATED branch
  • Add CuratorCacheRaceConditionTest to prove the race condition exists
  • Add testTableCreationDetectedViaNodeCreatedEvent to verify the fix

Brief change log

Tests

API and Format

Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableChangeWatcherTest.testTableChanges is not stable

1 participant