-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ideal state as source of truth for segment existence #9735
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9735 +/- ##
============================================
- Coverage 70.04% 68.43% -1.62%
- Complexity 4907 4972 +65
============================================
Files 1951 1951
Lines 104512 104515 +3
Branches 15824 15827 +3
============================================
- Hits 73210 71525 -1685
- Misses 26175 27892 +1717
+ Partials 5127 5098 -29
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
3bb60f6
to
67fb19e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm one question
@@ -730,22 +730,29 @@ public String getActualTableName(String tableName) { | |||
*/ | |||
|
|||
/** | |||
* Returns the segments for the given table. | |||
* Returns the segments for the given table from the ideal state. | |||
* | |||
* @param tableNameWithType Table name with type suffix | |||
* @param shouldExcludeReplacedSegments whether to return the list of segments that doesn't contain replaced segments. | |||
* @return List of segment names | |||
*/ | |||
public List<String> getSegmentsFor(String tableNameWithType, boolean shouldExcludeReplacedSegments) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSegmentsFor
is originally also used in SegmentRelocator
and RetentionManager
are those 2 usage both IS as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Checked all the usage of them and moved the ones to clean up the orphan segments (e.g. when deleting the table or all segments) to use getSegmentsFromPropertyStore()
When deleting a segment, we delete the segment from ideal state synchronously, then use a separate thread to delete the segment from property store and deep store asynchronously. This could cause inconsistency between ideal state and segments in the property store, and we should always use ideal state as the source of truth for the segments because that is what Helix is following. The segment ZK metadata from the property store can be used to track the orphan segments that are not cleaned up property.