Skip to content

feat: flush leader region before downgrading #5995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2025

Conversation

WenyXu
Copy link
Member

@WenyXu WenyXu commented Apr 27, 2025

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your

This change helps the system handle region migration more smoothly. By flushing the leader region before downgrading it, we can:

  • Minimize the time window where the region is not writable
  • Reduce the impact on write operations during region migration

Changes

  • Added a new FlushLeaderRegion state in the region migration procedure
  • Modified the region migration flow to flush the leader region before downgrading it
  • Added new metrics for tracking flush leader region operation duration
  • Added new test cases for the flush leader region functionality

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.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Apr 27, 2025
@WenyXu WenyXu force-pushed the feat/flush-region-before-downgrade branch from deb3daa to e6fe3fd Compare April 28, 2025 08:12
@WenyXu WenyXu requested a review from fengjiachun April 28, 2025 08:15
@WenyXu WenyXu marked this pull request as ready for review April 28, 2025 08:15
@WenyXu WenyXu requested review from MichaelScofield and a team as code owners April 28, 2025 08:15
Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@MichaelScofield MichaelScofield left a comment

Choose a reason for hiding this comment

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

Why not make the leader flushing inside downgrading it? That way you can avoid addition writes between flush and downgrade.

@WenyXu
Copy link
Member Author

WenyXu commented Apr 29, 2025

Why not make the leader flushing inside downgrading it? That way you can avoid addition writes between flush and downgrade.

By flushing the leader region before downgrading it, we can minimize the time window where the region is not writable.

@MichaelScofield MichaelScofield added this pull request to the merge queue Apr 29, 2025
Merged via the queue into main with commit a3ae2d7 Apr 29, 2025
38 checks passed
@MichaelScofield MichaelScofield deleted the feat/flush-region-before-downgrade branch April 29, 2025 03:51
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants