You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "xiangfu0 (via GitHub)" <gi...@apache.org> on 2026/07/10 21:41:26 UTC
[PR] Report NOT_CALCULATED for uncomputable consuming-segment lag (#18836) [pinot]
xiangfu0 opened a new pull request, #18971:
URL: https://github.com/apache/pinot/pull/18971
## Problem
Fixes #18836.
The controller's *"View consuming segments info"* panel column **"Max Partition Availability Lag (ms)"** (and the `MAX_RECORD_AVAILABILITY_LAG_MS` metric) showed a huge, nonsensical value — essentially the current Unix time in ms (~`1.7e12`) — whenever a record's upstream ingestion timestamp was unavailable.
The availability lag is computed on the server as:
```java
availabilityLag = lastProcessedTimeMs - recordIngestionTimeMs;
```
The guard only checked `lastProcessedTimeMs > 0`; it never validated `recordIngestionTimeMs`. When a record carries no valid timestamp — Kafka `NO_TIMESTAMP` (`-1`), the unset `StreamMessageMetadata` builder default (`Long.MIN_VALUE`), or `0` — the subtraction produces an epoch-sized (or overflowed) number that is a valid `Long`, so it sails past the controller's `NumberFormatException` skip and the UI's `Number(av) > -1` filter and gets displayed as the "lag".
## Fix
In all three concrete `StreamMetadataProvider.getCurrentPartitionLagState` implementations (`pinot-kafka-3.0`, `pinot-kafka-4.0`, `pinot-kinesis`):
- Guard the availability-lag computation on `getRecordIngestionTimeMs() > 0`, so an invalid/unset ingestion time reports the SPI-defined `PartitionLagState.NOT_CALCULATED` sentinel instead of a bogus number.
- Replace the previously hard-coded `"UNKNOWN"` fallback (for **both** offset lag and availability lag) with `PartitionLagState.NOT_CALCULATED`, to align the plugins with the SPI's own default sentinel and let `RealtimeConsumerMonitor` use its fast-path skip instead of catching a `NumberFormatException`.
## Backward compatibility
The observable fallback string in the `/consumingSegmentsInfo` REST maps changes from `"UNKNOWN"` to `"NOT_CALCULATED"`. All in-tree consumers already treat both identically:
- `RealtimeConsumerMonitor` skips `NOT_CALCULATED` and try/catches `Long.parseLong` for anything else.
- The UI's `Number(lag)` yields `NaN` for both and filters it out.
External dashboards that scrape the literal string `"UNKNOWN"` from this endpoint should be updated to expect `"NOT_CALCULATED"`.
## Testing
Added a regression test per module (`KafkaStreamMetadataProviderTest` ×2, `KinesisStreamMetadataProviderTest`) covering:
- a valid ingestion time → numeric availability lag,
- unset (`Long.MIN_VALUE`), `NO_TIMESTAMP` (`-1`), and `0` ingestion times → `NOT_CALCULATED`,
- the Kafka offset-lag fallback (unknown upstream offset) → `NOT_CALCULATED`.
Each test fails on the pre-fix code (it produces the bogus value) and passes after the fix. `spotless`, `checkstyle`, and `license` checks pass on all three modules.
## Notes
Pulsar and the SPI base class have no availability-lag computation, so no sibling implementation is left on the buggy pattern.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Report NOT_CALCULATED for uncomputable consuming-segment lag (#18836) [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #18971:
URL: https://github.com/apache/pinot/pull/18971#issuecomment-4940062828
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/18971?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 56.98%. Comparing base ([`e7b57c0`](https://app.codecov.io/gh/apache/pinot/commit/e7b57c06ec7d1225c6a1489017d31fffe8b1ef32?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`14961b1`](https://app.codecov.io/gh/apache/pinot/commit/14961b13c332b6002f1c00e94ad036d9969eb12a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (e7b57c0) and HEAD (14961b1). Click for more details.
>
> <details><summary>HEAD has 16 uploads less than BASE</summary>
>
>| Flag | BASE (e7b57c0) | HEAD (14961b1) |
>|------|------|------|
>|java-21|5|1|
>|unittests|2|1|
>|temurin|5|1|
>|unittests2|1|0|
>|integration|3|0|
>|integration1|1|0|
>|custom-integration1|1|0|
>|integration2|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #18971 +/- ##
============================================
- Coverage 64.98% 56.98% -8.00%
+ Complexity 1398 1 -1397
============================================
Files 3399 2605 -794
Lines 212770 153822 -58948
Branches 33558 25094 -8464
============================================
- Hits 138274 87661 -50613
+ Misses 63363 58688 -4675
+ Partials 11133 7473 -3660
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-21](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.98% <ø> (-8.00%)` | :arrow_down: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.98% <ø> (-8.00%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.98% <ø> (-8.00%)` | :arrow_down: |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.98% <ø> (+0.01%)` | :arrow_up: |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/18971/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/pinot/pull/18971?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Report NOT_CALCULATED for uncomputable consuming-segment lag (#18836) [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on PR #18971:
URL: https://github.com/apache/pinot/pull/18971#issuecomment-4951852313
Opened the follow-up docs PR: https://github.com/pinot-contrib/pinot-docs/pull/909
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Report NOT_CALCULATED for uncomputable consuming-segment lag (#18836) [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 merged PR #18971:
URL: https://github.com/apache/pinot/pull/18971
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org