Skip to content

branch-4.1: [fix](be) Continue sorted merge when sender queue is ready #65004#65106

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-65004-branch-4.1
Jul 2, 2026
Merged

branch-4.1: [fix](be) Continue sorted merge when sender queue is ready #65004#65106
yiguolei merged 1 commit into
branch-4.1from
auto-pick-65004-branch-4.1

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from #65004

### What problem does this PR solve?

When a sorted-run merge cursor reaches the end of its current block and
the sender already has the next block ready, the merger may fetch the
next block before flushing rows that have already been selected into the
output block.

For variable-length columns, the pending row addresses still point to
the previous cursor block. Reusing the cursor block before `do_insert()`
can make the output read rows from the wrong block and corrupt string
offsets.

### What is changed?

Flush pending output rows before loading the next ready block from the
exhausted cursor.

This keeps the existing non-ready path behavior unchanged: when the next
block is not ready, the cursor is saved as pending and the current
output block is returned first.

The PR also adds regression coverage for both:

- continuing merge when the next sender block is already ready
- preserving string column values before the cursor block is reused
@github-actions github-actions Bot requested a review from yiguolei as a code owner July 1, 2026 09:24
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 97.83% (45/46) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 72.03% (26855/37285)
Line Coverage 55.13% (286296/519350)
Region Coverage 52.63% (239258/454613)
Branch Coverage 53.74% (103153/191964)

@yiguolei yiguolei merged commit 37b4b4c into branch-4.1 Jul 2, 2026
29 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants