Skip to content

refactor: propagate flush reasons through FlushRegions path#8051

Merged
killme2008 merged 3 commits into
GreptimeTeam:mainfrom
QuakeWang:feat/flush-reason
May 1, 2026
Merged

refactor: propagate flush reasons through FlushRegions path#8051
killme2008 merged 3 commits into
GreptimeTeam:mainfrom
QuakeWang:feat/flush-reason

Conversation

@QuakeWang

Copy link
Copy Markdown
Collaborator

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

Closes: #7586

What's changed and what's your intention?

This PR propagates flush reasons through the FlushRegions path, so metasrv-triggered flushes no longer fall back to Manual on the datanode and mito2 side.

It adds an optional reason to FlushRegions and RegionFlushRequest, propagates it through metasrv -> datanode -> mito2, and sets explicit reasons for region migration, repartition, and remote WAL prune flushes. Manual/user-triggered flush behavior remains unchanged, and legacy FlushRegions payloads without reason are still supported.

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
@github-actions github-actions Bot added docs-not-required This change does not impact docs. size/M labels Apr 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a reason field to region flush requests to categorize the source of flushes, such as region migration, repartitioning, or remote WAL pruning. The changes span multiple components, including common-meta, datanode, meta-srv, and the mito2 engine, ensuring that the flush reason is propagated from the instruction level down to the storage engine. The PR also includes updates to tests and simplifies RegionFlushRequest instantiation using default values. Feedback suggests a minor simplification for assigning the flush reason in the metadata service utility functions.

Comment thread src/meta-srv/src/procedure/utils.rs Outdated
@WenyXu

WenyXu commented Apr 30, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@killme2008 killme2008 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good job!

@WenyXu Please take a look.

Comment thread src/mito2/src/worker/handle_flush.rs Outdated
Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

@WenyXu WenyXu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rest LGTM

Comment thread src/meta-srv/src/region/flush_trigger.rs Outdated
Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
@killme2008 killme2008 added this pull request to the merge queue May 1, 2026
Merged via the queue into GreptimeTeam:main with commit 45e990b May 1, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refine FlushRegion reasons and propagate through the request path

3 participants