JNSimba opened a new pull request, #62269:
URL: https://github.com/apache/doris/pull/62269
### What problem does this PR solve?
Problem Summary:
Add lag calculation for StreamingInsertJob CDC data sources
(MySQL/PostgreSQL) to support monitoring delay visualization on the frontend.
Currently, StreamingInsertJob exposes `CurrentOffset` and `EndOffset` but
has no lag metric. Users cannot easily determine how far behind the CDC
consumer is from the source database, which is essential for monitoring and
alerting.
### How is this PR implemented?
- Add `getLag()` default method to `SourceOffsetProvider` interface
- Implement `getLag()` in `JdbcSourceOffsetProvider` for MySQL and
PostgreSQL:
- MySQL: `lag = now() - ts_sec` (seconds timestamp from binlog offset)
- PostgreSQL: `lag = now() - ts_usec / 1000` (microsecond timestamp from
WAL offset)
- S3: returns empty string (not applicable)
- Add `Lag` column to `InsertJob.SCHEMA` for `SHOW JOBS` / `jobs()` TVF
output
- Fill `Lag` column in `StreamingInsertJob.getTvfInfo()`
The lag value is displayed in seconds as a numeric string (e.g., `"3"` means
3 seconds behind).
### Release note
Add lag column for StreamingInsertJob CDC data sources (MySQL/PostgreSQL).
Lag represents the time delay in seconds between the source database and Doris
consumer.
### Check List (For Author)
- Test
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason
- Behavior changed:
- [x] Yes. Added a new `Lag` column to the `jobs("type"="insert")` TVF
output.
- Does this need documentation?
- [ ] No.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]