**Describe the bug**

Can't rename distributed table and move it from Ordinary to Atomic database

**How to reproduce**

```
CREATE DATABASE atomic_database ON CLUSTER cluster_name ENGINE = Atomic
```
```
CREATE DATABASE ordinary_database ON CLUSTER cluster_name ENGINE = Ordinary
```

```
CREATE TABLE ordinary_database.t ON CLUSTER cluster_name
...
ENGINE = ReplicatedMergeTree(...)
...
```

```
CREATE TABLE ordinary_database.distributed_table ON CLUSTER cluster_name AS ordinary_database.t 
ENGINE = Distributed(cluster_name, ordinary_database, t)
```

```
RENAME TABLE ordinary_database.distributed_table TO atomic_database.distributed_table

Query id: 7bd2101e-f78a-4584-8374-6e44a0bbf23f


0 rows in set. Elapsed: 0.011 sec.

Received exception from server (version 21.5.6):
Code: 1000. DB::Exception: Received from clickhouse-server:9000. DB::Exception: File not found: /var/lib/clickhouse/data/ordinary_database/distributed_table.
```
But 
```
ls -lh /var/lib/clickhouse/data/ordinary_database
total 0
drwxr-x---  2 ...  staff    64B Jun  4 18:19 distributed_table
drwxr-x---  4 ...  staff   128B Jun  4 18:18 t
```

**Does it reproduce on recent release?**
Checked on 21.5.6.6 version


**Expected behavior**

For example, renaming _Views_ works perfectly. I expect the same from the _Distributed_ table

}
    const Scalars & scalars = local_context->hasQueryContext() ? local_context->getQueryContext()->getScalars() : Scalars{};
    bool has_virtual_shard_num_column = std::find(column_names.begin(), column_names.end(), "_shard_num") != column_names.end();
    if (has_virtual_shard_num_column && !isVirtualColumn("_shard_num", metadata_snapshot))
        has_virtual_shard_num_column = false;
    ClusterProxy::SelectStreamFactory select_stream_factory = remote_table_function_ptr
        ? ClusterProxy::SelectStreamFactory(
            header, processed_stage, remote_table_function_ptr, scalars, has_virtual_shard_num_column, local_context->getExternalTables())
        : ClusterProxy::SelectStreamFactory(
            header,
            processed_stage,
            StorageID{remote_database, remote_table},
            scalars,
            has_virtual_shard_num_column,
            local_context->getExternalTables());
    ClusterProxy::executeQuery(query_plan, select_stream_factory, log,
        modified_query_ast, local_context, query_info,
        sharding_key_expr, sharding_key_column_name,
        query_info.cluster);
    
    if (!query_plan.isInitialized())
        throw Exception("Pipeline is not initialized", ErrorCodes::LOGICAL_ERROR);
}
BlockOutputStreamPtr StorageDistributed::write(const ASTPtr &, const StorageMetadataPtr & metadata_snapshot, ContextPtr local_context)
{
    auto cluster = getCluster();
    const auto & settings = local_context->getSettingsRef();
    
    if (!storage_policy && !owned_cluster && !settings.insert_distributed_sync && !settings.insert_shard_id)
    {