Before ObBlockManager::first_mark_device is executed, the tmp file does not exec the flushing task.

This commit is contained in:
obdev 2024-09-24 13:15:58 +00:00 committed by ob-robot
parent 2bbdfaad57
commit 2a3b4285d8
5 changed files with 16 additions and 3 deletions

View File

@ -15,6 +15,7 @@
#include "storage/tmp_file/ob_tmp_file_thread_wrapper.h"
#include "share/ob_thread_mgr.h"
#include "storage/blocksstable/ob_block_manager.h"
#include "storage/meta_store/ob_server_storage_meta_service.h"
#include "storage/tmp_file/ob_tmp_file_page_cache_controller.h"
#include "storage/tmp_file/ob_sn_tmp_file_manager.h"
@ -243,7 +244,9 @@ int64_t ObTmpFileFlushTG::cal_idle_time()
{
int64_t idle_time = 0;
int64_t dirty_page_percentage = wbp_.get_dirty_page_percentage();
if (!wait_list_.is_empty() || !retry_list_.is_empty() || !finished_list_.is_empty()
if (OB_UNLIKELY(!SERVER_STORAGE_META_SERVICE.is_started())) {
idle_time = ObTmpFilePageCacheController::FLUSH_INTERVAL;
} else if (!wait_list_.is_empty() || !retry_list_.is_empty() || !finished_list_.is_empty()
|| ObTmpFileFlushManager::FLUSH_WATERMARK_F1 <= dirty_page_percentage) {
idle_time = ObTmpFilePageCacheController::FLUSH_FAST_INTERVAL;
} else if (RUNNING_MODE::FAST == mode_) {
@ -265,7 +268,11 @@ int ObTmpFileFlushTG::try_work()
int64_t cur_time = ObTimeUtility::current_monotonic_time();
if (0 == last_flush_timestamp_ || cur_time - last_flush_timestamp_ >= cal_idle_time() * 1000) {
if (OB_FAIL(do_work_())) {
if (OB_UNLIKELY(!SERVER_STORAGE_META_SERVICE.is_started())) {
ret = OB_NOT_RUNNING;
LOG_INFO("ObTmpFileFlushTG does not work before server slog replay finished",
KR(ret), KPC(this));
} else if (OB_FAIL(do_work_())) {
STORAGE_LOG(WARN, "fail do flush", KR(ret), KPC(this));
}
last_flush_timestamp_ = ObTimeUtility::current_monotonic_time();
@ -874,7 +881,9 @@ void ObTmpFileSwapTG::notify_doing_swap()
int64_t ObTmpFileSwapTG::cal_idle_time()
{
int64_t swap_idle_time = ObTmpFilePageCacheController::SWAP_INTERVAL;
if (ATOMIC_LOAD(&swap_job_num_) != 0 || ATOMIC_LOAD(&working_list_size_) != 0) {
if (OB_UNLIKELY(!SERVER_STORAGE_META_SERVICE.is_started())) {
swap_idle_time = ObTmpFilePageCacheController::SWAP_INTERVAL;
} else if (ATOMIC_LOAD(&swap_job_num_) != 0 || ATOMIC_LOAD(&working_list_size_) != 0) {
if (flush_io_finished_round_ < flush_tg_ref_.get_flush_io_finished_round()) {
swap_idle_time = 0;
} else {

View File

@ -47,6 +47,7 @@ public:
OB_SYS_TENANT_ID);
ASSERT_EQ(OB_SUCCESS, ret);
int s = (int)time(NULL);
SERVER_STORAGE_META_SERVICE.is_started_ = true;
LOG_INFO("initial setup random seed", K(s));
srandom(s);
}

View File

@ -104,6 +104,7 @@ public:
ASSERT_EQ(OB_SUCCESS, rs_.alloc_dir_id());
memset(str_buf_, 'z', BUF_SIZE);
SERVER_STORAGE_META_SERVICE.is_started_ = true;
LOG_WARN("setup finished", K_(row));
}

View File

@ -205,6 +205,7 @@ void TestDataBlockWriter::SetUp()
tenant_ctx.set(tf_mgr);
ObTenantEnv::set_tenant(&tenant_ctx);
SERVER_STORAGE_META_SERVICE.is_started_ = true;
}
void TestDataBlockWriter::TearDown()

View File

@ -206,6 +206,7 @@ void TestParallelExternalSort::SetUp()
tenant_ctx.set(tf_mgr);
ObTenantEnv::set_tenant(&tenant_ctx);
SERVER_STORAGE_META_SERVICE.is_started_ = true;
}
void TestParallelExternalSort::TearDown()