-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: fix delete range #15019
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6383ede
clean up wal writes
tabokie 8afe9fe
fix delete range apply trace
tabokie 81175fd
mute a test
tabokie 6280fc3
address comments
tabokie 79f3d38
Merge branch 'master' into 230627-fix-delete-range
tabokie dc7719a
moving the comment
tabokie File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,6 @@ impl<EK: KvEngine, R: ApplyResReporter> Apply<EK, R> { | |
start_key: &[u8], | ||
end_key: &[u8], | ||
notify_only: bool, | ||
use_delete_range: bool, | ||
) -> Result<()> { | ||
PEER_WRITE_CMD_COUNTER.delete_range.inc(); | ||
let off = data_cf_offset(cf); | ||
|
@@ -273,17 +272,16 @@ impl<EK: KvEngine, R: ApplyResReporter> Apply<EK, R> { | |
let start = Instant::now_coarse(); | ||
// Use delete_files_in_range to drop as many sst files as possible, this | ||
// is a way to reclaim disk space quickly after drop a table/index. | ||
if !notify_only { | ||
let written = if !notify_only { | ||
let (notify, wait) = oneshot::channel(); | ||
let delete_range = TabletTask::delete_range( | ||
self.region_id(), | ||
self.tablet().clone(), | ||
name_to_cf(cf).unwrap(), | ||
start_key.clone().into(), | ||
end_key.clone().into(), | ||
use_delete_range, | ||
Box::new(move || { | ||
notify.send(()).unwrap(); | ||
Box::new(move |written| { | ||
notify.send(written).unwrap(); | ||
}), | ||
); | ||
if let Err(e) = self.tablet_scheduler().schedule_force(delete_range) { | ||
|
@@ -295,19 +293,23 @@ impl<EK: KvEngine, R: ApplyResReporter> Apply<EK, R> { | |
); | ||
} | ||
|
||
let _ = wait.await; | ||
} | ||
wait.await.unwrap() | ||
} else { | ||
false | ||
}; | ||
|
||
info!( | ||
self.logger, | ||
"execute delete range"; | ||
"range_start" => log_wrappers::Value::key(&start_key), | ||
"range_end" => log_wrappers::Value::key(&end_key), | ||
"notify_only" => notify_only, | ||
"use_delete_range" => use_delete_range, | ||
"duration" => ?start.saturating_elapsed(), | ||
); | ||
|
||
if index != u64::MAX && written { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know, it's the old code, shared by all write requests. |
||
self.modifications_mut()[off] = index; | ||
} | ||
// delete range is an unsafe operation and it cannot be rollbacked to replay, so | ||
// we don't update modification index for this operation. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
written |= self.delete_all_in_range_cf_by_key(wopts, cf, &r)?;