branch-4.0: [fix](memory-tracker) Avoid nested task attach in cloud snapshot manager #63189#63446
Merged
Merged
Conversation
…ger (#63189) Cloud download callback already attaches the `SnapshotLoader` resource context. During cloud restore,` CloudSnapshotLoader::download()` calls `CloudSnapshotMgr::make_snapshot()`, which previously used `SCOPED_ATTACH_TASK` again and could hit `ThreadContext::attach_task() `DCHECK because task attach is not nestable. Use `SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER` in `CloudSnapshotMgr` and`SnapshotMgr` snapshot operations avoiding the nested-attach pattern. These methods only need to account memory to the manager tracker, and limiter switching works both with and without an outer attached task context.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
|
/review |
Contributor
Author
There was a problem hiding this comment.
Review result: no blocking issues found in this PR.
Critical checkpoints:
- Correctness: The changes replace non-nestable task attachment with mem-tracker limiter switching in snapshot manager entry points, matching the intended nested cloud restore path and preserving memory accounting for the affected code.
- Resource/context safety: Reviewed affected call chains for uses that require
thread_context()->resource_ctx()or an attached task; no new dependency break was found in these paths. - Regression risk: Scope is limited to five macro replacements in snapshot operations; existing nested limiter usage in conversion paths is compatible.
- Tests/build: Not run locally in this review runner due to the very small C++ scope and lack of a targeted lightweight test command.
- Existing review context: No prior inline review threads were present, so no duplicate issue was submitted.
- User focus: No additional user-provided review focus was supplied.
yiguolei
approved these changes
May 21, 2026
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.
Cherry-picked from #63189