Skip to content

Fix concurrent access during TierManager folder reset#18223

Merged
jt2594838 merged 2 commits into
masterfrom
fix_tiermanager
Jul 16, 2026
Merged

Fix concurrent access during TierManager folder reset#18223
jt2594838 merged 2 commits into
masterfrom
fix_tiermanager

Conversation

@jt2594838

@jt2594838 jt2594838 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

  • build replacement tier folder-manager lists and directory-to-tier maps locally before publishing them
  • publish initialized list and map references with volatile visibility instead of clearing live collections
  • add a concurrent regression test covering sequence, unsequence, object, COPY TO, folder-manager, tier-count, folder-list, and file-tier accessors

Tests

  • mvn test -pl iotdb-core/datanode -Dtest=TierManagerTest
  • mvn test -pl iotdb-core/datanode -Dtest=IoTDBSnapshotTest
  • mvn compile -pl iotdb-core/datanode -DskipTests

List<FolderManager> newSeqTiers = new ArrayList<>();
List<FolderManager> newUnSeqTiers = new ArrayList<>();
List<FolderManager> newObjectTiers = new ArrayList<>();
seqDir2TierLevel.clear();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1] Build and publish the directory maps with the tier lists seqDir2TierLevel and unSeqDir2TierLevel are still cleared and repopulated in place while their readers are unsynchronized. During loadHotModifiedProps(), readers such as getAllFilesFolders() can observe an empty or partial map, while getFileTierLevel() can race with HashMap mutation and throw ConcurrentModificationException. Please build replacement maps locally and publish them together with the folder-manager lists, and cover these accessors in the regression test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Included these maps in initFolders.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.75%. Comparing base (f1875ed) to head (3af496a).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18223      +/-   ##
============================================
+ Coverage     42.40%   42.75%   +0.34%     
  Complexity      343      343              
============================================
  Files          5354     5356       +2     
  Lines        379174   380160     +986     
  Branches      49149    49317     +168     
============================================
+ Hits         160803   162536    +1733     
+ Misses       218371   217624     -747     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

@jt2594838
jt2594838 merged commit 9b77b54 into master Jul 16, 2026
44 of 47 checks passed
@jt2594838
jt2594838 deleted the fix_tiermanager branch July 16, 2026 09:02
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.

3 participants