2020-11-03 13:47:26 +00:00
|
|
|
#pragma once
|
2021-04-10 23:33:54 +00:00
|
|
|
|
2022-04-22 12:15:29 +00:00
|
|
|
#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>
|
2021-04-10 23:33:54 +00:00
|
|
|
#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;
|
2022-05-01 13:36:32 +00:00
|
|
|
class Cluster;
|
|
|
|
using ClusterPtr = std::shared_ptr<Cluster>;
|
2020-11-03 13:47:26 +00:00
|
|
|
|
2020-11-05 09:52:23 +00:00
|
|
|
/// Returns true if provided ALTER type can be executed ON CLUSTER
|
2023-08-02 11:39:54 +00:00
|
|
|
bool isSupportedAlterTypeForOnClusterDDLQuery(int type);
|
2020-11-05 09:52:23 +00:00
|
|
|
|
2022-04-22 12:15:29 +00:00
|
|
|
struct DDLQueryOnClusterParams
|
|
|
|
{
|
2022-05-01 13:36:32 +00:00
|
|
|
/// 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;
|
2022-04-22 12:15:29 +00:00
|
|
|
|
2022-05-01 13:36:32 +00:00
|
|
|
/// 1-bases index of a shard to execute a query on, 0 means all shards.
|
|
|
|
size_t only_shard_num = 0;
|
2022-04-22 12:15:29 +00:00
|
|
|
|
2022-05-01 13:36:32 +00:00
|
|
|
/// 1-bases index of a replica to execute a query on, 0 means all replicas.
|
|
|
|
size_t only_replica_num = 0;
|
2022-04-22 12:15:29 +00:00
|
|
|
|
|
|
|
/// 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.
|
2022-04-22 12:15:29 +00:00
|
|
|
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
|
|
|
}
|