From af300c667b51dd0753d4d5556a2af325d6ba11a0 Mon Sep 17 00:00:00 2001 From: Igor Mineev Date: Sat, 11 May 2019 23:44:43 +0300 Subject: [PATCH] Bugfix --- dbms/src/Storages/MergeTree/DataPartsExchange.cpp | 5 +++-- dbms/src/Storages/MergeTree/DiskSpaceMonitor.h | 2 +- dbms/src/Storages/MergeTree/MergeTreeData.cpp | 7 +++---- dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp | 6 +++--- dbms/src/Storages/MergeTree/MergeTreeDataWriter.cpp | 3 ++- dbms/src/Storages/StorageMergeTree.cpp | 2 +- dbms/src/Storages/System/StorageSystemTables.cpp | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dbms/src/Storages/MergeTree/DataPartsExchange.cpp b/dbms/src/Storages/MergeTree/DataPartsExchange.cpp index e0ca9adffcb..a91cc8823c9 100644 --- a/dbms/src/Storages/MergeTree/DataPartsExchange.cpp +++ b/dbms/src/Storages/MergeTree/DataPartsExchange.cpp @@ -201,7 +201,7 @@ MergeTreeData::MutableDataPartPtr Fetcher::fetchPart( String relative_part_path = String(to_detached ? "detached/" : "") + tmp_prefix + part_name; auto reservation = data.reserveSpaceForPart(0); ///@TODO_IGR ASK What size should be there? - String part_path = data.getFullPathOnDisk(reservation->getDisk2()); + String part_path = data.getFullPathOnDisk(reservation->getDisk()); String absolute_part_path = part_path + relative_part_path + "/"; Poco::File part_file(absolute_part_path); @@ -212,7 +212,8 @@ MergeTreeData::MutableDataPartPtr Fetcher::fetchPart( part_file.createDirectory(); - MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared(data, reservation->getDisk2(), part_name); + MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared(data, + reservation->getDisk(), part_name); new_data_part->relative_path = relative_part_path; new_data_part->is_temp = true; diff --git a/dbms/src/Storages/MergeTree/DiskSpaceMonitor.h b/dbms/src/Storages/MergeTree/DiskSpaceMonitor.h index 439861cdc27..03c031d318c 100644 --- a/dbms/src/Storages/MergeTree/DiskSpaceMonitor.h +++ b/dbms/src/Storages/MergeTree/DiskSpaceMonitor.h @@ -157,7 +157,7 @@ public: return size; } - const DiskPtr & getDisk2() const ///@TODO_IGR rename + const DiskPtr & getDisk() const ///@TODO_IGR rename { return disk_ptr; } diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index 1abd76b2ab9..71aaef053e6 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -766,8 +766,6 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks) { LOG_DEBUG(log, "Loading data parts"); - const auto full_paths = getDataPaths(); - std::vector> part_names_with_disks; Poco::DirectoryIterator end; @@ -2804,7 +2802,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::cloneAndLoadDataPart(const Merg String tmp_dst_part_name = tmp_part_prefix + dst_part_name; auto reservation = reserveSpaceForPart(src_part->bytes_on_disk); - String dst_part_path = getFullPathOnDisk(reservation->getDisk2()); + String dst_part_path = getFullPathOnDisk(reservation->getDisk()); Poco::Path dst_part_absolute_path = Poco::Path(dst_part_path + tmp_dst_part_name).absolute(); Poco::Path src_part_absolute_path = Poco::Path(src_part->getFullPath()).absolute(); @@ -2814,7 +2812,8 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::cloneAndLoadDataPart(const Merg LOG_DEBUG(log, "Cloning part " << src_part_absolute_path.toString() << " to " << dst_part_absolute_path.toString()); localBackup(src_part_absolute_path, dst_part_absolute_path); - MergeTreeData::MutableDataPartPtr dst_data_part = std::make_shared(*this, reservation->getDisk2(), dst_part_name, dst_part_info); + MergeTreeData::MutableDataPartPtr dst_data_part = std::make_shared(*this, + reservation->getDisk(), dst_part_name, dst_part_info); dst_data_part->relative_path = tmp_dst_part_name; dst_data_part->is_temp = true; diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp index e19a89c4581..70167cb5d16 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp @@ -528,7 +528,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mergePartsToTempor << parts.front()->name << " to " << parts.back()->name << " into " << TMP_PREFIX + future_part.name); - String part_path = data.getFullPathOnDisk(disk_reservation->getDisk2()); + String part_path = data.getFullPathOnDisk(disk_reservation->getDisk()); String new_part_tmp_path = part_path + TMP_PREFIX + future_part.name + "/"; if (Poco::File(new_part_tmp_path).exists()) throw Exception("Directory " + new_part_tmp_path + " already exists", ErrorCodes::DIRECTORY_ALREADY_EXISTS); @@ -547,7 +547,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mergePartsToTempor data.merging_params, gathering_columns, gathering_column_names, merging_columns, merging_column_names); MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared( - data, disk_reservation->getDisk2(), future_part.name, future_part.part_info); + data, disk_reservation->getDisk(), future_part.name, future_part.part_info); new_data_part->partition.assign(future_part.getPartition()); new_data_part->relative_path = TMP_PREFIX + future_part.name; new_data_part->is_temp = true; @@ -902,7 +902,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mutatePartToTempor LOG_TRACE(log, "Mutating part " << source_part->name << " to mutation version " << future_part.part_info.mutation); MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared( - data, disk_reservation->getDisk2(), future_part.name, future_part.part_info); + data, disk_reservation->getDisk(), future_part.name, future_part.part_info); new_data_part->relative_path = "tmp_mut_" + future_part.name; new_data_part->is_temp = true; new_data_part->ttl_infos = source_part->ttl_infos; diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataWriter.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataWriter.cpp index 2a27ecb2826..c18d3cbd2d2 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataWriter.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataWriter.cpp @@ -201,7 +201,8 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataWriter::writeTempPart(BlockWithPa size_t expected_size = block.bytes(); auto reservation = data.reserveSpaceForPart(expected_size); ///@TODO_IGR ASK expected size - MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared(data, reservation->getDisk2(), part_name, new_part_info); + MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared(data, + reservation->getDisk(), part_name, new_part_info); new_data_part->partition = std::move(partition); new_data_part->minmax_idx = std::move(minmax_idx); new_data_part->relative_path = TMP_PREFIX + part_name; diff --git a/dbms/src/Storages/StorageMergeTree.cpp b/dbms/src/Storages/StorageMergeTree.cpp index daec5749dbe..915d91da2ad 100644 --- a/dbms/src/Storages/StorageMergeTree.cpp +++ b/dbms/src/Storages/StorageMergeTree.cpp @@ -335,7 +335,7 @@ public: void StorageMergeTree::mutate(const MutationCommands & commands, const Context &) { auto reservation = reserveSpaceForPart(0); ///@TODO_IGR ASK What expected size of mutated part? what size should we reserve? - MergeTreeMutationEntry entry(commands, getFullPathOnDisk(reservation->getDisk2()), insert_increment.get()); + MergeTreeMutationEntry entry(commands, getFullPathOnDisk(reservation->getDisk()), insert_increment.get()); String file_name; { std::lock_guard lock(currently_merging_mutex); diff --git a/dbms/src/Storages/System/StorageSystemTables.cpp b/dbms/src/Storages/System/StorageSystemTables.cpp index 5aef258750a..92f5bdda922 100644 --- a/dbms/src/Storages/System/StorageSystemTables.cpp +++ b/dbms/src/Storages/System/StorageSystemTables.cpp @@ -34,7 +34,7 @@ StorageSystemTables::StorageSystemTables(const std::string & name_) {"name", std::make_shared()}, {"engine", std::make_shared()}, {"is_temporary", std::make_shared()}, - {"data_path", std::make_shared()}, + {"data_paths", std::make_shared(std::make_shared())}, {"metadata_path", std::make_shared()}, {"metadata_modification_time", std::make_shared()}, {"dependencies_database", std::make_shared(std::make_shared())},