Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Sep 21, 2023
1 parent fd642de commit 2c512fd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion be/src/olap/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ Status StorageEngine::_persist_broken_paths() {

if (config_value.length() > 0) {
auto st = config::set_config("broken_storage_path", config_value, true);
LOG(INFO) << "persist broken_store_path " << config_value << st;
LOG(INFO) << "persist broken_storae_path " << config_value << st;
return st;
}

Expand Down
1 change: 1 addition & 0 deletions be/test/common/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ using namespace config;

class ConfigTest : public testing::Test {
void SetUp() override { config::Register::_s_field_map->clear(); }
void TearDown() override { config::Register::_s_field_map->clear(); }
};

TEST_F(ConfigTest, DumpAllConfigs) {
Expand Down
11 changes: 7 additions & 4 deletions be/test/olap/storage_engine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ using ::testing::SetArgPointee;
using std::string;

namespace doris {
using namespace config;

class StorageEngineTest : public testing::Test {
public:
Expand All @@ -49,37 +50,39 @@ class StorageEngineTest : public testing::Test {
};

TEST_F(StorageEngineTest, TestBrokenDisk) {
DEFINE_mString(broken_storage_path, "");
std::string path = config::custom_config_dir + "/be_custom.conf";

std::error_code ec;
{
_storage_engine->add_broken_path("broken_path1");
EXPECT_EQ(std::filesystem::exists(path, ec), true);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path1"), 1);
EXPECT_EQ(config::broken_storage_path, "broken_path1;");
EXPECT_EQ(broken_storage_path, "broken_path1;");
}

{
_storage_engine->add_broken_path("broken_path2");
EXPECT_EQ(std::filesystem::exists(path, ec), true);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path1"), 1);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path2"), 1);
EXPECT_EQ(config::broken_storage_path, "broken_path1;broken_path2;");
EXPECT_EQ(broken_storage_path, "broken_path1;broken_path2;");
}

{
_storage_engine->add_broken_path("broken_path2");
EXPECT_EQ(std::filesystem::exists(path, ec), true);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path1"), 1);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path2"), 1);
EXPECT_EQ(config::broken_storage_path, "broken_path1;broken_path2;");
EXPECT_EQ(broken_storage_path, "broken_path1;broken_path2;");
}

{
_storage_engine->remove_broken_path("broken_path2");
EXPECT_EQ(std::filesystem::exists(path, ec), true);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path1"), 1);
EXPECT_EQ(_storage_engine->get_broken_paths().count("broken_path2"), 0);
EXPECT_EQ(config::broken_storage_path, "broken_path1;");
EXPECT_EQ(broken_storage_path, "broken_path1;");
}
}

Expand Down
4 changes: 3 additions & 1 deletion be/test/testutil/run_all_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 10, 0));
doris::ExecEnv::GetInstance()->set_segment_loader(new doris::SegmentLoader(1000));
std::string conf = std::string(getenv("DORIS_HOME")) + "/conf/be.conf";
doris::config::init(conf.c_str(), false);
auto st = doris::config::init(conf.c_str(), false);
LOG(INFO) << "init config " << st;

doris::init_glog("be-test");
::testing::InitGoogleTest(&argc, argv);
doris::CpuInfo::init();
Expand Down

0 comments on commit 2c512fd

Please sign in to comment.