Skip to content
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

Merged
merged 19 commits into from
Aug 6, 2018

Conversation

VadimPlh
Copy link
Contributor

@VadimPlh VadimPlh commented Aug 1, 2018

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

@@ -129,6 +129,20 @@ bool StorageMergeTree::checkTableCanBeDropped() const
return true;
}

bool StorageMergeTree::checkPartitionCanBeDroppedDetachReplace(const ASTPtr & partition)
{
const_cast<MergeTreeData &>(getData()).recalculateColumnSizes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


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"
Copy link
Member

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);
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@alexey-milovidov alexey-milovidov merged commit 0ef2a94 into ClickHouse:master Aug 6, 2018
@alexey-milovidov
Copy link
Member

You forgot about config.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants