Skip to content

Fix PBTree schema cache release after pre-delete - #17834

Merged
JackieTien97 merged 2 commits into
apache:masterfrom
Caideyipi:fix-pbtree-schema-statistics-flaky-test
Jun 5, 2026
Merged

Fix PBTree schema cache release after pre-delete#17834
JackieTien97 merged 2 commits into
apache:masterfrom
Caideyipi:fix-pbtree-schema-statistics-flaky-test

Conversation

@Caideyipi

@CaideyipiCaideyipi commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make the PBTree test-only forceFlushAndRelease helper wait for outstanding flush/release workers before checking final memory statistics.
  • Keep forcing release after all volatile buffers are flushed so low-cache PBTree statistics only retain the database root when expected.
  • Release skipped pre-deleted measurements in Traverser#getChild so PBTree schema reads do not leak pinned cache entries.

Why the Traverser change matters

This is not only a test fix. In PBTree mode, fetchSchema and fetchSchemaWithoutWildcard set skipPreDeletedSchema=true to hide measurements that are in the pre-delete blacklist. For exact child lookups, store.getChild(...) pins the cached node before Traverser decides to skip it. The old code changed the child to null without unpinning it, leaving that measurement and its ancestors pinned. That can prevent eviction/release under real schema reads after pre-delete operations and inflate PBTree memory usage until the region is cleared.

Tests

  • mvn spotless:apply -pl iotdb-core/datanode
  • git diff --check
  • mvn -pl iotdb-core/datanode -am -Dtest=SchemaStatisticsTest#testMemoryStatistics2 -Dsurefire.failIfNoSpecifiedTests=false -Dspotless.skip=true -Dcheckstyle.skip=true test -DtrimStackTrace=false fails before the target test runs during existing datanode compilation, with unrelated missing generated fill/aggregation symbols such as IFill, IFillFilter, Accumulator, and IoTDBConfig#getModeMapSizeThreshold().

@Caideyipi
Caideyipiforce-pushed the fix-pbtree-schema-statistics-flaky-test branch from 373a3d0 to 48cb670CompareJune 3, 2026 09:35
@CaideyipiCaideyipi changed the title Fix flaky PBTree schema statistics testFix PBTree schema cache release after pre-deleteJun 3, 2026
@JackieTien97
JackieTien97 merged commit d182c87 into apache:masterJun 5, 2026
43 of 45 checks passed
MileaRobertStefan pushed a commit to MileaRobertStefan/iotdb that referenced this pull request Jun 26, 2026
Sign up for freeto 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.

2 participants

@Caideyipi@JackieTien97