[fix](move-memtable) change brpc connection type to single (#34883)

This commit is contained in:
Kaijie Chen
2024-05-15 18:26:41 +08:00
committed by yiguolei
parent 849eeb39e9
commit 4b96f9834f
2 changed files with 8 additions and 4 deletions

View File

@ -111,7 +111,8 @@ public:
std::shared_ptr<T> get_new_client_no_cache(const std::string& host_port,
const std::string& protocol = "baidu_std",
const std::string& connect_type = "") {
const std::string& connect_type = "",
const std::string& connection_group = "") {
brpc::ChannelOptions options;
if constexpr (std::is_same_v<T, PFunctionService_Stub>) {
options.protocol = config::function_service_protocol;
@ -121,6 +122,9 @@ public:
if (connect_type != "") {
options.connection_type = connect_type;
}
if (connection_group != "") {
options.connection_group = connection_group;
}
options.connect_timeout_ms = 2000;
options.max_retry = 10;

View File

@ -175,9 +175,9 @@ Status LoadStreamStub::open(BrpcClientCache<PBackendService_Stub>* client_cache,
*request.add_tablets() = tablet;
}
POpenLoadStreamResponse response;
// use "pooled" connection to avoid conflicts between streaming rpc and regular rpc,
// see: https://github.com/apache/brpc/issues/392
const auto& stub = client_cache->get_new_client_no_cache(host_port, "baidu_std", "pooled");
// set connection_group "streaming" to distinguish with non-streaming connections
const auto& stub =
client_cache->get_new_client_no_cache(host_port, "baidu_std", "single", "streaming");
stub->open_load_stream(&cntl, &request, &response, nullptr);
for (const auto& resp : response.tablet_schemas()) {
auto tablet_schema = std::make_unique<TabletSchema>();