From fd4ae0990ba3bbb00c3353c911d0c8df4ea7abe8 Mon Sep 17 00:00:00 2001 From: alesapin Date: Fri, 3 Feb 2023 21:07:34 +0100 Subject: [PATCH] Tiny fix --- src/Storages/MergeTree/DataPartStorageOnDiskBase.cpp | 1 + src/Storages/MergeTree/IMergeTreeDataPart.cpp | 8 ++++++++ src/Storages/MergeTree/IMergeTreeDataPart.h | 2 ++ src/Storages/MergeTree/MergeTreeData.cpp | 6 ------ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Storages/MergeTree/DataPartStorageOnDiskBase.cpp b/src/Storages/MergeTree/DataPartStorageOnDiskBase.cpp index 175df9b6e28..7a9f927ae0f 100644 --- a/src/Storages/MergeTree/DataPartStorageOnDiskBase.cpp +++ b/src/Storages/MergeTree/DataPartStorageOnDiskBase.cpp @@ -683,6 +683,7 @@ void DataPartStorageOnDiskBase::clearDirectory( request.emplace_back(fs::path(dir) / "default_compression_codec.txt", true); request.emplace_back(fs::path(dir) / "delete-on-destroy.txt", true); request.emplace_back(fs::path(dir) / "txn_version.txt", true); + request.emplace_back(fs::path(dir) / "metadata_version.txt", true); disk->removeSharedFiles(request, !can_remove_shared_data, names_not_to_remove); disk->removeDirectory(dir); diff --git a/src/Storages/MergeTree/IMergeTreeDataPart.cpp b/src/Storages/MergeTree/IMergeTreeDataPart.cpp index 3424ef5bf0a..5fb529ddf64 100644 --- a/src/Storages/MergeTree/IMergeTreeDataPart.cpp +++ b/src/Storages/MergeTree/IMergeTreeDataPart.cpp @@ -661,6 +661,7 @@ void IMergeTreeDataPart::appendFilesOfColumnsChecksumsIndexes(Strings & files, b appendFilesOfPartitionAndMinMaxIndex(files); appendFilesOfTTLInfos(files); appendFilesOfDefaultCompressionCodec(files); + appendFilesOfMetadataVersion(files); } if (!parent_part && include_projection) @@ -980,6 +981,11 @@ void IMergeTreeDataPart::appendFilesOfDefaultCompressionCodec(Strings & files) files.push_back(DEFAULT_COMPRESSION_CODEC_FILE_NAME); } +void IMergeTreeDataPart::appendFilesOfMetadataVersion(Strings & files) +{ + files.push_back(METADATA_VERSION_FILE_NAME); +} + CompressionCodecPtr IMergeTreeDataPart::detectDefaultCompressionCodec() const { /// In memory parts doesn't have any compression @@ -1346,6 +1352,8 @@ void IMergeTreeDataPart::loadColumns(bool require) setColumns(loaded_columns, infos, loaded_metadata_version); } + + /// Project part / part with project parts / compact part doesn't support LWD. bool IMergeTreeDataPart::supportLightweightDeleteMutate() const { diff --git a/src/Storages/MergeTree/IMergeTreeDataPart.h b/src/Storages/MergeTree/IMergeTreeDataPart.h index df83d138322..d706045c3fe 100644 --- a/src/Storages/MergeTree/IMergeTreeDataPart.h +++ b/src/Storages/MergeTree/IMergeTreeDataPart.h @@ -589,6 +589,8 @@ private: static void appendFilesOfDefaultCompressionCodec(Strings & files); + static void appendFilesOfMetadataVersion(Strings & files); + /// Found column without specific compression and return codec /// for this column with default parameters. CompressionCodecPtr detectDefaultCompressionCodec() const; diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index b35d58688d5..e569513914e 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -7536,11 +7536,6 @@ AlterConversions MergeTreeData::getAlterConversionsForPart(const MergeTreeDataPa /// and columns in storage. if (command.type == MutationCommand::Type::RENAME_COLUMN) { - if (!part_columns.has(command.column_name)) - continue; - - part_columns.rename(command.column_name, command.rename_to); - if (auto it = rename_map.find(command.column_name); it != rename_map.end()) { auto rename_source = it->second; @@ -7548,7 +7543,6 @@ AlterConversions MergeTreeData::getAlterConversionsForPart(const MergeTreeDataPa rename_map[command.rename_to] = rename_source; } - else rename_map[command.rename_to] = command.column_name; }