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: allow exec observers delay deletion of applied ssts #13061
Changes from 23 commits
a8aa437
d539ca9
78d02ec
b1d70ea
e7267b9
bd7c37c
b414ab7
843b1d2
0c9f89b
201b166
d304625
7b4285c
a61fe06
3a9d36a
4bc4d38
1d070ac
d65a980
28113c5
9df3445
5828b38
a30af8c
f49b30b
505f6a1
31e8978
d8b7f56
0aef69e
8a24650
4d8633d
b846e91
fdea78c
1f48a1a
cb3b07a
08ec612
e70a175
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ use std::{ | |
vec::IntoIter, | ||
}; | ||
|
||
use engine_traits::CfName; | ||
use engine_traits::{CfName, SstMetaInfo}; | ||
use kvproto::{ | ||
metapb::Region, | ||
pdpb::CheckPolicy, | ||
|
@@ -75,12 +75,21 @@ impl<'a> ObserverContext<'a> { | |
} | ||
} | ||
|
||
/// Context of a region provided for observers. | ||
#[derive(Default, Clone)] | ||
pub struct RegionState { | ||
pub peer_id: u64, | ||
pub pending_remove: bool, | ||
pub modified_region: Option<Region>, | ||
} | ||
|
||
/// Context for exec observers of mutation to be applied to ApplyContext. | ||
pub struct ApplyCtxInfo<'a> { | ||
pub pending_handle_ssts: &'a mut Option<Vec<SstMetaInfo>>, | ||
pub delete_ssts: &'a mut Vec<SstMetaInfo>, | ||
pub pending_delete_ssts: &'a mut Vec<SstMetaInfo>, | ||
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. where's the code that consumes pending_delete_ssts and delete the SST files? 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. In TiKV's view: 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.
IC. Then is there any metrics for pending_delete_ssts? We need to have a way to figure this out. 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. |
||
} | ||
|
||
pub trait AdminObserver: Coprocessor { | ||
/// Hook to call before proposing admin request. | ||
fn pre_propose_admin(&self, _: &mut ObserverContext<'_>, _: &mut AdminRequest) -> Result<()> { | ||
|
@@ -115,6 +124,7 @@ pub trait AdminObserver: Coprocessor { | |
_: &Cmd, | ||
_: &RaftApplyState, | ||
_: &RegionState, | ||
_: &mut ApplyCtxInfo<'_>, | ||
) -> bool { | ||
false | ||
} | ||
|
@@ -154,6 +164,7 @@ pub trait QueryObserver: Coprocessor { | |
_: &Cmd, | ||
_: &RaftApplyState, | ||
_: &RegionState, | ||
_: &mut ApplyCtxInfo<'_>, | ||
) -> bool { | ||
false | ||
} | ||
|
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.
what's the meaning of 18 and all other numbers below
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.
In this test, we assign unique index for each observer functions so that we can test all of the observer functions we want to be called are called. All numbers below 18 are used for other functions, so we use 18 for post_exec.