Fix parallel segment reload race on IndexLoadingConfig tier; add IndexLoadingConfig.copy() to avoid per-segment ZK fetches#18174
Open
rsrkpatwari1234 wants to merge 11 commits intoapache:masterfrom
Conversation
…xLoadingConfig.copy() to avoid per-segment ZK fetches
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18174 +/- ##
============================================
+ Coverage 63.18% 63.23% +0.05%
Complexity 1616 1616
============================================
Files 3214 3214
Lines 195838 195842 +4
Branches 30251 30251
============================================
+ Hits 123734 123836 +102
+ Misses 62236 62105 -131
- Partials 9868 9901 +33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Requesting review on this. Integration test failure seems unrelated to this PR - |
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.
Problem
When multiple segments were reloaded in parallel (reloadAllSegments / batched reloadSegments), all tasks shared a single
IndexLoadingConfigfrom onefetchIndexLoadingConfig()call. Each reload path callssetSegmentTier(...)(and related updates) on that shared instance, so concurrent tasks could overwrite each other’s tier. With tier overrides in table config, that could apply the wrong preprocessing / loading settings (#18164).Fix
BaseTableDataManager.reloadSegments: Renamed toreloadSegmentDataManagersInParalleland callsfetchIndexLoadingConfig()once per batch, then for each parallel task passindexLoadingConfigTemplate.copy()intoreloadSegment, so every segment gets its own config for tier and other per-segment mutation.IndexLoadingConfig.copy(): New method that builds a newIndexLoadingConfigwith the same instance / table / schema references and tableDataDir, without copying segmentTier (each copy starts clean, like a fresh fetch). This keeps correctness while avoiding N repeated ZK reads (one fetch + N light copies instead of N fetches).Tests
IndexLoadingConfigTest: Asserts copy shares TableConfig / Schema, matches tableDataDir, does not inherit segmentTier from the template, and that tier changes on the copy do not affect the original.Fixes #18164