Skip to content

Grace pauseless COMMITTING/committed real-time segments in SegmentStatusChecker - #19094

Open
swaminathanmanish wants to merge 1 commit into
apache:masterfrom
swaminathanmanish:fix/segment-status-checker-pauseless-committing-grace
Open

Grace pauseless COMMITTING/committed real-time segments in SegmentStatusChecker#19094
swaminathanmanish wants to merge 1 commit into
apache:masterfrom
swaminathanmanish:fix/segment-status-checker-pauseless-committing-grace

Conversation

@swaminathanmanish

Copy link
Copy Markdown
Contributor

Problem

SegmentStatusChecker computes percentOfReplicas (which drives the SegmentReplicasCriticallyLowForHATable alert) as a min across segments of replicasUpInEV / replicasInIS. It skips just-created/pushed segments for a grace window (controller.statuschecker.waitForPushTimePeriod) so servers have time to load them. The grace timestamp was derived as:

long creationTimeMs = segmentZKMetadata.getStatus() == Status.IN_PROGRESS
    ? segmentZKMetadata.getCreationTime()
    : segmentZKMetadata.getPushTime();

Real-time (LLC) committed segments never populate push time (it stays Long.MIN_VALUE), so a just-committed real-time segment is never graced — it is included in the replica check the moment it commits, while its replicas are still loading.

Pauseless ingestion makes this a frequent false positive. A pauseless segment enters the COMMITTING status ("done consuming, immutable segment not yet committed") and its replicas rebuild/reload the immutable segment for the build window (tens of seconds to a few minutes). During that window it is transiently under-replicated in the ExternalView, but COMMITTING was treated as non-IN_PROGRESS and checked immediately. Because the gauge is a min across segments, one just-committed segment drags the table's percentOfReplicas down and fires the alert even though the table is fully redundant. High-ingest tables (a segment sealing every few minutes per partition) page repeatedly.

Fix

Key the grace window on a timestamp that is actually populated for these segments:

  • IN_PROGRESS and COMMITTING → creation time
  • committed/pushed → push time when set, else fall back to creation time (covers LLC committed DONE segments)

The existing waitForPushTime window is reused (no new config). Once a segment is older than the window and still under-replicated, it is checked normally — so genuinely stuck commits and real replica losses still alert.

Tests

Added to SegmentStatusCheckerTest:

  • realtimeCommittingSegmentWithinGraceNotUnderReplicated — a COMMITTING segment at 1/3 replicas ONLINE, just created, within the grace window → percentOfReplicas stays 100, segmentsWithLessReplicas = 0 (the false-alert case is now graced).
  • realtimeCommittingSegmentBeyondGraceUnderReplicated — same segment created 2h ago (past the grace) → percentOfReplicas drops to 33 and segmentsWithLessReplicas = 1 (a stuck commit is still flagged).

Existing SegmentStatusCheckerTest cases pass unchanged (the change is behavior-preserving for them).

Release Notes

Fixes false SegmentReplicasCriticallyLowForHATable / low percentOfReplicas alerts caused by real-time committed and pauseless COMMITTING segments being counted as under-replicated during their normal post-commit load window.

…tStatusChecker

SegmentStatusChecker skips just-created/pushed segments from the replica-availability
check for a grace window (waitForPushTime). The grace timestamp was derived as:
IN_PROGRESS -> creation time, everything else -> push time. Real-time (LLC) committed
segments never populate push time (it stays Long.MIN_VALUE), so a just-committed
segment was never graced. Pauseless ingestion makes this worse: a segment enters
COMMITTING (done consuming, immutable segment still being built/loaded on the
replicas) and is transiently under-replicated for the build window, yet COMMITTING
was treated as non-IN_PROGRESS and checked immediately.

This produces false percentOfReplicas dips (SegmentReplicasCriticallyLowForHATable)
for high-ingest pauseless tables even though the table is fully redundant.

Fix: grace the transient window by keying on a populated timestamp:
- IN_PROGRESS and COMMITTING -> creation time
- committed/pushed -> push time when set, else fall back to creation time

The existing waitForPushTime window is reused; once a segment is older than it and
still under-replicated it is checked normally, so genuinely stuck commits and real
replica losses still alert.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@swaminathanmanish
swaminathanmanish requested a review from 9aman July 27, 2026 09:09
@codecov-commenter

codecov-commenter commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.52%. Comparing base (81b82b2) to head (5d07125).

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19094      +/-   ##
============================================
+ Coverage     65.50%   65.52%   +0.02%     
  Complexity     1421     1421              
============================================
  Files          3430     3430              
  Lines        218000   218003       +3     
  Branches      34642    34643       +1     
============================================
+ Hits         142799   142856      +57     
+ Misses        63641    63594      -47     
+ Partials      11560    11553       -7     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-25 65.52% <100.00%> (+0.02%) ⬆️
temurin 65.52% <100.00%> (+0.02%) ⬆️
unittests 65.52% <100.00%> (+0.02%) ⬆️
unittests1 56.82% <ø> (+0.01%) ⬆️
unittests2 37.88% <100.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

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.

2 participants