From 1398f112461b528c4925aa9c48b68fc2e57aa4d2 Mon Sep 17 00:00:00 2001 From: huanghaibin <284824253@qq.com> Date: Thu, 29 Feb 2024 23:35:35 +0800 Subject: [PATCH] [improvement](group_commit) Empty wal should be deleted when replaying it (#31427) * [improvement](group_commit) Corrupt wal should be deleted when replaying it * edit --- be/src/olap/wal/wal_reader.cpp | 3 +++ be/src/olap/wal/wal_table.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/be/src/olap/wal/wal_reader.cpp b/be/src/olap/wal/wal_reader.cpp index 0dfaa18a24..d1263daf1c 100644 --- a/be/src/olap/wal/wal_reader.cpp +++ b/be/src/olap/wal/wal_reader.cpp @@ -86,6 +86,9 @@ Status WalReader::read_block(PBlock& block) { } Status WalReader::read_header(std::string& col_ids) { + if (file_reader->size() == 0) { + return Status::DataQualityError("empty file"); + } size_t bytes_read = 0; std::string magic_str; magic_str.resize(k_wal_magic_length); diff --git a/be/src/olap/wal/wal_table.cpp b/be/src/olap/wal/wal_table.cpp index 93cd12765f..0389c6fed2 100644 --- a/be/src/olap/wal/wal_table.cpp +++ b/be/src/olap/wal/wal_table.cpp @@ -98,7 +98,7 @@ Status WalTable::_relay_wal_one_by_one() { doris::wal_fail << 1; LOG(WARNING) << "failed to replay wal=" << wal_info->get_wal_path() << ", st=" << st.to_string(); - if (!st.is()) { + if (!st.is() && !st.is()) { need_retry_wals.push_back(wal_info); } else { need_delete_wals.push_back(wal_info);