Skip to content

Commit 0add056

Browse files
authored
Refactoring and minor bug fix. (#1108)
Simplified the search client pool: - no async - no trait - a sync rwlock that copies modifies and sets. (The previous implementation held the lock while the client where created) - Removed redundant code - Removed redundant Arc<> over SearchClientPool Refactor root.rs to encapsulate Partial hit map contract Added a job trait. Removing couple in placed requests Renamed split_metadata -> split_offsets in the proto Simplified rendez vous hashing code Removing logic limiting the number of leaf requests run concurrently in the root. Refactoring attempt to enforce split offset contract. This refactoring attempts to remove a bunch of unwraps justified by non-trivial contracts in the root code.
1 parent b5700e1 commit 0add056

File tree

16 files changed

+801
-962
lines changed

16 files changed

+801
-962
lines changed

quickwit-proto/proto/search_api.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ message LeafSearchRequest {
123123

124124
// Index split ids to apply the query on.
125125
// This ids are resolved from the index_uri defined in the search_request.
126-
repeated SplitIdAndFooterOffsets split_metadata = 4;
126+
repeated SplitIdAndFooterOffsets split_offsets = 4;
127127

128128
// `DocMapper` as json serialized trait.
129129
string doc_mapper = 5;
@@ -204,7 +204,7 @@ message FetchDocsRequest {
204204
// Split footer offsets. They are required for fetch docs to
205205
// fetch the document content in two reads, when the footer is not
206206
// cached.
207-
repeated SplitIdAndFooterOffsets split_metadata = 3;
207+
repeated SplitIdAndFooterOffsets split_offsets = 3;
208208

209209
// Index URI. The index URI defines the location of the storage that contains the
210210
// split files.
@@ -261,7 +261,7 @@ message LeafSearchStreamRequest {
261261

262262
// Index split ids to apply the query on.
263263
// This ids are resolved from the index_uri defined in the stream request.
264-
repeated SplitIdAndFooterOffsets split_metadata = 2;
264+
repeated SplitIdAndFooterOffsets split_offsets = 2;
265265

266266
// `DocMapper` as json serialized trait.
267267
string doc_mapper = 5;

quickwit-proto/src/quickwit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub struct LeafSearchRequest {
7878
/// Index split ids to apply the query on.
7979
/// This ids are resolved from the index_uri defined in the search_request.
8080
#[prost(message, repeated, tag = "4")]
81-
pub split_metadata: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
81+
pub split_offsets: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
8282
/// `DocMapper` as json serialized trait.
8383
#[prost(string, tag = "5")]
8484
pub doc_mapper: ::prost::alloc::string::String,
@@ -175,7 +175,7 @@ pub struct FetchDocsRequest {
175175
/// fetch the document content in two reads, when the footer is not
176176
/// cached.
177177
#[prost(message, repeated, tag = "3")]
178-
pub split_metadata: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
178+
pub split_offsets: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
179179
/// Index URI. The index URI defines the location of the storage that contains the
180180
/// split files.
181181
#[prost(string, tag = "4")]
@@ -228,7 +228,7 @@ pub struct LeafSearchStreamRequest {
228228
/// Index split ids to apply the query on.
229229
/// This ids are resolved from the index_uri defined in the stream request.
230230
#[prost(message, repeated, tag = "2")]
231-
pub split_metadata: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
231+
pub split_offsets: ::prost::alloc::vec::Vec<SplitIdAndFooterOffsets>,
232232
/// `DocMapper` as json serialized trait.
233233
#[prost(string, tag = "5")]
234234
pub doc_mapper: ::prost::alloc::string::String,

quickwit-search/src/client.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ use std::net::SocketAddr;
2222
use std::sync::Arc;
2323

2424
use futures::{StreamExt, TryStreamExt};
25-
use http::Uri;
2625
use opentelemetry::global;
2726
use opentelemetry::propagation::Injector;
2827
use quickwit_proto::LeafSearchStreamResponse;
2928
use tokio_stream::wrappers::UnboundedReceiverStream;
30-
use tonic::transport::{Channel, Endpoint};
29+
use tonic::transport::Channel;
3130
use tonic::Request;
3231
use tracing::*;
3332
use tracing_opentelemetry::OpenTelemetrySpanExt;
@@ -229,22 +228,3 @@ impl SearchServiceClient {
229228
}
230229
}
231230
}
232-
233-
/// Create a SearchServiceClient with SocketAddr as an argument.
234-
/// It will try to reconnect to the node automatically.
235-
pub async fn create_search_service_client(
236-
grpc_addr: SocketAddr,
237-
) -> anyhow::Result<SearchServiceClient> {
238-
let uri = Uri::builder()
239-
.scheme("http")
240-
.authority(grpc_addr.to_string().as_str())
241-
.path_and_query("/")
242-
.build()?;
243-
// Create a channel with connect_lazy to automatically reconnect to the node.
244-
let channel = Endpoint::from(uri).connect_lazy();
245-
let client = SearchServiceClient::from_grpc_client(
246-
quickwit_proto::search_service_client::SearchServiceClient::new(channel),
247-
grpc_addr,
248-
);
249-
Ok(client)
250-
}

quickwit-search/src/client_pool.rs

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)