Skip to content

branch-4.0: [fix](memory-tracker) Avoid nested task attach in cloud snapshot manager #63189#63446

Merged
yiguolei merged 1 commit into
branch-4.0from
auto-pick-63189-branch-4.0
May 21, 2026
Merged

branch-4.0: [fix](memory-tracker) Avoid nested task attach in cloud snapshot manager #63189#63446
yiguolei merged 1 commit into
branch-4.0from
auto-pick-63189-branch-4.0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Cherry-picked from #63189

…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.
@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 40.00% (2/5) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.54% (25518/35669)
Line Coverage 54.33% (270182/497322)
Region Coverage 52.00% (224073/430933)
Branch Coverage 53.33% (96279/180525)

@hello-stephen
Copy link
Copy Markdown
Contributor

/review

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 yiguolei merged commit afe0082 into branch-4.0 May 21, 2026
29 of 32 checks passed
@github-actions github-actions Bot deleted the auto-pick-63189-branch-4.0 branch May 21, 2026 05:25
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