From 1f88e631065a51febca6aac2c35c0d0efa79f103 Mon Sep 17 00:00:00 2001 From: Yukang-Lian Date: Fri, 27 Dec 2024 10:25:54 +0800 Subject: [PATCH 1/3] 1 --- be/src/olap/olap_common.h | 4 +--- be/src/olap/rowset/unique_rowset_id_generator.cpp | 9 --------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h index a83e6a6df63e1a..cd7d3961871ced 100644 --- a/be/src/olap/olap_common.h +++ b/be/src/olap/olap_common.h @@ -420,8 +420,6 @@ using ColumnId = uint32_t; using UniqueIdSet = std::set; // Column unique Id -> column id map using UniqueIdToColumnIdMap = std::map; -struct RowsetId; -RowsetId next_rowset_id(); // 8 bit rowset id version // 56 bit, inc number from 1 @@ -442,7 +440,7 @@ struct RowsetId { if (ec != std::errc {}) [[unlikely]] { if (config::force_regenerate_rowsetid_on_start_error) { LOG(WARNING) << "failed to init rowset id: " << rowset_id_str; - high = next_rowset_id().hi; + high = MAX_ROWSET_ID - 1; } else { throw Exception( Status::FatalError("failed to init rowset id: {}", rowset_id_str)); diff --git a/be/src/olap/rowset/unique_rowset_id_generator.cpp b/be/src/olap/rowset/unique_rowset_id_generator.cpp index 49e07e5835957a..0ac7f63837a099 100644 --- a/be/src/olap/rowset/unique_rowset_id_generator.cpp +++ b/be/src/olap/rowset/unique_rowset_id_generator.cpp @@ -17,17 +17,8 @@ #include "olap/rowset/unique_rowset_id_generator.h" -#include - -#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) {} From 7b12d16fa5c31c7aa1a328c32d309dc5db79dcdd Mon Sep 17 00:00:00 2001 From: Yukang-Lian Date: Fri, 27 Dec 2024 11:07:04 +0800 Subject: [PATCH 2/3] 2 --- be/test/olap/rowset/rowset_meta_test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/be/test/olap/rowset/rowset_meta_test.cpp b/be/test/olap/rowset/rowset_meta_test.cpp index 881ce383810e3c..d0fbb61cacb88f 100644 --- a/be/test/olap/rowset/rowset_meta_test.cpp +++ b/be/test/olap/rowset/rowset_meta_test.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -113,4 +114,13 @@ TEST_F(RowsetMetaTest, TestInitWithInvalidData) { EXPECT_FALSE(rowset_meta.init("invalid pb meta data")); } +TEST_F(RowsetMetaTest, TestRowsetIdInit) { + RowsetId id{}; + config::force_regenerate_rowsetid_on_start_error = true; + std::string_view rowset_id_str = "test"; + id.init(rowset_id_str); + // 0x100000000000000 - 0x01 + EXPECT_EQ(id.to_string(), "72057594037927935"); +} + } // namespace doris From f123b37324b8cfd79afa4a81a62f5f359f75d27d Mon Sep 17 00:00:00 2001 From: Yukang-Lian Date: Fri, 27 Dec 2024 11:10:17 +0800 Subject: [PATCH 3/3] 3 --- be/test/olap/rowset/rowset_meta_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/test/olap/rowset/rowset_meta_test.cpp b/be/test/olap/rowset/rowset_meta_test.cpp index d0fbb61cacb88f..cb1b2865c1440e 100644 --- a/be/test/olap/rowset/rowset_meta_test.cpp +++ b/be/test/olap/rowset/rowset_meta_test.cpp @@ -115,7 +115,7 @@ TEST_F(RowsetMetaTest, TestInitWithInvalidData) { } TEST_F(RowsetMetaTest, TestRowsetIdInit) { - RowsetId id{}; + RowsetId id {}; config::force_regenerate_rowsetid_on_start_error = true; std::string_view rowset_id_str = "test"; id.init(rowset_id_str);