From 0040f1c9ac65749248d351111a4eaf46cf718c0c Mon Sep 17 00:00:00 2001 From: shenyushi Date: Fri, 13 Dec 2024 12:40:52 +0800 Subject: [PATCH] Fix shutdown bug. --- python/restart_test/infinity_runner.py | 7 ++++++- src/storage/storage.cpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python/restart_test/infinity_runner.py b/python/restart_test/infinity_runner.py index 6cdcf4c808..f83489f3e0 100644 --- a/python/restart_test/infinity_runner.py +++ b/python/restart_test/infinity_runner.py @@ -137,6 +137,7 @@ def infinity_runner_decorator_factory( shutdown_out: bool = False, kill: bool = False, terminate_timeout: int = 60, + check_kill: bool = True ): def decorator(f): def wrapper(*args, **kwargs): @@ -150,7 +151,11 @@ def wrapper(*args, **kwargs): except Exception: if not shutdown_out: raise - infinity_runner.uninit(kill, terminate_timeout) + try: + infinity_runner.uninit(kill, terminate_timeout) + except Exception: + if check_kill: + raise return wrapper diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index 010db3edc9..415f98f2d6 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -294,6 +294,7 @@ Status Storage::AdminToWriter() { UnrecoverableError("Memory index tracer was initialized before."); } memory_index_tracer_ = MakeUnique(config_ptr_->MemIndexMemoryQuota(), new_catalog_.get(), txn_mgr_.get()); + cleanup_info_tracer_ = MakeUnique(); bg_processor_->Start(); @@ -634,7 +635,6 @@ Status Storage::SetStorageMode(StorageMode target_mode) { LOG_WARN(fmt::format("Set unchanged mode")); return Status::OK(); } - cleanup_info_tracer_ = MakeUnique(); switch (current_mode) { case StorageMode::kUnInitialized: { if (target_mode != StorageMode::kAdmin) { @@ -732,6 +732,7 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) { UnrecoverableError("Memory index tracer was initialized before."); } memory_index_tracer_ = MakeUnique(config_ptr_->MemIndexMemoryQuota(), new_catalog_.get(), txn_mgr_.get()); + cleanup_info_tracer_ = MakeUnique(); new_catalog_->StartMemoryIndexCommit(); new_catalog_->MemIndexRecover(buffer_mgr_.get(), system_start_ts);