This is an automated email from the ASF dual-hosted git repository.
leekei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 51bd65a [BUG] Fix possible TOCTOU race between leader discovery and
server lookup in Lookuper (#451)
51bd65a is described below
commit 51bd65a7cd00003b20cc0ad17fd116c84c067fb3
Author: Anton Borisov <[email protected]>
AuthorDate: Sat Mar 28 20:42:02 2026 +0000
[BUG] Fix possible TOCTOU race between leader discovery and server lookup
in Lookuper (#451)
---
crates/fluss/src/client/table/lookup.rs | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/crates/fluss/src/client/table/lookup.rs
b/crates/fluss/src/client/table/lookup.rs
index 3d643ed..aa29ea6 100644
--- a/crates/fluss/src/client/table/lookup.rs
+++ b/crates/fluss/src/client/table/lookup.rs
@@ -292,7 +292,6 @@ impl Lookuper {
let table_bucket = TableBucket::new_with_partition(table_id,
partition_id, bucket_id);
// Find the leader for this bucket
- let cluster = self.metadata.get_cluster();
let leader = self
.metadata
.leader_for(self.table_path.as_ref(), &table_bucket)
@@ -303,15 +302,7 @@ impl Lookuper {
))
})?;
- // Get connection to the tablet server
- let tablet_server =
cluster.get_tablet_server(leader.id()).ok_or_else(|| {
- Error::leader_not_available(format!(
- "Tablet server {} is not found in metadata cache",
- leader.id()
- ))
- })?;
-
- let connection = self.rpc_client.get_connection(tablet_server).await?;
+ let connection = self.rpc_client.get_connection(&leader).await?;
// Send lookup request
let request = LookupRequest::new(table_id, partition_id, bucket_id,
vec![pk_bytes_vec]);