diff --git a/proxy_components/mock-engine-store/src/mock_store/mock_core.rs b/proxy_components/mock-engine-store/src/mock_store/mock_core.rs index 268efa55034..90b3af719ee 100644 --- a/proxy_components/mock-engine-store/src/mock_store/mock_core.rs +++ b/proxy_components/mock-engine-store/src/mock_store/mock_core.rs @@ -140,11 +140,13 @@ pub fn copy_data_from( // kv data in memory for cf in 0..3 { for (k, v) in &source.data[cf] { - if k.as_slice() >= source.region.get_start_key() - && k.as_slice() < source.region.get_end_key() + if (k.as_slice() >= source.region.get_start_key() + || source.region.get_start_key().is_empty()) + && (k.as_slice() < source.region.get_end_key() + || source.region.get_end_key().is_empty()) { debug!( - "copy_data_from region {} {:?} {:?} S {:?} E {:?}", + "copy_data_from write to region {} {:?} {:?} S {:?} E {:?}", region_id, k, v, @@ -152,6 +154,15 @@ pub fn copy_data_from( source.region.get_end_key() ); write_kv_in_mem(target, cf, k.as_slice(), v.as_slice()); + } else { + debug!( + "copy_data_from skip write to region {} {:?} {:?} S {:?} E {:?}", + region_id, + k, + v, + source.region.get_start_key(), + source.region.get_end_key() + ); } } } diff --git a/proxy_tests/proxy/shared/fast_add_peer.rs b/proxy_tests/proxy/shared/fast_add_peer.rs index 8cecb5464d1..3138b5c8a48 100644 --- a/proxy_tests/proxy/shared/fast_add_peer.rs +++ b/proxy_tests/proxy/shared/fast_add_peer.rs @@ -5,6 +5,7 @@ use crate::utils::v1::*; enum SourceType { Leader, Learner, + // The learner coesn't catch up with Leader. DelayedLearner, InvalidSource, } @@ -328,6 +329,9 @@ fn test_overlap_apply_legacy_in_the_middle() { cluster.shutdown(); } +// `block_wait`: whether we block wait in a MsgAppend handling, or return with +// WaitForData. `pause`: pause in some core procedures. +// `check_timeout`: mock and check if FAP timeouts. fn simple_fast_add_peer( source_type: SourceType, block_wait: bool, @@ -421,7 +425,7 @@ fn simple_fast_add_peer( _ => (), } - // Add peer 3 + // Add peer 3 by FAP pd_client.must_add_peer(1, new_learner_peer(3, 3)); cluster.must_put(b"k2", b"v2"); @@ -649,6 +653,7 @@ mod simple_blocked_nopause {} mod simple_blocked_pause { use super::*; // Delay when fetch and build data + #[test] fn test_simpleb_from_learner_paused_build() { fail::cfg("fap_core_no_fallback", "panic").unwrap();