Skip to content

Add new configuration for refreshed segment expiration time in instance selectors#16401

Closed
abhishekbafna wants to merge 1 commit intoapache:masterfrom
abhishekbafna:broker/new_segment_expiration_config
Closed

Add new configuration for refreshed segment expiration time in instance selectors#16401
abhishekbafna wants to merge 1 commit intoapache:masterfrom
abhishekbafna:broker/new_segment_expiration_config

Conversation

@abhishekbafna
Copy link
Copy Markdown
Collaborator

This pull request introduces support for a new configuration to handle expiration times for "refreshed" segments in the Pinot broker's instance selector logic. The changes primarily involve adding a new parameter for refreshed segment expiration and updating the related logic, constructors, and tests.

Note: New unit tests are pending.

label: configuration

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 22, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.33%. Comparing base (1a476de) to head (02cf4aa).
⚠️ Report is 1707 commits behind head on master.

Files with missing lines Patch % Lines
...routing/instanceselector/BaseInstanceSelector.java 71.42% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #16401      +/-   ##
============================================
+ Coverage     62.90%   63.33%   +0.42%     
+ Complexity     1386     1364      -22     
============================================
  Files          2867     2984     +117     
  Lines        163354   173297    +9943     
  Branches      24952    26561    +1609     
============================================
+ Hits         102755   109752    +6997     
- Misses        52847    55159    +2312     
- Partials       7752     8386     +634     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.31% <80.00%> (+0.44%) ⬆️
java-21 63.29% <80.00%> (+0.47%) ⬆️
skip-bytebuffers-false ?
skip-bytebuffers-true ?
temurin 63.33% <80.00%> (+0.42%) ⬆️
unittests 63.32% <80.00%> (+0.42%) ⬆️
unittests1 56.46% <100.00%> (+0.64%) ⬆️
unittests2 33.30% <80.00%> (-0.27%) ⬇️

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.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

SegmentZKMetadata segmentZKMetadata = new SegmentZKMetadata(record);
long creationTimeMs = SegmentUtils.getSegmentCreationTimeMs(segmentZKMetadata);
if (InstanceSelector.isNewSegment(creationTimeMs, currentTimeMs, _newSegmentExpirationTimeInSeconds * 1000)) {
long segmentExpirationTimeInSec = segmentZKMetadata.getSegmentName().startsWith("refreshed__")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This logic is not general. Let's discuss a general way to handle this

public BalancedInstanceSelector(String tableNameWithType, ZkHelixPropertyStore<ZNRecord> propertyStore,
BrokerMetrics brokerMetrics, @Nullable AdaptiveServerSelector adaptiveServerSelector, Clock clock,
boolean useFixedReplica, long newSegmentExpirationTimeInSeconds) {
boolean useFixedReplica, long newSegmentExpirationTimeInSeconds,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can probably revisit the default new segment expiration time. 5 minutes is probably too short

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants