Skip to content

Commit

Permalink
rename clean_stale_tick_max to stale_peer_check_tick
Browse files Browse the repository at this point in the history
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
  • Loading branch information
CalvinNeo committed Aug 31, 2022
1 parent 7e9b045 commit 65b652e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/proxy_server/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ pub fn setup_default_tikv_config(default: &mut TiKvConfig) {
default.server.status_addr = TIFLASH_DEFAULT_STATUS_ADDR.to_string();
default.server.advertise_status_addr = TIFLASH_DEFAULT_STATUS_ADDR.to_string();
default.raft_store.region_worker_tick_interval = ReadableDuration::millis(500);
let clean_stale_tick_max =
let stale_peer_check_tick =
(10_000 / default.raft_store.region_worker_tick_interval.as_millis()) as usize;
default.raft_store.clean_stale_tick_max = clean_stale_tick_max;
default.raft_store.stale_peer_check_tick = stale_peer_check_tick;
}

/// Generate default TiKvConfig, but with some Proxy's default values.
Expand Down
4 changes: 2 additions & 2 deletions components/raftstore/src/store/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub struct Config {

#[doc(hidden)]
#[online_config(skip)]
pub clean_stale_tick_max: usize,
pub stale_peer_check_tick: usize,

// Interval (ms) to check region whether the data is consistent.
pub consistency_check_interval: ReadableDuration,
Expand Down Expand Up @@ -359,7 +359,7 @@ impl Default for Config {
} else {
ReadableDuration::millis(1000)
},
clean_stale_tick_max: if cfg!(feature = "test") { 1 } else { 10 },
stale_peer_check_tick: if cfg!(feature = "test") { 1 } else { 10 },
lock_cf_compact_interval: ReadableDuration::minutes(10),
lock_cf_compact_bytes_threshold: ReadableSize::mb(256),
// Disable consistency check by default as it will hurt performance.
Expand Down
2 changes: 1 addition & 1 deletion components/raftstore/src/store/fsm/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ impl<EK: KvEngine, ER: RaftEngine> RaftBatchSystem<EK, ER> {
mgr.clone(),
cfg.value().snap_apply_batch_size.0 as usize,
cfg.value().region_worker_tick_interval.as_millis(),
cfg.value().clean_stale_tick_max,
cfg.value().stale_peer_check_tick,
cfg.value().use_delete_range,
cfg.value().snap_generator_pool_size,
workers.coprocessor_host.clone(),
Expand Down
10 changes: 5 additions & 5 deletions components/raftstore/src/store/worker/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ where
// pending_applies records all delayed apply task, and will check again later
pending_applies: VecDeque<Task<EK::Snapshot>>,
clean_stale_tick: usize,
clean_stale_tick_max: usize,
stale_peer_check_tick: usize,
clean_stale_check_interval: Duration,
tiflash_stores: HashMap<u64, bool>,
pd_client: Option<Arc<T>>,
Expand All @@ -718,7 +718,7 @@ where
mgr: SnapManager,
batch_size: usize,
region_worker_tick_interval: u64,
clean_stale_tick_max: usize,
stale_peer_check_tick: usize,
use_delete_range: bool,
snap_generator_pool_size: usize,
coprocessor_host: CoprocessorHost<EK>,
Expand All @@ -733,7 +733,7 @@ where
};

info!("create region runner"; "pool_size" => pool_size, "pre_handle_snap" => pre_handle_snap, "region_worker_tick_interval" => region_worker_tick_interval,
"clean_stale_tick_max" => clean_stale_tick_max);
"stale_peer_check_tick" => stale_peer_check_tick);

Runner {
pre_handle_snap_cfg: PreHandleSnapCfg {
Expand All @@ -754,7 +754,7 @@ where
},
pending_applies: VecDeque::new(),
clean_stale_tick: 0,
clean_stale_tick_max,
stale_peer_check_tick,
clean_stale_check_interval: Duration::from_millis(region_worker_tick_interval),
tiflash_stores: HashMap::default(),
pd_client,
Expand Down Expand Up @@ -894,7 +894,7 @@ where
fn on_timeout(&mut self) {
self.handle_pending_applies();
self.clean_stale_tick += 1;
if self.clean_stale_tick >= self.clean_stale_tick_max {
if self.clean_stale_tick >= self.stale_peer_check_tick {
self.ctx.clean_stale_ranges();
self.clean_stale_tick = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/proxy/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ mod config {
config.server.advertise_status_addr,
TIFLASH_DEFAULT_STATUS_ADDR
);
assert_eq!(config.raft_store.region_worker_tick_interval, 500);
assert_eq!(config.raft_store.region_worker_tick_interval.as_millis(), 500);
}

#[test]
Expand Down

0 comments on commit 65b652e

Please sign in to comment.