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 101ea8434b3 [Cherry-Pick](branch-2.1) Pick "[Fix](core) Fix null ptr 
introduced by #42949 (#46074)" (#53865)
101ea8434b3 is described below

commit 101ea8434b3e5aa725ec60734f0a8901e6923424
Author: abmdocrt <lianyuk...@selectdb.com>
AuthorDate: Sat Jul 26 22:48:03 2025 +0800

    [Cherry-Pick](branch-2.1) Pick "[Fix](core) Fix null ptr introduced by 
#42949 (#46074)" (#53865)
---
 be/src/olap/olap_common.h                         |  4 +---
 be/src/olap/rowset/unique_rowset_id_generator.cpp |  9 ---------
 be/test/olap/rowset/rowset_meta_test.cpp          | 10 ++++++++++
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h
index 044b7eb45d0..a930de46e91 100644
--- a/be/src/olap/olap_common.h
+++ b/be/src/olap/olap_common.h
@@ -423,8 +423,6 @@ 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
@@ -445,7 +443,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 {
                     LOG(FATAL) << "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 9e0a7976c2e..0ac7f63837a 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 <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) {}
 
diff --git a/be/test/olap/rowset/rowset_meta_test.cpp 
b/be/test/olap/rowset/rowset_meta_test.cpp
index 881ce383810..cb1b2865c14 100644
--- a/be/test/olap/rowset/rowset_meta_test.cpp
+++ b/be/test/olap/rowset/rowset_meta_test.cpp
@@ -21,6 +21,7 @@
 #include <gmock/gmock-matchers.h>
 #include <gtest/gtest-message.h>
 #include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
 
 #include <filesystem>
 #include <fstream>
@@ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to