Skip to content

Commit

Permalink
z
Browse files Browse the repository at this point in the history
Signed-off-by: CalvinNeo <[email protected]>
  • Loading branch information
CalvinNeo committed Jan 4, 2024
1 parent 45f51e0 commit c3fa44b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
25 changes: 11 additions & 14 deletions proxy_components/engine_store_ffi/src/core/forward_raft/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl<T: Transport + 'static, ER: RaftEngine> ProxyForwarder<T, ER> {
// However, if enable_unips, by no means can we handle fap snapshot.
#[allow(clippy::collapsible_if)]
if self.packed_envs.engine_store_cfg.enable_unips {
let mut maybe_cached_info : Option<Arc<CachedRegionInfo>> = None;
let mut maybe_cached_info: Option<Arc<CachedRegionInfo>> = None;
let mut restart = false;
if self
.get_cached_manager()
Expand All @@ -321,22 +321,23 @@ impl<T: Transport + 'static, ER: RaftEngine> ProxyForwarder<T, ER> {
maybe_cached_info = Some(c);
restart = true;
}
}
).is_err() {
fatal!("poisoned");
}
},
)
.is_err()
{
fatal!("poisoned");
}

match maybe_cached_info {
Some(o) => {
let is_first_snapshot =
!o.inited_or_fallback.load(Ordering::SeqCst);
let is_first_snapshot = !o.inited_or_fallback.load(Ordering::SeqCst);
if is_first_snapshot {
return try_apply_fap_snapshot(o, restart);
}
},
}
None => {
fatal!("can't access CachedRegionInfo region_id={}", region_id);
},
}
}
}
false
Expand All @@ -361,11 +362,7 @@ impl<T: Transport + 'static, ER: RaftEngine> ProxyForwarder<T, ER> {
"pending" => self.engine.proxy_ext.pending_applies_count.load(Ordering::SeqCst),
);

if self.post_apply_snapshot_for_fap_snapshot(
ob_region,
peer_id,
snap_key,
) {
if self.post_apply_snapshot_for_fap_snapshot(ob_region, peer_id, snap_key) {
// Already handled as an fap snapshot.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub(crate) unsafe extern "C" fn ffi_apply_fap_snapshot(
"region_id" => region_id,
"peer_id" => peer_id,
);
return 0
},
return 0;
}
};
(*store.engine_store_server)
.kvstore
Expand Down
2 changes: 1 addition & 1 deletion proxy_components/proxy_server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pub fn address_proxy_config(config: &mut TikvConfig, proxy_config: &ProxyConfig)

config.raft_store.enable_v2_compatible_learner =
proxy_config.raft_store.enable_v2_compatible_learner;

if proxy_config.engine_store.enable_fast_add_peer && !proxy_config.engine_store.enable_unips {
fatal!("fast add peer can only work when using unips");
}
Expand Down

0 comments on commit c3fa44b

Please sign in to comment.