-
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
Updates forceCommit APIs to handle Pauseless #14828
Updates forceCommit APIs to handle Pauseless #14828
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14828 +/- ##
============================================
+ Coverage 61.75% 63.75% +2.00%
- Complexity 207 1469 +1262
============================================
Files 2436 2708 +272
Lines 133233 151438 +18205
Branches 20636 23381 +2745
============================================
+ Hits 82274 96549 +14275
- Misses 44911 47645 +2734
- Partials 6048 7244 +1196
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Mostly good. Good job!
jobMetadata.put(CommonConstants.ControllerJob.CONSUMING_SEGMENTS_YET_TO_BE_COMMITTED_LIST, | ||
JsonUtils.objectToString(consumingSegmentsCommitted)); |
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.
(minor) This shouldn't be needed. Adding it will actually add overhead for one extra parsing
if (segmentZKMetadata == null) { | ||
continue; | ||
} | ||
if (!segmentZKMetadata.getStatus().isCompleted()) { |
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.
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.
isCompleted should return true only when the stratus is Uploaded or Done. Raising a PR along with few minor improvement wrt pauseless,
SegmentZKMetadata segmentZKMetadata = | ||
_helixResourceManager.getSegmentZKMetadata(tableNameWithType, segmentName); | ||
if (segmentZKMetadata == null) { | ||
continue; |
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.
(minor) Add some comment about this behavior. We are counting deleted segment as not need to be committed
Map<String, String> controllerJobZKMetadata) { | ||
addControllerJobToZK(forceCommitJobId, | ||
controllerJobZKMetadata, ControllerJobType.FORCE_COMMIT, prevJobMetadata -> { | ||
String existingSegmentsYetToBeCommittedString = |
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.
Please add some comments describing why we want to perform this check
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.
Actually this method is only useful for a rare edge case when two async forceCommitStatus APIs are running.
But we can remove this as it will save overhead for one extra parsing on each API call.
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.
have removed this method
@@ -462,6 +467,19 @@ public boolean isForceCommitJobCompleted(String forceCommitJobId) | |||
|
|||
assertEquals(jobStatus.get("jobId").asText(), forceCommitJobId); | |||
assertEquals(jobStatus.get("jobType").asText(), "FORCE_COMMIT"); | |||
|
|||
assert jobStatus.get("segmentsForceCommitted") != null; |
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.
use CommonConstants variable rather than hardcode
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 with minor comments
when(mockSegmentZKMetadataUploaded.getStatus()).thenReturn(Status.UPLOADED); | ||
|
||
SegmentZKMetadata mockSegmentZKMetadataInProgress = mock(SegmentZKMetadata.class); | ||
when(mockSegmentZKMetadataInProgress.getStatus()).thenReturn(Status.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.
also add one for Status.COMMITTING
segmentsToCheck = consumingSegmentCommitted; | ||
} | ||
|
||
Set<String> segmentsYetToBeCommitted = |
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.
@noob-se7en iiuc the objective of introducing this field is to reduce the number of segmentZKMetadata that we will be iterating over.
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.
Does it server any other purpose ?
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, Just to reduce the ZK calls only.
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
Updates forceCommit APIs to handle Pauseless Ingestion.
(In Pauseless Ingestion, The segment is marked as ONLINE in the ideal state before the commit has completed successfully. Hence the check needs to be updated from ideal state to ZK metadata which is the correct indicator)