From c4d519e51798c404d85fbf3d8e620852794b6250 Mon Sep 17 00:00:00 2001 From: xufei Date: Wed, 15 Feb 2023 12:30:01 +0800 Subject: [PATCH] refine spill log (#6821) ref pingcap/tiflash#6528 --- dbms/src/Core/Spiller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbms/src/Core/Spiller.cpp b/dbms/src/Core/Spiller.cpp index 1d791e0dfff..1dbed2b5264 100644 --- a/dbms/src/Core/Spiller.cpp +++ b/dbms/src/Core/Spiller.cpp @@ -110,6 +110,7 @@ BlockInputStreams Spiller::restoreBlocks(size_t partition_id, size_t max_stream_ { RUNTIME_CHECK_MSG(partition_id < partition_num, "{}: partition id {} exceeds partition num {}.", config.spill_id, partition_id, partition_num); RUNTIME_CHECK_MSG(spill_finished, "{}: restore before the spiller is finished.", config.spill_id); + std::lock_guard partition_lock(spilled_files[partition_id]->spilled_files_mutex); if (max_stream_size == 0) max_stream_size = spilled_files[partition_id]->spilled_files.size(); if (is_input_sorted && spilled_files[partition_id]->spilled_files.size() > max_stream_size) @@ -149,12 +150,12 @@ BlockInputStreams Spiller::restoreBlocks(size_t partition_id, size_t max_stream_ ret.push_back(std::make_shared(std::move(file_infos[i]), input_schema, config.file_provider, spill_version)); } } + LOG_INFO(logger, "Will restore {} rows from {} files of size {:.3f} MiB compressed, {:.3f} MiB uncompressed using {} streams.", details.rows, spilled_files[partition_id]->spilled_files.size(), (details.data_bytes_compressed / 1048576.0), (details.data_bytes_uncompressed / 1048576.0), ret.size()); if (release_spilled_file_on_restore) { /// clear the spilled_files so we can safely assume that the element in spilled_files is always not nullptr spilled_files[partition_id]->spilled_files.clear(); } - LOG_DEBUG(logger, "Will restore {} rows from file of size {:.3f} MiB compressed, {:.3f} MiB uncompressed.", details.rows, (details.data_bytes_compressed / 1048576.0), (details.data_bytes_uncompressed / 1048576.0)); if (ret.empty()) ret.push_back(std::make_shared(input_schema)); return ret;