ClickHouse/src/Interpreters/executeDDLQueryOnCluster.h

51 lines
1.5 KiB
C++
Raw Normal View History

2020-11-03 13:47:26 +00:00
#pragma once
#include <Access/Common/AccessRightsElement.h>
2021-10-15 20:18:20 +00:00
#include <QueryPipeline/BlockIO.h>
2022-05-20 19:49:31 +00:00
#include <Processors/ISource.h>
#include <Interpreters/Context_fwd.h>
2020-11-03 13:47:26 +00:00
#include <Parsers/IAST_fwd.h>
2024-01-30 18:02:17 +00:00
#include <Common/ZooKeeper/ZooKeeperRetries.h>
2021-07-17 18:06:46 +00:00
2020-11-03 13:47:26 +00:00
namespace zkutil
{
class ZooKeeper;
}
namespace DB
{
struct DDLLogEntry;
class Cluster;
using ClusterPtr = std::shared_ptr<Cluster>;
2020-11-03 13:47:26 +00:00
/// Returns true if provided ALTER type can be executed ON CLUSTER
bool isSupportedAlterTypeForOnClusterDDLQuery(int type);
struct DDLQueryOnClusterParams
{
/// A cluster to execute a distributed query.
/// If not set, executeDDLQueryOnCluster() will use `query->cluster` to determine a cluster to execute the query.
ClusterPtr cluster;
/// 1-bases index of a shard to execute a query on, 0 means all shards.
size_t only_shard_num = 0;
/// 1-bases index of a replica to execute a query on, 0 means all replicas.
size_t only_replica_num = 0;
/// Privileges which the current user should have to execute a query.
AccessRightsElements access_to_check;
};
2020-11-03 13:47:26 +00:00
/// Pushes distributed DDL query to the queue.
2021-07-17 21:45:07 +00:00
/// Returns DDLQueryStatusSource, which reads results of query execution on each host in the cluster.
BlockIO executeDDLQueryOnCluster(const ASTPtr & query_ptr, ContextPtr context, const DDLQueryOnClusterParams & params = {});
2020-11-03 13:47:26 +00:00
2023-03-31 10:57:29 +00:00
BlockIO getDistributedDDLStatus(const String & node_path, const DDLLogEntry & entry, ContextPtr context, const Strings * hosts_to_wait);
2020-11-03 13:47:26 +00:00
2022-07-06 17:54:05 +00:00
bool maybeRemoveOnCluster(const ASTPtr & query_ptr, ContextPtr context);
2020-11-03 13:47:26 +00:00
}