From 3d7e15b458dec72fbe5888b614c6721a1cf2a776 Mon Sep 17 00:00:00 2001 From: WenyXu Date: Mon, 13 Nov 2023 09:30:30 +0000 Subject: [PATCH 1/2] refactor: reduce meta server cache scope --- src/meta-srv/src/metasrv/builder.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/meta-srv/src/metasrv/builder.rs b/src/meta-srv/src/metasrv/builder.rs index 8ad55b799918..3ac7bd78f82e 100644 --- a/src/meta-srv/src/metasrv/builder.rs +++ b/src/meta-srv/src/metasrv/builder.rs @@ -168,7 +168,6 @@ impl MetaSrvBuilder { state.clone(), kv_backend.clone(), )); - let kv_backend = leader_cached_kv_backend.clone() as _; let meta_peer_client = meta_peer_client .unwrap_or_else(|| build_default_meta_peer_client(&election, &in_memory)); @@ -177,7 +176,9 @@ impl MetaSrvBuilder { let mailbox = build_mailbox(&kv_backend, &pushers); let procedure_manager = build_procedure_manager(&options, &kv_backend); let table_id_sequence = Arc::new(Sequence::new(TABLE_ID_SEQ, 1024, 10, kv_backend.clone())); - let table_metadata_manager = Arc::new(TableMetadataManager::new(kv_backend.clone())); + let table_metadata_manager = Arc::new(TableMetadataManager::new( + leader_cached_kv_backend.clone() as _, + )); let lock = lock.unwrap_or_else(|| Arc::new(MemLock::default())); let selector_ctx = SelectorContext { server_addr: options.server_addr.clone(), From 67b013cc5cb027a89b4fba49e42167bf5e65475b Mon Sep 17 00:00:00 2001 From: WenyXu Date: Mon, 13 Nov 2023 09:58:45 +0000 Subject: [PATCH 2/2] chore: remove redundant code --- src/common/meta/src/key.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/meta/src/key.rs b/src/common/meta/src/key.rs index 5970868f1a4e..fa06558a9ba3 100644 --- a/src/common/meta/src/key.rs +++ b/src/common/meta/src/key.rs @@ -660,9 +660,7 @@ impl TableMetadataManager { .table_route_manager() .build_update_txn(table_id, ¤t_table_route_value, &new_table_route_value)?; - let txn = Txn::merge_all(vec![update_table_route_txn]); - - let r = self.kv_backend.txn(txn).await?; + let r = self.kv_backend.txn(update_table_route_txn).await?; // Checks whether metadata was already updated. if !r.succeeded {