fix setting of priamry index

This commit is contained in:
Anton Popov 2024-11-21 14:29:11 +00:00
parent 7881ae2286
commit 99916f85fc
2 changed files with 6 additions and 4 deletions

View File

@ -249,9 +249,6 @@ MergedBlockOutputStream::Finalizer MergedBlockOutputStream::finalizePartAsync(
new_part->rows_count = rows_count;
new_part->modification_time = time(nullptr);
if (auto computed_index = writer->releaseIndexColumns())
new_part->setIndex(std::move(*computed_index));
new_part->checksums = checksums;
new_part->setBytesOnDisk(checksums.getTotalSizeOnDisk());
new_part->setBytesUncompressedOnDisk(checksums.getTotalSizeUncompressedOnDisk());
@ -264,6 +261,9 @@ MergedBlockOutputStream::Finalizer MergedBlockOutputStream::finalizePartAsync(
new_part->index_granularity = std::move(new_index_granularity);
}
if (auto computed_index = writer->releaseIndexColumns())
new_part->setIndex(std::move(*computed_index));
/// In mutation, existing_rows_count is already calculated in PartMergerWriter
/// In merge situation, lightweight deleted rows was physically deleted, existing_rows_count equals rows_count
if (!new_part->existing_rows_count.has_value())

View File

@ -985,7 +985,6 @@ void finalizeMutatedPart(
new_data_part->rows_count = source_part->rows_count;
new_data_part->index_granularity = source_part->index_granularity;
new_data_part->setIndex(*source_part->getIndex());
new_data_part->minmax_idx = source_part->minmax_idx;
new_data_part->modification_time = time(nullptr);
@ -995,6 +994,9 @@ void finalizeMutatedPart(
new_data_part->index_granularity = std::move(new_index_granularity);
}
if (!new_data_part->storage.getPrimaryIndexCache())
new_data_part->setIndex(*source_part->getIndex());
/// Load rest projections which are hardlinked
bool noop;
new_data_part->loadProjections(false, false, noop, true /* if_not_loaded */);