Skip to content

Conversation

@noob-se7en
Copy link
Contributor

Problem
Before this PR: #17089, When latest stream offset is null, Freshness checker will skip and not cause server to run in bad state. The PR caused a behaviour change.

Solution
Maintain the behaviour previous of PR: #17089 (Allow freshness checker to run if latestStream offset fetch fails.)

@xiangfu0 xiangfu0 requested review from Copilot and xiangfu0 January 23, 2026 12:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restores the previous behavior where freshness checking continues even when fetching the latest stream offset fails. Before PR #17089, a null latest stream offset would not cause the server to enter a bad state. This change catches exceptions during offset fetching and allows freshness checks to proceed using other criteria (like idle timeout).

Changes:

  • Added exception handling when fetching latest stream offset to prevent failures from blocking freshness checks
  • Added @Nullable annotations to isOffsetCaughtUp parameters to explicitly handle null offsets
  • Added comprehensive test coverage for TimeoutException scenario during offset fetching

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
FreshnessBasedConsumptionStatusChecker.java Wraps offset fetching in try-catch to handle failures gracefully and continue with other freshness checks
IngestionBasedConsumptionStatusChecker.java Adds @Nullable annotations to offset parameters to indicate they can be null
FreshnessBasedConsumptionStatusCheckerTest.java Adds test verifying behavior when TimeoutException occurs during offset fetching

realtimeTableDataManager.getStreamMetadataProvider(rtSegmentDataManager);
latestStreamOffset =
RealtimeSegmentMetadataUtils.fetchLatestStreamOffset(rtSegmentDataManager, streamMetadataProvider);
} catch (Exception e) {
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

Catching generic Exception is too broad. Consider catching specific exceptions like TimeoutException that are expected, and let unexpected exceptions propagate. This prevents masking serious errors while still handling known failure cases.

Suggested change
} catch (Exception e) {
} catch (RuntimeException e) {

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

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

lgtm

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.21%. Comparing base (d54ec21) to head (ea35d97).

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17563      +/-   ##
============================================
+ Coverage     63.18%   63.21%   +0.02%     
  Complexity     1477     1477              
============================================
  Files          3172     3172              
  Lines        189773   189777       +4     
  Branches      29041    29041              
============================================
+ Hits         119913   119964      +51     
+ Misses        60547    60497      -50     
- Partials       9313     9316       +3     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.16% <100.00%> (+0.04%) ⬆️
java-21 63.17% <100.00%> (+0.01%) ⬆️
temurin 63.21% <100.00%> (+0.02%) ⬆️
unittests 63.20% <100.00%> (+0.02%) ⬆️
unittests1 55.53% <ø> (+<0.01%) ⬆️
unittests2 34.06% <100.00%> (+0.02%) ⬆️

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.

@xiangfu0 xiangfu0 merged commit 4c7fd6f into apache:master Jan 23, 2026
18 checks passed
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.

4 participants