-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLICKHOUSE-3714 add max_partition_size_to_drop #2782
Conversation
@@ -129,6 +129,20 @@ bool StorageMergeTree::checkTableCanBeDropped() const | |||
return true; | |||
} | |||
|
|||
bool StorageMergeTree::checkPartitionCanBeDroppedDetachReplace(const ASTPtr & partition) | |||
{ | |||
const_cast<MergeTreeData &>(getData()).recalculateColumnSizes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
dbms/src/Interpreters/Context.cpp
Outdated
|
||
ostr << "Partition in table " << backQuoteIfNeed(database) << "." << backQuoteIfNeed(table) << " was not dropped.\n" | ||
<< "Reason:\n" | ||
<< "1. Partition size (" << partition_size_str << ") is greater than max_table_size_to_drop (" << max_partition_size_to_drop_str << ")\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
table->checkPartitionCanBeDropped(command.partition); | ||
String from_database = command.from_database.empty() ? context.getCurrentDatabase() : command.from_database; | ||
auto from_storage = context.getTable(from_database, command.from_table); | ||
table->replacePartitionFrom(from_storage, command.partition, command.replace, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
const String partition_id = data.getPartitionIDFromQuery(partition, context); | ||
auto parts_to_remove = data.getDataPartsVectorInPartition(MergeTreeDataPartState::Committed, partition_id); | ||
|
||
for (const auto & part : parts_to_remove) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partition is a set of parts. And the size of partition must be considered in total.
const String partition_id = data.getPartitionIDFromQuery(partition, context); | ||
auto parts_to_remove = data.getDataPartsVectorInPartition(MergeTreeDataPartState::Committed, partition_id); | ||
|
||
for (const auto & part : parts_to_remove) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
You forgot about config.xml |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en