Userwhite opened a new pull request, #66889:
URL: https://github.com/apache/doris/pull/66889
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Incremental View Maintenance (IVM) needs a stable per-row identity for every
row in the base table. For MOW/unique tables this can be derived from the
unique key, but a detail (DUP_KEYS) table has no stable unique key — two rows
can be byte-identical, and the commit TSO alone is not row-unique within one
commit.
Row Binlog already allocates a monotonic LSN per row so that binlog rows can
be ordered/deduplicated. This PR surfaces that same LSN as a first-class hidden
column on the DUP base table, and makes Stream return the LSN alongside the
existing sequence (TSO) column, so IVM has a stable (TSO, LSN) identity for
every base row.
Scope (intentional):
- Only the DUP base index with row-binlog enabled gets the base
__DORIS_ROW_LSN_COL__ column.
- MOW does not expose or store a base LSN column (a MOW row already has a
stable unique key; adding an aggregated per-row LSN there is meaningless and
would complicate merge semantics). MOW still uses the LSN internally for the
row-binlog side-channel.
- Rollup / MV indexes are not covered; only the base index stores the row
LSN.
Design overview:
<img width="2860" height="2480" alt="image"
src="https://github.com/user-attachments/assets/889af47f-a495-441c-8d47-29eb23fcb0e9"
/>
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] 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 <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]