[fix](be) Return fragment failure status instead of silent eos in memory scratch sink - #67604
Open
Z-SWEI wants to merge 1 commit into
Open
[fix](be) Return fragment failure status instead of silent eos in memory scratch sink#67604Z-SWEI wants to merge 1 commit into
Z-SWEI wants to merge 1 commit into
Conversation
…ory scratch sink When a fragment instance executed with MemoryScratchSink fails (e.g. query timeout or memory limit exceeded), MemoryScratchSinkLocalState::close() only puts the nullptr eos sentinel into the record batch queue and never propagates the failure status to ResultQueueMgr. A fetcher that already passed the status check in ResultQueueMgr::fetch_result and is blocked in blocking_get wakes up on the sentinel, treats it as normal end-of-stream and returns eos to the client. The client stops polling once it sees eos, so the query silently returns truncated results instead of the real error. This patch: 1. Publishes the fragment failure status to the result queue before putting the eos sentinel in MemoryScratchSinkLocalState::close(). 2. Re-checks the queue status when fetch_result observes the sentinel, so the failure is surfaced on the last fetch instead of a silent truncated eos. Co-Authored-By: Claude Code <noreply@anthropic.com>
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Problem Summary:
For queries whose results are pumped through
MemoryScratchSinkintoResultQueueMgr(the external scan context path:BaseBackendService::get_next->ResultQueueMgr::fetch_result), when the fragment instance fails -- e.g. query timeout or memory limit exceeded --MemoryScratchSinkLocalState::close()only puts thenullptreos sentinel into the record batch queue and never propagates the failure status to theResultQueueMgr.A fetcher that already passed the queue status check and is blocked in
blocking_get()wakes up on the sentinel, treats it as a normal end-of-stream, and returnseosto the caller. The client stops polling once it sees eos, so the query silently returns truncated results instead of the real error (TIMEOUT,MEM_LIMIT_EXCEEDED, ...).This patch:
MemoryScratchSinkLocalState::close(). It must be done before the sentinel: a fetcher blocked inblocking_getwakes up on the sentinel and re-checks the queue status.fetch_resultobserves the sentinel, so the failure is surfaced on this last fetch instead of a silent truncated eos.fetch_result_failure_before_eos_sentinel) covering the race: a fetch thread blocked inblocking_getwhile the sink thread publishes the failure status and then puts the sentinel.Release note
Fix silently truncated query results when a fragment served by
MemoryScratchSinkfails -- the query now returns the real failure status (e.g. TIMEOUT, MEM_LIMIT_EXCEEDED) instead of an apparent normal end-of-stream.Check List (For Author)
Test
Behavior changed:
MemoryScratchSinknow surfaces its real failure status to the caller instead of a silent truncated eos.Does this need documentation?
Check List (For Reviewer who merge this PR)