Skip to content

Commit

Permalink
[improvement](move-memtable) enable stream write to socket in backgro…
Browse files Browse the repository at this point in the history
…und bthread (#30586)
  • Loading branch information
sollhui authored and Doris-Extras committed Jan 31, 2024
1 parent 23df12c commit 75976f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ DEFINE_mDouble(tablet_version_graph_orphan_vertex_ratio, "0.1");
DEFINE_Bool(share_delta_writers, "true");
// timeout for open load stream rpc in ms
DEFINE_Int64(open_load_stream_timeout_ms, "60000"); // 60s
// enable write background when using brpc stream
DEFINE_mBool(enable_brpc_stream_write_background, "true");

// brpc streaming max_buf_size in bytes
DEFINE_Int64(load_stream_max_buf_size, "20971520"); // 20MB
Expand Down
2 changes: 2 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@ DECLARE_mDouble(tablet_version_graph_orphan_vertex_ratio);
DECLARE_Bool(share_delta_writers);
// timeout for open load stream rpc in ms
DECLARE_Int64(open_load_stream_timeout_ms);
// enable write background when using brpc stream
DECLARE_mBool(enable_brpc_stream_write_background);

// brpc streaming max_buf_size in bytes
DECLARE_Int64(load_stream_max_buf_size);
Expand Down
4 changes: 3 additions & 1 deletion be/src/vec/sink/load_stream_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ Status LoadStreamStub::_send_with_retry(butil::IOBuf& buf) {
int64_t delay_ms = dp->param<int64>("delay_ms", 1000);
bthread_usleep(delay_ms * 1000);
});
ret = brpc::StreamWrite(_stream_id, buf);
brpc::StreamWriteOptions options;
options.write_in_background = config::enable_brpc_stream_write_background;
ret = brpc::StreamWrite(_stream_id, buf, &options);
}
DBUG_EXECUTE_IF("LoadStreamStub._send_with_retry.stream_write_failed", { ret = EPIPE; });
switch (ret) {
Expand Down

0 comments on commit 75976f6

Please sign in to comment.