You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 369f887
Browse filesBrowse the repository at this point in the historyBrowse files
[fix](table stream) Fix multi-segment row-binlog reads for MoW tables (#66338)
### What problem does this PR solve?
Issue Number: close#65901
Related PR: #65418
Problem Summary:
Table Stream queries over ROW binlog could crash or return incorrect
results when a row-binlog rowset contained multiple segments. This
affected both multi-segment rowsets generated by load and non-singleton
overlapping rowsets produced by row-binlog LMax quick merge. Although
the source table may use UNIQUE_KEYS with Merge-on-Write, the scan reads
from its dedicated DUP_KEYS row-binlog tablet; the problem was caused by
inconsistent iterator selection and incorrect ordering and grouping
assumptions.
For a non-overlapping multi-segment rowset, `force_key_ordered_read`
caused `BetaRowsetReader` to build a merge iterator solely because
ordered output was required. The outer `VCollectIterator` could still
select its block-based union path because the rowset was
non-overlapping. This mismatch made the child iterator enter
by-reference mode while its parent called the block interface,
triggering the `!_get_data_by_ref` assertion and aborting the BE.
Non-overlapping segments do not require a merge iterator because an
ordered union already preserves key order.
Row-binlog LMax quick merge introduces another multi-segment layout: it
links segments from multiple rowsets into a non-singleton rowset marked
`OVERLAPPING`. The previous `is_segments_overlapping()` implementation
only recognized singleton delta rowsets, so these quick-merge rowsets
could incorrectly use the union path instead of merging their segments
by key and TSO. The TSO column could also be skipped after zone-map
pruning even though it is required as the merge sequence column.
In addition, MIN_DELTA processing used `IteratorRowRef::is_same` to
identify consecutive events belonging to the same user key. This flag is
a merge/dedup marker and does not reliably mark same-key events that
reside in one segment after quick merge. As a result, one key's change
chain could be split into multiple groups and folded incorrectly.
This change separates ordered-output requirements from iterator
selection: non-overlapping segments use the ordered union path, while
segments explicitly marked as overlapping use the merge path. It
recognizes non-singleton overlapping rowsets created by quick merge,
always materializes the row-binlog TSO column when it is needed for
ordering, and groups MIN_DELTA events by comparing their user-key
columns directly.
Before this change, affected queries could abort the BE, read
quick-merge rowsets out of order, or produce incorrect MIN_DELTA
results. After this change, multi-segment row-binlog rowsets are read
through a consistent iterator interface and processed in key/TSO order
with correct per-key change folding.
0 commit comments