From 8afc21f7af15e106fd2734da55905aadcd1a4f73 Mon Sep 17 00:00:00 2001 From: Han Fei Date: Fri, 29 Sep 2023 18:20:16 +0200 Subject: [PATCH] refine --- src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp b/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp index 2acfceabd7d..3f0366a8612 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreeSink.cpp @@ -321,11 +321,12 @@ void ReplicatedMergeTreeSinkImpl::consume(Chunk chunk) if constexpr (async_insert) { - block_id = AsyncInsertBlockInfo::getHashesForBlocks(unmerged_block ? *unmerged_block : current_block, temp_part.part->info.partition_id); - if (unmerged_block) - LOG_TRACE(log, "async insert part, part id {}, block id {}, offsets {}, size {}", temp_part.part->info.partition_id, toString(block_id), toString(unmerged_block->offsets), unmerged_block->offsets.size()); - else - LOG_TRACE(log, "async insert part, part id {}, block id {}, offsets {}, size {}", temp_part.part->info.partition_id, toString(block_id), toString(current_block.offsets), current_block.offsets.size()); + auto get_block_id = [&](BlockWithPartition & block_) + { + block_id = AsyncInsertBlockInfo::getHashesForBlocks(block_, temp_part.part->info.partition_id); + LOG_TRACE(log, "async insert part, part id {}, block id {}, offsets {}, size {}", temp_part.part->info.partition_id, toString(block_id), toString(block_.offsets), block_.offsets.size()); + }; + get_block_id(unmerged_block ? *unmerged_block : current_block); } else {