This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new d0737c45f8c [cherry-pick](branch-2.1) Pick "[Fix](Rowset Id) Use a randomly generated rowset ID to handle memory write failures (#42949)" (#44086) d0737c45f8c is described below commit d0737c45f8c937561bf85e95ef26d13c90d7a94b Author: abmdocrt <lianyuk...@selectdb.com> AuthorDate: Tue Dec 10 15:48:02 2024 +0800 [cherry-pick](branch-2.1) Pick "[Fix](Rowset Id) Use a randomly generated rowset ID to handle memory write failures (#42949)" (#44086) --- 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 fd0282586e6..9b828651865 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -1346,6 +1346,7 @@ DEFINE_mInt32(snappy_compression_block_size, "262144"); DEFINE_mInt32(lz4_compression_block_size, "262144"); DEFINE_mBool(enable_pipeline_task_leakage_detect, "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 f50462f20c2..3e92ba39835 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -1417,6 +1417,7 @@ DECLARE_mInt32(snappy_compression_block_size); DECLARE_mInt32(lz4_compression_block_size); DECLARE_mBool(enable_pipeline_task_leakage_detect); +DECLARE_Bool(force_regenerate_rowsetid_on_start_error); #ifdef BE_TEST // test s3 diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h index b6e336722f3..c38b253c6cd 100644 --- a/be/src/olap/olap_common.h +++ b/be/src/olap/olap_common.h @@ -34,6 +34,7 @@ #include <unordered_map> #include <unordered_set> +#include "common/config.h" #include "io/io_common.h" #include "olap/olap_define.h" #include "olap/rowset/rowset_fwd.h" @@ -396,6 +397,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 @@ -414,7 +417,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..9e0a7976c2e 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()->get_storage_engine()->next_rowset_id(); +} + UniqueRowsetIdGenerator::UniqueRowsetIdGenerator(const UniqueId& backend_uid) : _backend_uid(backend_uid), _inc_id(1) {} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org