It hurts if server has millions of tables.

See https://github.com/ClickHouse/ClickHouse/pull/3398
Please add some tests to ensure it won't be broken in future.
{
    String table_metadata_path = getObjectMetadataPath(table_name);
    String table_metadata_path_drop = table_metadata_path + drop_suffix;
    String table_data_path_relative = getTableDataPath(table_name);
    assert(!table_data_path_relative.empty());
    StoragePtr table = detachTable(table_name);
    bool renamed = false;
    try
    {
        Poco::File(table_metadata_path).renameTo(table_metadata_path_drop);
        renamed = true;
        table->drop();
        table->is_dropped = true;
        Poco::File table_data_dir{context.getPath() + table_data_path_relative};
        if (table_data_dir.exists())
            table_data_dir.remove(true);
    }
    catch (...)
    {
        LOG_WARNING(log, getCurrentExceptionMessage(__PRETTY_FUNCTION__));
        attachTable(table_name, table, table_data_path_relative);
        if (renamed)
            Poco::File(table_metadata_path_drop).renameTo(table_metadata_path);
        throw;
    }
    Poco::File(table_metadata_path_drop).remove();
}
void DatabaseOnDisk::renameTable(