Skip to content

Commit cc91ebb

Browse files
branch-3.0: [improve](move-memtable) improve error log and message for "not enough streams" #47470 (#47721)
Cherry-picked from #47470 Co-authored-by: Kaijie Chen <[email protected]>
1 parent 098c13c commit cc91ebb

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

be/src/vec/sink/writer/vtablet_writer_v2.cpp

+19-2
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ void VTabletWriterV2::_generate_rows_for_tablet(std::vector<RowPartTabletIds>& r
378378

379379
Status VTabletWriterV2::_select_streams(int64_t tablet_id, int64_t partition_id, int64_t index_id,
380380
std::vector<std::shared_ptr<LoadStreamStub>>& streams) {
381+
std::vector<int64_t> failed_node_ids;
381382
const auto* location = _location->find_tablet(tablet_id);
382383
DBUG_EXECUTE_IF("VTabletWriterV2._select_streams.location_null", { location = nullptr; });
383384
if (location == nullptr) {
@@ -397,6 +398,9 @@ Status VTabletWriterV2::_select_streams(int64_t tablet_id, int64_t partition_id,
397398
<< ", stream_ok=" << (stream == nullptr ? "no" : "yes");
398399
});
399400
if (stream == nullptr) {
401+
LOG(WARNING) << "skip writing tablet " << tablet_id << " to backend " << node_id
402+
<< ": stream is not open";
403+
failed_node_ids.push_back(node_id);
400404
continue;
401405
}
402406
streams.emplace_back(std::move(stream));
@@ -407,8 +411,21 @@ Status VTabletWriterV2::_select_streams(int64_t tablet_id, int64_t partition_id,
407411
<< ", num_nodes=" << location->node_ids.size();
408412
});
409413
if (streams.size() <= location->node_ids.size() / 2) {
410-
return Status::InternalError("not enough streams {}/{}", streams.size(),
411-
location->node_ids.size());
414+
std::ostringstream success_msg;
415+
std::ostringstream failed_msg;
416+
for (auto& s : streams) {
417+
success_msg << ", " << s->dst_id();
418+
}
419+
for (auto id : failed_node_ids) {
420+
failed_msg << ", " << id;
421+
}
422+
LOG(INFO) << "failed to write enough replicas " << streams.size() << "/"
423+
<< location->node_ids.size() << " for tablet " << tablet_id
424+
<< " due to connection errors; success nodes" << success_msg.str()
425+
<< "; failed nodes" << failed_msg.str() << ".";
426+
return Status::InternalError(
427+
"failed to write enough replicas {}/{} for tablet {} due to connection errors",
428+
streams.size(), location->node_ids.size(), tablet_id);
412429
}
413430
Status st;
414431
for (auto& stream : streams) {

regression-test/suites/fault_injection_p0/test_multi_replica_fault_injection.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ suite("test_multi_replica_fault_injection", "nonConcurrent") {
102102
// test one backend open failure
103103
load_with_injection("VTabletWriterV2._open_streams.skip_one_backend", "success", true)
104104
// test two backend open failure
105-
load_with_injection("VTabletWriterV2._open_streams.skip_two_backends", "not enough streams 1/3", false, "succ replica num 1 < load required replica num 2")
105+
load_with_injection("VTabletWriterV2._open_streams.skip_two_backends", "failed to write enough replicas 1/3 for tablet", false, "succ replica num 1 < load required replica num 2")
106106
sql """ set enable_memtable_on_sink_node=false """
107107
}
108108
}

0 commit comments

Comments
 (0)