Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix](core) Fix null ptr introduced by #42949 #46074

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions be/src/olap/olap_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,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
Expand All @@ -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));
Expand Down
9 changes: 0 additions & 9 deletions be/src/olap/rowset/unique_rowset_id_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()->storage_engine().next_rowset_id();
}

UniqueRowsetIdGenerator::UniqueRowsetIdGenerator(const UniqueId& backend_uid)
: _backend_uid(backend_uid), _inc_id(1) {}

Expand Down
10 changes: 10 additions & 0 deletions be/test/olap/rowset/rowset_meta_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Loading