diff --git a/src/common/meta/src/range_stream.rs b/src/common/meta/src/range_stream.rs index 5fb70d1b7010..4aa60b00c3a9 100644 --- a/src/common/meta/src/range_stream.rs +++ b/src/common/meta/src/range_stream.rs @@ -39,7 +39,16 @@ enum PaginationStreamState { Error, } -pub const DEFAULT_PAGE_SIZE: usize = 512; +/// The Range Request's default page size. +/// +/// It dependents on upstream KvStore server side grpc message size limitation. +/// (e.g., etcd has default grpc message size limitation is 4MiB) +/// +/// Generally, almost all metadata is smaller than is 2700 Byte. +/// Therefore, We can set the [DEFAULT_PAGE_SIZE] to 1536 statically. +/// +/// TODO(weny): Considers updating the default page size dynamically. +pub const DEFAULT_PAGE_SIZE: usize = 1536; struct PaginationStreamFactory { kv: KvBackendRef, diff --git a/src/meta-srv/src/handler/on_leader_start_handler.rs b/src/meta-srv/src/handler/on_leader_start_handler.rs index 325bcf42a46a..9f32b443b711 100644 --- a/src/meta-srv/src/handler/on_leader_start_handler.rs +++ b/src/meta-srv/src/handler/on_leader_start_handler.rs @@ -35,8 +35,10 @@ impl HeartbeatHandler for OnLeaderStartHandler { if let Some(election) = &ctx.election { if election.in_infancy() { ctx.is_infancy = true; + // TODO(weny): Unifies the multiple leader state between Context and MetaSrv. + // we can't ensure the in-memory kv has already been reset in the outside loop. + // We still use heartbeat requests to trigger resetting in-memory kv. ctx.reset_in_memory(); - ctx.reset_leader_cached_kv_backend(); } } Ok(()) diff --git a/src/meta-srv/src/service/store/cached_kv.rs b/src/meta-srv/src/service/store/cached_kv.rs index 47c9ede1e1bb..450a967df112 100644 --- a/src/meta-srv/src/service/store/cached_kv.rs +++ b/src/meta-srv/src/service/store/cached_kv.rs @@ -96,7 +96,7 @@ impl LeaderCachedKvBackend { for prefix in &CACHE_KEY_PREFIXES[..] { let _timer = metrics::METRIC_META_LEADER_CACHED_KV_LOAD.with_label_values(&[prefix]); - // TODO(weny): Refactors PaginationStream's ouput to unary output. + // TODO(weny): Refactors PaginationStream's output to unary output. let stream = PaginationStream::new( self.store.clone(), RangeRequest::new().with_prefix(prefix.as_bytes()),