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

raftstore-v2: not update modification index for delete range #14905

Merged
merged 10 commits into from Jun 13, 2023

Conversation

SpadeA-Tang
Copy link
Member

@SpadeA-Tang SpadeA-Tang commented Jun 8, 2023

What is changed and how it works?

Issue Number: Close #14904

What's Changed:

not update modification index for delete range 

If key range are matched well with sst files, delete range may not produce entries in memtable. It means it is possible that the memtable is empty after delete range for default cf for instance, and there's no further write/delete for default cf, last_modified will never equal to last_flushed for this cf. So, admin flushed index will never be progressed.

As delete range is an usafe operation and cannot be rollbacked to replay, so it's better to not modify the modification index for delete range operation.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note

None

Signed-off-by: Spade A <u6748471@anu.edu.au>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 8, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bufferflies
  • overvenus

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@SpadeA-Tang SpadeA-Tang changed the title raftstore-v2: delete a fake key after delete range raftstore-v2: delete a magic key after delete range Jun 8, 2023
SpadeA-Tang and others added 2 commits June 8, 2023 19:27
Signed-off-by: Spade A <u6748471@anu.edu.au>
@tonyxuqqi
Copy link
Contributor

"last_modified will never equal to last_flushed for this cf"

Do you mean this code " fn maybe_advance_admin_flushed(&mut self, mem_index: u64) {
if self.admin.flushed < self.admin.last_modified {
return;
}"

SpadeA-Tang and others added 3 commits June 9, 2023 14:32
Signed-off-by: Spade A <u6748471@anu.edu.au>
Signed-off-by: Spade A <u6748471@anu.edu.au>
@SpadeA-Tang SpadeA-Tang changed the title raftstore-v2: delete a magic key after delete range raftstore-v2: not update modification index for delete range Jun 12, 2023
Signed-off-by: Spade A <u6748471@anu.edu.au>
@SpadeA-Tang
Copy link
Member Author

"last_modified will never equal to last_flushed for this cf"

Do you mean this code " fn maybe_advance_admin_flushed(&mut self, mem_index: u64) { if self.admin.flushed < self.admin.last_modified { return; }"

let min_flushed = self
    .data_cfs
    .iter_mut()
    // Only unflushed CFs are considered. Flushed CF always have uptodate changes
    // persisted.
    .filter_map(|pr| {
        // All modifications before mem_index must be seen. If following condition is
        // true, it means the modification comes beyond general apply process (like
        // transaction GC unsafe write). Align `last_modified` to `flushed` to avoid
        // blocking raft log GC.
        if mem_index >= pr.flushed && pr.flushed > pr.last_modified {
            pr.last_modified = pr.flushed;
        }
        if pr.last_modified != pr.flushed {
            Some(pr.flushed)
        } else {
            None
        }
    })
    .min();

SpadeA-Tang and others added 2 commits June 12, 2023 13:12
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Status: PR - There is already 1 approval label Jun 12, 2023
@ti-chi-bot ti-chi-bot bot added status/LGT2 Status: PR - There are already 2 approvals and removed status/LGT1 Status: PR - There is already 1 approval labels Jun 13, 2023
@overvenus
Copy link
Member

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 13, 2023

@overvenus: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 13, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 7d1d857

@ti-chi-bot ti-chi-bot bot added the status/can-merge Status: Can merge to base branch label Jun 13, 2023
@ti-chi-bot ti-chi-bot bot merged commit 738affa into tikv:master Jun 13, 2023
6 of 7 checks passed
@ti-chi-bot ti-chi-bot bot added this to the Pool milestone Jun 13, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #14933.

tonyxuqqi pushed a commit to tonyxuqqi/tikv that referenced this pull request Jun 22, 2023
)

close tikv#14904

not update modification index for delete range

Signed-off-by: Spade A <u6748471@anu.edu.au>
Signed-off-by: tonyxuqqi <tonyxuqi@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-7.1 release-note-none size/M status/can-merge Status: Can merge to base branch status/LGT2 Status: PR - There are already 2 approvals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dynamic Regions] after delete range, admin flushed index may be blocked
5 participants