Skip to content
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

Return segments in COMMITTING status in the pauseStatus API for pauseless enabled tables #14908

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

9aman
Copy link
Contributor

@9aman 9aman commented Jan 23, 2025

  • The APi /tables/{tableName}/pauseStatus returns the status of the pause operation on a table.
  • The response contains the list of consuming segments.
  • The API relies on the IdealState to get the consuming segments i.e. segments marked CONSUMING in the IdealState.
  • This does not work for pauseless enabled tables as a segment can be marked ONLINE in the IdealState but still can be unconmitted.
  • The PR, for pauseless tables, also checks the SegmentZKMetadata for the latest segment of each partition to find the list of consuming segments.

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 24.24242% with 25 lines in your changes missing coverage. Please review.

Project coverage is 63.72%. Comparing base (59551e4) to head (18501e3).
Report is 1623 commits behind head on master.

Files with missing lines Patch % Lines
...es/PinotControllerPeriodicTaskRestletResource.java 0.00% 13 Missing ⚠️
...r/validation/RealtimeSegmentValidationManager.java 0.00% 10 Missing ⚠️
.../core/realtime/PinotLLCRealtimeSegmentManager.java 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14908      +/-   ##
============================================
+ Coverage     61.75%   63.72%   +1.97%     
- Complexity      207     1472    +1265     
============================================
  Files          2436     2708     +272     
  Lines        133233   151575   +18342     
  Branches      20636    23406    +2770     
============================================
+ Hits          82274    96595   +14321     
- Misses        44911    47719    +2808     
- Partials       6048     7261    +1213     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.70% <24.24%> (+1.99%) ⬆️
java-21 63.62% <24.24%> (+2.00%) ⬆️
skip-bytebuffers-false 63.72% <24.24%> (+1.97%) ⬆️
skip-bytebuffers-true 63.60% <24.24%> (+35.88%) ⬆️
temurin 63.72% <24.24%> (+1.97%) ⬆️
unittests 63.72% <24.24%> (+1.97%) ⬆️
unittests1 56.28% <ø> (+9.39%) ⬆️
unittests2 34.03% <24.24%> (+6.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

// instead of relying solely on the ideal state.
// A segment in COMMITTING state is treated as consuming for pauseStatus.
if (PauselessConsumptionUtils.isPauselessEnabled(getTableConfig(tableNameWithType))) {
getLatestSegmentZKMetadataMap(tableNameWithType).values()
Copy link
Contributor

Choose a reason for hiding this comment

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

should have a null check here

Copy link
Contributor

Choose a reason for hiding this comment

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

also, it is better to simply make change in findConsumingSegments method. That would help others who are using it as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. This function is being called by forceCommit, pause and resume API's.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should have a null check here

The function getLatestSegmentZKMetadataMap returns an empty map.
Have added the check for future proofing,

.filter(segmentZKMetadata -> !consumingSegments.contains(segmentZKMetadata.getSegmentName()))
.filter(segmentZKMetadata -> segmentZKMetadata.getStatus() == Status.COMMITTING)
.map(SegmentZKMetadata::getSegmentName)
.forEach(consumingSegments::add);
Copy link
Contributor

Choose a reason for hiding this comment

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

(minor) probably we should add this check in findConsumingSegments method itself (or override findConsumingSegments).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have addressed this above

@9aman 9aman force-pushed the update_pause_status_API_for_pauseless branch 2 times, most recently from 18501e3 to 16ed5e4 Compare January 24, 2025 13:08
Copy link
Contributor

@KKcorps KKcorps left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -1974,6 +1975,22 @@ private Set<String> findConsumingSegments(IdealState idealState) {
}
}
});
// For pauseless tables, a segment marked ONLINE in the ideal state may not have been committed yet.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we consider adding a new method findCommittingSegments to return the committing segments for pauseless table? I don't want to mix consuming segment and committing segment because this way it can potentially return 2 segments per partition.

Copy link
Contributor Author

@9aman 9aman Jan 25, 2025

Choose a reason for hiding this comment

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

Have addressed this below: #14908 (comment)

// A segment in COMMITTING state is treated as consuming for pauseStatus.
String tableNameWithType = idealState.getResourceName();
if (PauselessConsumptionUtils.isPauselessEnabled(getTableConfig(tableNameWithType))) {
Map<Integer, SegmentZKMetadata> metadataMap = getLatestSegmentZKMetadataMap(tableNameWithType);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work? Committing segment won't be the latest segment in each partition. I think this will never find committing segment, but always IN_PROGRESS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started with an assumption that the user has issued a pause request before the status is checked.
I am not sure whether this assumption is correct.

No new consuming segments will be created for the table when the force commit message is sent as part of the pause table call.
This ensures that the last segment is :

  1. Marked CONSUMING in the IS as the commit protocol has not started.
  2. Marked ONLINE but has status COMMITTING status as the commit protocol has not finished.

I did not want to add a function findCommittingSegments here for two reasons:

  1. Correctness: an older COMMITTING segment that failed to complete commit protocol will also be returned in the pause status and I feel that's wrong indication of the pause status. The user is only concerned with the latest segment's commit status. Previously this status was derived from IS and for pauseless it derived from ZK metadata.
  2. Performance: Fetching ZK metadata for all the segments is an expensive operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants