mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-30 05:30:51 +00:00
fix drop with memory engine
This commit is contained in:
parent
fd4638aa64
commit
fafbd2b188
@ -94,18 +94,19 @@ BlockIO InterpreterDropQuery::executeToTable(String & database_name_, String & t
|
||||
const auto prev_metadata_name = database_and_table.first->getMetadataPath() + escapeForFileName(database_and_table.second->getTableName()) + ".sql";
|
||||
const auto drop_metadata_name = database_and_table.first->getMetadataPath() + escapeForFileName(database_and_table.second->getTableName()) + ".sql.tmp_drop";
|
||||
|
||||
//Try to rename metadata file and delete the data
|
||||
try
|
||||
{
|
||||
//Memory database has no metadata on disk
|
||||
if (database_and_table.first->getEngineName() != "Memory")
|
||||
Poco::File(prev_metadata_name).renameTo(drop_metadata_name);
|
||||
/// Delete table data
|
||||
database_and_table.second->drop();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (database_and_table.first->getEngineName() != "Memory")
|
||||
Poco::File(drop_metadata_name).renameTo(prev_metadata_name);
|
||||
} catch (...) {}
|
||||
throw;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user