Skip to content

Commit f85176b

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

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
@@ -377,6 +377,7 @@ void VTabletWriterV2::_generate_rows_for_tablet(std::vector<RowPartTabletIds>& r
377377

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