dbms: FETCH PARTITION: development [#METR-13153].

This commit is contained in:
Alexey Milovidov 2014-10-13 22:01:58 +04:00
parent 21383c5475
commit 5fc32bb267
3 changed files with 7 additions and 2 deletions

View File

@ -264,6 +264,7 @@ namespace ErrorCodes
NO_ACTIVE_REPLICAS, NO_ACTIVE_REPLICAS,
TOO_MUCH_RETRIES_TO_FETCH_PARTS, TOO_MUCH_RETRIES_TO_FETCH_PARTS,
PARTITION_ALREADY_EXISTS, PARTITION_ALREADY_EXISTS,
PARTITION_DOESNT_EXIST,
POCO_EXCEPTION = 1000, POCO_EXCEPTION = 1000,
STD_EXCEPTION, STD_EXCEPTION,

View File

@ -73,7 +73,8 @@ MergeTreeData::MutableDataPartPtr ReplicatedMergeTreePartsFetcher::fetchPart(
std::make_pair("compress", "false")}; std::make_pair("compress", "false")};
ReadBufferFromHTTP in(host, port, params); ReadBufferFromHTTP in(host, port, params);
String part_path = data.getFullPath() + (to_detached ? "detached/" : "") + "tmp_" + part_name + "/"; String full_part_name = String(to_detached ? "detached/" : "") + "tmp_" + part_name;
String part_path = data.getFullPath() + full_part_name + "/";
Poco::File part_file(part_path); Poco::File part_file(part_path);
if (part_file.exists()) if (part_file.exists())
@ -85,7 +86,7 @@ MergeTreeData::MutableDataPartPtr ReplicatedMergeTreePartsFetcher::fetchPart(
part_file.createDirectory(); part_file.createDirectory();
MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared<MergeTreeData::DataPart>(data); MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared<MergeTreeData::DataPart>(data);
new_data_part->name = "tmp_" + part_name; new_data_part->name = full_part_name;
new_data_part->is_temp = true; new_data_part->is_temp = true;
size_t files; size_t files;

View File

@ -2945,6 +2945,9 @@ void StorageReplicatedMergeTree::fetchPartition(const Field & partition, bool un
parts_to_fetch_partition.push_back(part); parts_to_fetch_partition.push_back(part);
parts_to_fetch = std::move(parts_to_fetch_partition); parts_to_fetch = std::move(parts_to_fetch_partition);
if (parts_to_fetch.empty())
throw Exception("Partition " + partition_str + " on " + best_replica_path + " doesn't exist", ErrorCodes::PARTITION_DOESNT_EXIST);
} }
else else
{ {