Check slog disk during restart
This commit is contained in:
@ -228,20 +228,22 @@ int TestDataFilePrepareUtil::open()
|
||||
} else if (0 != system(cmd)) {
|
||||
ret = OB_ERR_SYS;
|
||||
STORAGE_LOG(ERROR, "failed to exec cmd", K(ret), K(cmd), K(errno), KERRMSG);
|
||||
} else if (OB_FAIL(SLOGGERMGR.init(storage_env_.log_spec_.log_dir_,
|
||||
storage_env_.log_spec_.max_log_file_size_, storage_env_.slog_file_spec_))) {
|
||||
STORAGE_LOG(WARN, "ObStorageLoggerManager init failed", KR(ret));
|
||||
} else if (OB_FAIL(ObKVGlobalCache::get_instance().init(getter_,
|
||||
bucket_num,
|
||||
max_cache_size,
|
||||
block_size))) {
|
||||
STORAGE_LOG(WARN, "failed to init kv cache", K(ret));
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(clog_dir_))) {
|
||||
STORAGE_LOG(WARN, "failed to create clog dir", K(ret), K(clog_dir_));
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(slog_dir_))) {
|
||||
STORAGE_LOG(WARN, "failed to create slog dir", K(ret), K(slog_dir_));
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(file_dir_))) {
|
||||
STORAGE_LOG(WARN, "failed to create file dir", K(ret), K(file_dir_));
|
||||
} else if (OB_FAIL(SLOGGERMGR.init(storage_env_.log_spec_.log_dir_,
|
||||
storage_env_.log_spec_.log_dir_,
|
||||
storage_env_.log_spec_.max_log_file_size_, storage_env_.slog_file_spec_))) {
|
||||
STORAGE_LOG(WARN, "ObStorageLoggerManager init failed", KR(ret));
|
||||
} else if (FALSE_IT(SLOGGERMGR.need_reserved_ = false)) {
|
||||
} else if (OB_FAIL(ObKVGlobalCache::get_instance().init(getter_,
|
||||
bucket_num,
|
||||
max_cache_size,
|
||||
block_size))) {
|
||||
STORAGE_LOG(WARN, "failed to init kv cache", K(ret));
|
||||
} else if (disk_num_ > 0) {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < disk_num_; ++i) {
|
||||
if (OB_FAIL(databuff_printf(dirname, sizeof(dirname), "%s/%ld", data_dir_, i))) {
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
log_file_spec_.retry_write_policy_ = "normal";
|
||||
log_file_spec_.log_create_policy_ = "normal";
|
||||
log_file_spec_.log_write_policy_ = "truncate";
|
||||
if (OB_FAIL(SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_))) {
|
||||
if (OB_FAIL(SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_))) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ void TestStorageLogRW::SetUp()
|
||||
TestDataFilePrepare::SetUp();
|
||||
FileDirectoryUtils::create_full_path("./test_storage_log_read_write");
|
||||
SLOGGERMGR.destroy();
|
||||
SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
|
||||
ObStorageLogger *tmp_slogger = OB_NEW(ObStorageLogger, ObModIds::TEST);
|
||||
ASSERT_EQ(OB_SUCCESS, tmp_slogger->init(SLOGGERMGR, OB_SERVER_TENANT_ID));
|
||||
|
||||
@ -72,7 +72,7 @@ void TestStorageLogReplay::SetUp()
|
||||
TestDataFilePrepare::TearDown();
|
||||
TestDataFilePrepare::SetUp();
|
||||
FileDirectoryUtils::create_full_path("./test_storage_log_replay");
|
||||
SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
}
|
||||
|
||||
void TestStorageLogReplay::TearDown()
|
||||
|
||||
@ -86,11 +86,12 @@ TEST_F(TestStorageLoggerManager, test_manager_basic)
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
// test invalid init
|
||||
ret = SLOGGERMGR.init(nullptr, MAX_FILE_SIZE, log_file_spec_);
|
||||
ret = SLOGGERMGR.init(nullptr, nullptr, MAX_FILE_SIZE, log_file_spec_);
|
||||
ASSERT_NE(OB_SUCCESS, ret);
|
||||
// test normal init
|
||||
ret = SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
ret = SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(SLOGGERMGR.need_reserved_);
|
||||
ASSERT_EQ(MAX_CONCURRENT_ITEM_CNT, SLOGGERMGR.log_buffers_.capacity());
|
||||
ASSERT_EQ(MAX_CONCURRENT_ITEM_CNT, SLOGGERMGR.slog_items_.capacity());
|
||||
|
||||
@ -131,7 +132,7 @@ TEST_F(TestStorageLoggerManager, test_slogger_basic)
|
||||
cursor.log_id_ = 5;
|
||||
cursor.offset_ = 500;
|
||||
|
||||
SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
|
||||
ObStorageLogger *tmp_slogger = OB_NEW(ObStorageLogger, ObModIds::TEST);
|
||||
ASSERT_EQ(OB_SUCCESS, tmp_slogger->init(SLOGGERMGR, 500));
|
||||
@ -184,7 +185,7 @@ TEST_F (TestStorageLoggerManager, test_build_item)
|
||||
ObTenantBase tenant_base(5);
|
||||
ObTenantEnv::set_tenant(&tenant_base);
|
||||
ASSERT_EQ(OB_SUCCESS, tenant_base.init());
|
||||
SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
|
||||
ObStorageLogger *tmp_slogger = OB_NEW(ObStorageLogger, ObModIds::TEST);
|
||||
ASSERT_EQ(OB_SUCCESS, tmp_slogger->init(SLOGGERMGR, 500));
|
||||
|
||||
@ -102,7 +102,7 @@ void TestTabletCreateMemtable::SetUp()
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
ObStorageLogger *slogger = nullptr;
|
||||
SLOGGERMGR.init(dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
SLOGGERMGR.init(dir_, dir_, MAX_FILE_SIZE, log_file_spec_);
|
||||
SLOGGERMGR.register_tenant(1);
|
||||
ret = SLOGGERMGR.get_tenant_storage_logger(1, slogger);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
Reference in New Issue
Block a user