Skip to content
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

fix: executes pending ddls if region memtable is empty while scheduling next flush #4119

Merged
merged 6 commits into from
Jun 11, 2024

Conversation

evenyag
Copy link
Contributor

@evenyag evenyag commented Jun 7, 2024

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 intention?

This PR fixes an issue: If a region schedules itself to flush again but its memtable is empty, then it will return success directly without clearing the FlushStatus and executing pending DDL requests.

So an alter request may be blocked for a long time in this situation:

  1. the region triggers a flush
  2. the region wants to flush again, it adds the flush task to the pending flush list
  3. the region receives an alter request and it adds the requests to the pending DDL list
  4. the region doesn't receive any write request
  5. the flush job is finished and the worker schedules the same region to flush
  6. the region checks the memtable and marks the pending flush request as success immediately because the memtable is empty, but lefts the alter request in the list

There is a debug assertion in the scheduler to detect a similar case. This PR also adds two tests to cover this case in different level.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

@evenyag evenyag marked this pull request as ready for review June 7, 2024 12:12
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Jun 7, 2024
@evenyag evenyag requested a review from WenyXu June 7, 2024 12:15
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 98.48485% with 4 lines in your changes missing coverage. Please review.

Project coverage is 85.13%. Comparing base (e982d2e) to head (365af39).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4119      +/-   ##
==========================================
- Coverage   85.39%   85.13%   -0.26%     
==========================================
  Files         994      994              
  Lines      173994   174346     +352     
==========================================
- Hits       148580   148429     -151     
- Misses      25414    25917     +503     

Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@sunng87
Copy link
Member

sunng87 commented Jun 11, 2024

Fixes #4120

@sunng87 sunng87 linked an issue Jun 11, 2024 that may be closed by this pull request
@sunng87 sunng87 added this pull request to the merge queue Jun 11, 2024
Merged via the queue into GreptimeTeam:main with commit 9cae15b Jun 11, 2024
42 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fuzz test failure Distributed, Minio, fuzz_insert_logical_table
3 participants