blob: 7daf9babf9f406348b61258e57d7c9e9d9e11ed2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include <Access/Common/AccessRightsElement.h>
#include <QueryPipeline/BlockIO.h>
#include <Processors/ISource.h>
#include <Interpreters/Context_fwd.h>
#include <Parsers/IAST_fwd.h>
#include <Storages/MergeTree/ZooKeeperRetries.h>
namespace zkutil
{
class ZooKeeper;
}
namespace DB
{
struct DDLLogEntry;
class Cluster;
using ClusterPtr = std::shared_ptr<Cluster>;
/// 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;
};
/// Pushes distributed DDL query to the queue.
/// 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 = {});
BlockIO getDistributedDDLStatus(const String & node_path, const DDLLogEntry & entry, ContextPtr context, const Strings * hosts_to_wait);
bool maybeRemoveOnCluster(const ASTPtr & query_ptr, ContextPtr context);
}
|