1#pragma once
2
3#include <Interpreters/IInterpreter.h>
4#include <Parsers/IAST_fwd.h>
5#include <Storages/IStorage_fwd.h>
6
7
8namespace Poco { class Logger; }
9
10namespace DB
11{
12
13class Context;
14class ASTSystemQuery;
15
16class InterpreterSystemQuery : public IInterpreter
17{
18public:
19 InterpreterSystemQuery(const ASTPtr & query_ptr_, Context & context_);
20
21 BlockIO execute() override;
22
23 bool ignoreQuota() const override { return true; }
24 bool ignoreLimits() const override { return true; }
25
26private:
27 ASTPtr query_ptr;
28 Context & context;
29 Poco::Logger * log = nullptr;
30
31 /// Tries to get a replicated table and restart it
32 /// Returns pointer to a newly created table if the restart was successful
33 StoragePtr tryRestartReplica(const String & database_name, const String & table_name, Context & context);
34
35 void restartReplicas(Context & system_context);
36 void syncReplica(ASTSystemQuery & query);
37 void flushDistributed(ASTSystemQuery & query);
38};
39
40
41}
42