Fix memory tracking for merges and mutations (by destroying earlier)

It fixes only some tiny allocations, and so it should not affect any
huge mutations/merges.

And plus, this should not be a real fix, since peak_memory_usage is
obtained before even destrying this objects, and destroing objects will
unlikely update peak memory usage (although it is possible).

v0: do this in dtors
v2: do this earlier
This commit is contained in:
Azat Khuzhin 2021-10-04 01:41:35 +03:00
parent e4b39ca99c
commit fd38cbb0df
3 changed files with 3 additions and 0 deletions

View File

@ -87,6 +87,7 @@ void MergePlainMergeTreeTask::prepare()
write_part_log = [this] (const ExecutionStatus & execution_status)
{
merge_task.reset();
storage.writePartLog(
PartLogElement::MERGE_PARTS,
execution_status,

View File

@ -40,6 +40,7 @@ void MutatePlainMergeTreeTask::prepare()
write_part_log = [this] (const ExecutionStatus & execution_status)
{
mutate_task.reset();
storage.writePartLog(
PartLogElement::MUTATE_PART,
execution_status,

View File

@ -985,6 +985,7 @@ private:
ctx->mutating_pipeline.reset();
static_pointer_cast<MergedBlockOutputStream>(ctx->out)->writeSuffixAndFinalizePart(ctx->new_data_part, ctx->need_sync);
ctx->out.reset();
}
enum class State