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

snap: delete stale snapshot immediately #2429

Merged
merged 9 commits into from Nov 20, 2017
Merged

Conversation

BusyJay
Copy link
Member

@BusyJay BusyJay commented Oct 27, 2017

When replicating a peer, If it splits frequently, its snapshot may be always overlapped with other regions, so the snapshots will never be applied. Unfortunately, GC check can do nothing about the it, because the snapshot is never applied so compacted_index is always 0 which is less than any valid snapshot's index. And it's hard to check it in GC too. Because you can't tell if the snapshot is verified to be stale or just still buffered in the channel.

So this pr deletes the snapshot files immediately once it fails the snapshot check.

@siddontang
Copy link
Contributor

CI failed

@siddontang
Copy link
Contributor

any update @BusyJay

@siddontang siddontang changed the title snap: delete stale snapshot immediately [WIP] snap: delete stale snapshot immediately Nov 11, 2017
@siddontang
Copy link
Contributor

can we use failpoint for this test now?

@BusyJay
Copy link
Member Author

BusyJay commented Nov 15, 2017

I will add a test case once #2474 is merged, which introduces failpoint cases into integration tests.

@BusyJay BusyJay changed the title [WIP] snap: delete stale snapshot immediately snap: delete stale snapshot immediately Nov 18, 2017
@BusyJay
Copy link
Member Author

BusyJay commented Nov 18, 2017

PTAL

@zhangjinpeng87
Copy link
Member

LGTM

@siddontang
Copy link
Contributor

PTAL @overvenus

@@ -109,6 +109,7 @@ impl SnapContext {
&raw_snap,
region_id
));
fail_point!("handle_gen", region_id == 1, |_| Ok(()));
Copy link
Member

Choose a reason for hiding this comment

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

Better adding some comments, I have trouble understanding it.

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

lgtm

@BusyJay
Copy link
Member Author

BusyJay commented Nov 20, 2017

/run-integration-tests

@iamxy
Copy link
Collaborator

iamxy commented Nov 20, 2017

/run-integration-tests

@BusyJay BusyJay merged commit 3a872e3 into tikv:master Nov 20, 2017
@BusyJay BusyJay deleted the fix-snap-gc branch November 20, 2017 17:22
sticnarf pushed a commit to sticnarf/tikv that referenced this pull request Oct 27, 2019
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.

None yet

5 participants