Skip to content

Commit

Permalink
[fix](ut) fix SegmentTest and SegmentMoWTest asan core (apache#40287) (
Browse files Browse the repository at this point in the history
…apache#40622)

## Proposed changes

pick apache#40287
  • Loading branch information
zhannngchen authored Sep 10, 2024
1 parent d3dccbc commit 023317e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions be/test/olap/segcompaction_mow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace ErrorCode;

static const uint32_t MAX_PATH_LEN = 1024;
static const uint32_t TABLET_ID = 12345;
static StorageEngine* s_engine;
static StorageEngine* s_engine = nullptr;
static const std::string lTestDir = "./data_test/data/segcompaction_mow_test";

class SegCompactionMoWTest : public ::testing::TestWithParam<std::string> {
Expand Down Expand Up @@ -81,14 +81,17 @@ class SegCompactionMoWTest : public ::testing::TestWithParam<std::string> {
Status s = s_engine->open();
EXPECT_TRUE(s.ok()) << s.to_string();

s = ThreadPoolBuilder("SegCompactionTaskThreadPool")
.set_min_threads(config::segcompaction_num_threads)
.set_max_threads(config::segcompaction_num_threads)
.build(&s_engine->_seg_compaction_thread_pool);
EXPECT_TRUE(s.ok()) << s.to_string();

_data_dir = new DataDir(lTestDir, 1000000000);
static_cast<void>(_data_dir->init());
static_cast<void>(_data_dir->update_capacity());

EXPECT_TRUE(io::global_local_filesystem()->create_directory(lTestDir).ok());

s = s_engine->start_bg_threads();
EXPECT_TRUE(s.ok()) << s.to_string();
}

void TearDown() {
Expand Down
11 changes: 7 additions & 4 deletions be/test/olap/segcompaction_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace doris {
using namespace ErrorCode;

static const uint32_t MAX_PATH_LEN = 1024;
static StorageEngine* l_engine;
static StorageEngine* l_engine = nullptr;
static const std::string lTestDir = "./data_test/data/segcompaction_test";

class SegCompactionTest : public testing::Test {
Expand Down Expand Up @@ -80,14 +80,17 @@ class SegCompactionTest : public testing::Test {
Status s = l_engine->open();
EXPECT_TRUE(s.ok()) << s.to_string();

s = ThreadPoolBuilder("SegCompactionTaskThreadPool")
.set_min_threads(config::segcompaction_num_threads)
.set_max_threads(config::segcompaction_num_threads)
.build(&l_engine->_seg_compaction_thread_pool);
EXPECT_TRUE(s.ok()) << s.to_string();

_data_dir = new DataDir(lTestDir, 1000000000);
static_cast<void>(_data_dir->init());
static_cast<void>(_data_dir->update_capacity());

EXPECT_TRUE(io::global_local_filesystem()->create_directory(lTestDir).ok());

s = l_engine->start_bg_threads();
EXPECT_TRUE(s.ok()) << s.to_string();
}

void TearDown() {
Expand Down

0 comments on commit 023317e

Please sign in to comment.