For some reasons when we delete a MergeTree Part in atomic way something may go wrong - and leave the `delete_tmp_*` folder or it's part on disk. This may lead to a disk space consumption over time.

It's suggested to delete this folders at least at server start-up. Current solution with `clearOldTemporaryDirectories()` doesn't work because this method is called periodically from a thread without any locks or advisory on folders - it may cause the race conditions.
}
            /
            /
            /
            /
            candidate.before_aggregation = analysis_result.before_aggregation->clone();
            auto required_columns = candidate.before_aggregation->foldActionsByProjection(keys, sample_block_for_keys);
            /
            if (required_columns.empty() && (!keys.empty() && !candidate.before_aggregation->getRequiredColumns().empty()))
                return;
            if (analysis_result.optimize_aggregation_in_order)
                attach_aggregation_in_order_info();
            /
            candidate.before_aggregation->reorderAggregationKeysForProjection(key_name_pos_map);
            candidate.before_aggregation->addAggregatesViaProjection(aggregates);
            /
            if (minmax_count_projection)
                candidate.required_columns = {required_columns.begin(), required_columns.end()};
            if (rewrite_before_where(candidate, projection, required_columns, sample_block_for_keys, aggregates))
            {
                if (minmax_count_projection)
                {
                    candidate.before_where = nullptr;
                    candidate.prewhere_info = nullptr;
                }
                else
                    candidate.required_columns = {required_columns.begin(), required_columns.end()};
                for (const auto & aggregate : aggregates)
                    candidate.required_columns.push_back(aggregate.name);
                candidates.push_back(std::move(candidate));