Skip to content

Commit

Permalink
[Refactor] Adjust stream load planner timeout reduce the db lock time…
Browse files Browse the repository at this point in the history
…out error (StarRocks#18992)

Signed-off-by: meegoo <meegoo.sr@gmail.com>
  • Loading branch information
meegoo authored Mar 7, 2023
1 parent 29a2efc commit f0195f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions be/src/http/action/stream_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,12 @@ Status StreamLoadAction::_process_put(HttpRequest* http_req, StreamLoadContext*
return Status::InvalidArgument("Invalid load_dop format");
}
}
int32_t rpc_timeout_ms = config::txn_commit_rpc_timeout_ms;
if (ctx->timeout_second != -1) {
request.__set_timeout(ctx->timeout_second);
rpc_timeout_ms = std::min(ctx->timeout_second * 1000, config::txn_commit_rpc_timeout_ms);
}
request.__set_thrift_rpc_timeout_ms(config::thrift_rpc_timeout_ms);
request.__set_thrift_rpc_timeout_ms(rpc_timeout_ms);
// plan this load
TNetworkAddress master_addr = get_master_address();
#ifndef BE_TEST
Expand All @@ -541,7 +543,8 @@ Status StreamLoadAction::_process_put(HttpRequest* http_req, StreamLoadContext*
int64_t stream_load_put_start_time = MonotonicNanos();
RETURN_IF_ERROR(ThriftRpcHelper::rpc<FrontendServiceClient>(
master_addr.hostname, master_addr.port,
[&request, ctx](FrontendServiceConnection& client) { client->streamLoadPut(ctx->put_result, request); }));
[&request, ctx](FrontendServiceConnection& client) { client->streamLoadPut(ctx->put_result, request); },
rpc_timeout_ms));
ctx->stream_load_put_cost_nanos = MonotonicNanos() - stream_load_put_start_time;
#else
ctx->put_result = k_stream_load_put_result;
Expand Down

0 comments on commit f0195f5

Please sign in to comment.