shiliang opened a new pull request, #70957: URL: https://github.com/apache/doris/pull/70957
### Background Unique Key merge-on-write publish and flexible partial-update alignment probe existing rows through `BaseTablet::lookup_row_key`. That helper scans newer rowsets first, may return `OK` or `KEY_ALREADY_EXISTS` (a physical match with a higher sequence), and is supposed to skip candidates already present in the tablet delete bitmap so callers only act on visible rows. ### What problem does this PR solve? Issue Number: close #70873 Related PR: None PR Type: Bugfix Problem Summary: `lookup_row_key` only consulted the delete bitmap on `OK`. A `KEY_ALREADY_EXISTS` hit against a bitmap-deleted lower-seq row could short-circuit the probe, so a later flexible partial update inherited that deleted sequence and left two visible Unique Key versions (and compaction then dropped aligned column values). This PR also checks the bitmap for `KEY_ALREADY_EXISTS`, clears the leaked sequence value when skipping, and continues searching for a visible row. ### Details - **Frequency:** Concurrent flexible partial updates where an explicit lower sequence is published after a higher-seq row is already visible. - **Root cause:** Visibility guard gated only on `Status::OK`, so deleted `KEY_ALREADY_EXISTS` candidates were returned to publish/alignment. - **Why existing tests missed it:** Existing publish-conflict suites did not cover probing past a bitmap-deleted lower-seq physical row prepared while the key was absent. - **Fix:** Treat `OK` and `KEY_ALREADY_EXISTS` the same for delete-bitmap visibility; clear `encoded_seq_value` when skipping a deleted candidate; continue when the table has a sequence column or the deleted hit was `KEY_ALREADY_EXISTS`. - **Other paths and branches:** Same helper is used by MoW publish and partial-update alignment; non-sequence `OK` + deleted still breaks as before. ### Testing - Added `regression-test/suites/unique_with_mow_p0/flexible/publish/test_flexible_partial_update_deleted_seq_probe.groovy` (A/B/C/D reproducer from #70873, including post-compaction check). - Not executed locally in this environment; relies on CI regression. ### Notes for Reviewers - Start at the visibility guard in `BaseTablet::lookup_row_key` (`be/src/storage/tablet/base_tablet.cpp`). - `encoded_seq_value->clear()` is required because `Segment::lookup_row_key` writes the sequence before this visibility check. ### Release note Flexible partial updates no longer inherit sequence values from bitmap-deleted lower-seq rows during Unique Key lookup. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified: regression case added but not executed locally ### AI Disclosure - Tool: Cursor Agent - Generated: fix, regression test, PR description - Human review: logic matches the intended visibility guard change for #70873 Made with [Cursor](https://cursor.com) -- 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]
