Don't replicate delete through DDL worker if there is just 1 shard

This commit is contained in:
Alexander Gololobov 2023-05-24 16:03:21 +02:00
parent 8509f1b645
commit de0a074545

View File

@ -1455,7 +1455,16 @@ bool DatabaseReplicated::shouldReplicateQuery(const ContextPtr & query_context,
}
if (query_ptr->as<const ASTDeleteQuery>() != nullptr)
return !is_keeper_map_table(query_ptr);
{
if (is_keeper_map_table(query_ptr))
return false;
/// If there is only 1 shard then there is no need to replicate DELETE query.
auto current_cluster = tryGetCluster();
return
!current_cluster || /// Couldn't get the cluster, so we don't know how many shards there are.
current_cluster->getShardsInfo().size() > 1;
}
return true;
}