This is an automated email from the ASF dual-hosted git repository.
gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 002bbdc2f76 [Fix](Rowset Id) Use a randomly generated rowset ID to
handle memory write failures (#42949)
002bbdc2f76 is described below
commit 002bbdc2f763786d0c2ac35189e5a3a49431bfd4
Author: abmdocrt <[email protected]>
AuthorDate: Thu Nov 14 17:26:25 2024 +0800
[Fix](Rowset Id) Use a randomly generated rowset ID to handle memory write
failures (#42949)
---
be/src/common/config.cpp | 1 +
be/src/common/config.h | 1 +
be/src/olap/olap_common.h | 10 +++++++++-
be/src/olap/rowset/unique_rowset_id_generator.cpp | 9 +++++++++
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index be76a6de316..796e9af62ce 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -1368,6 +1368,7 @@ DEFINE_Int32(query_cache_size, "512");
DEFINE_mBool(enable_delete_bitmap_merge_on_compaction, "false");
// Enable validation to check the correctness of table size.
DEFINE_Bool(enable_table_size_correctness_check, "false");
+DEFINE_Bool(force_regenerate_rowsetid_on_start_error, "false");
// clang-format off
#ifdef BE_TEST
diff --git a/be/src/common/config.h b/be/src/common/config.h
index 96d3e56c840..c40875728a3 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -1448,6 +1448,7 @@ DECLARE_mInt32(check_score_rounds_num);
// MB
DECLARE_Int32(query_cache_size);
+DECLARE_Bool(force_regenerate_rowsetid_on_start_error);
DECLARE_mBool(enable_delete_bitmap_merge_on_compaction);
// Enable validation to check the correctness of table size.
diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h
index d3bd0f0a3a2..11249bafb1e 100644
--- a/be/src/olap/olap_common.h
+++ b/be/src/olap/olap_common.h
@@ -35,6 +35,7 @@
#include <unordered_set>
#include <utility>
+#include "common/config.h"
#include "io/io_common.h"
#include "olap/olap_define.h"
#include "olap/rowset/rowset_fwd.h"
@@ -394,6 +395,8 @@ using ColumnId = uint32_t;
using UniqueIdSet = std::set<uint32_t>;
// Column unique Id -> column id map
using UniqueIdToColumnIdMap = std::map<ColumnId, ColumnId>;
+struct RowsetId;
+RowsetId next_rowset_id();
// 8 bit rowset id version
// 56 bit, inc number from 1
@@ -412,7 +415,12 @@ struct RowsetId {
auto [_, ec] = std::from_chars(rowset_id_str.data(),
rowset_id_str.data() +
rowset_id_str.length(), high);
if (ec != std::errc {}) [[unlikely]] {
- LOG(FATAL) << "failed to init rowset id: " << rowset_id_str;
+ if (config::force_regenerate_rowsetid_on_start_error) {
+ LOG(WARNING) << "failed to init rowset id: " <<
rowset_id_str;
+ high = next_rowset_id().hi;
+ } else {
+ LOG(FATAL) << "failed to init rowset id: " <<
rowset_id_str;
+ }
}
init(1, high, 0, 0);
} else {
diff --git a/be/src/olap/rowset/unique_rowset_id_generator.cpp
b/be/src/olap/rowset/unique_rowset_id_generator.cpp
index 0ac7f63837a..49e07e58359 100644
--- a/be/src/olap/rowset/unique_rowset_id_generator.cpp
+++ b/be/src/olap/rowset/unique_rowset_id_generator.cpp
@@ -17,8 +17,17 @@
#include "olap/rowset/unique_rowset_id_generator.h"
+#include <atomic>
+
+#include "olap/storage_engine.h"
+#include "runtime/exec_env.h"
+
namespace doris {
+RowsetId next_rowset_id() {
+ return ExecEnv::GetInstance()->storage_engine().next_rowset_id();
+}
+
UniqueRowsetIdGenerator::UniqueRowsetIdGenerator(const UniqueId& backend_uid)
: _backend_uid(backend_uid), _inc_id(1) {}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]