-
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
Add revertSegmentReplacement API #7662
Add revertSegmentReplacement API #7662
Conversation
d1d8d41
to
4e68a6e
Compare
4e68a6e
to
07750bb
Compare
Codecov Report
@@ Coverage Diff @@
## master #7662 +/- ##
============================================
- Coverage 71.67% 71.52% -0.16%
- Complexity 3996 4037 +41
============================================
Files 1576 1578 +2
Lines 80037 80363 +326
Branches 11865 11942 +77
============================================
+ Hits 57366 57479 +113
- Misses 18805 19003 +198
- Partials 3866 3881 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
...ava/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
Outdated
Show resolved
Hide resolved
segmentLineageEntryId)); | ||
|
||
// Revert is not allowed if the state is not 'COMPLETED' | ||
if (lineageEntry.getState() != LineageEntryState.COMPLETED) { |
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.
What if the lineage entry is currently in IN_PROGRESS
state, let's say a batch of segment upload is interrupted? Are we still able to mark it to REVERTED
?
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.
+1. We should allow explicitly revert IN_PROGRESS
lineage (add a flag is fine) in case user knows the the segment upload is already interrupted
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.
good point. I added forceRevert
flag so that the user can explicitly revert the lineage entry even if it's IN_PROGRESS
.
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.
Should also modify startReplaceSegments
and ignore the segmentsFrom
check for REVERTED
lineage. User'll likely start another segment replace with the same source segments.
Do we need to modify the broker routing logic? Can we add a test to verify the broker behavior on REVERTED
lineage?
...troller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
segmentLineageEntryId)); | ||
|
||
// Revert is not allowed if the state is not 'COMPLETED' | ||
if (lineageEntry.getState() != LineageEntryState.COMPLETED) { |
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.
+1. We should allow explicitly revert IN_PROGRESS
lineage (add a flag is fine) in case user knows the the segment upload is already interrupted
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
f0aa01e
to
3508902
Compare
...ava/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
Outdated
Show resolved
Hide resolved
...ava/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Show resolved
Hide resolved
When all the segmentsFrom are 'ONLINE' state, this new API allows to revert the segment replacement and use the original segments when routing the query. This will be useful when the bad data gets pushed and wants to go back to the previous state quickly.
3508902
to
3e70968
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. Thanks for working on it!
if (lineageEntry.getState() != LineageEntryState.COMPLETED) { | ||
// We do not allow to revert the lineage entry with 'REVERTED' state. For 'IN_PROGRESS", we only allow to | ||
// revert when 'forceRevert' is set to true. | ||
if (lineageEntry.getState() != LineageEntryState.IN_PROGRESS || !forceRevert) { |
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.
Nit: this line can be merged with L2944
?
if (lineageEntry.getState() != LineageEntryState.IN_PROGRESS || !forceRevert) { | |
if (lineageEntry.getState() == LineageEntryState.REVERTED || (lineageEntry.getState() == LineageEntryState.IN_PROGRESS && !forceRevert)) { |
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.
oops, I missed your review and I already checked in. I will address this when I file the follow-up PR for proactive deletion.
// routing table because it is possible that there has been no EV change but the routing result may be | ||
// different after updating the lineage entry. | ||
sendRoutingTableRebuildMessage(tableNameWithType); | ||
return true; |
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.
Once the lineage is updated successfully, are we planning to proactively invoke the segment deletion? It will help the case that segmentsTo
take a lot of disk spaces and will block segment uploading until retention manager cleans it up.
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.
Correct. I will file the follow-up PRs for proactive segment delete.
When all the segmentsFrom are 'ONLINE' state, this new API allows
to revert the segment replacement and use the original segments
when routing the query. This will be useful when the bad data
gets pushed and wants to go back to the previous state quickly.