2017-08-04 15:54:00 +00:00
|
|
|
#pragma once
|
2017-09-17 20:22:39 +00:00
|
|
|
|
2019-12-19 03:46:20 +00:00
|
|
|
#include <Parsers/ASTQueryWithOnCluster.h>
|
2017-08-04 15:54:00 +00:00
|
|
|
#include <Parsers/IAST.h>
|
|
|
|
|
2021-10-27 23:10:39 +00:00
|
|
|
#include "config_core.h"
|
2020-04-16 12:31:57 +00:00
|
|
|
|
2017-08-04 15:54:00 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-12-19 03:46:20 +00:00
|
|
|
class ASTSystemQuery : public IAST, public ASTQueryWithOnCluster
|
2017-08-04 15:54:00 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2021-09-20 15:15:23 +00:00
|
|
|
enum class Type : UInt64
|
2017-08-04 15:54:00 +00:00
|
|
|
{
|
2017-08-31 12:55:19 +00:00
|
|
|
UNKNOWN,
|
2017-08-04 15:54:00 +00:00
|
|
|
SHUTDOWN,
|
|
|
|
KILL,
|
2021-01-07 19:19:33 +00:00
|
|
|
SUSPEND,
|
2017-08-04 15:54:00 +00:00
|
|
|
DROP_DNS_CACHE,
|
|
|
|
DROP_MARK_CACHE,
|
|
|
|
DROP_UNCOMPRESSED_CACHE,
|
2021-08-21 17:27:22 +00:00
|
|
|
DROP_INDEX_MARK_CACHE,
|
|
|
|
DROP_INDEX_UNCOMPRESSED_CACHE,
|
2021-03-28 01:10:30 +00:00
|
|
|
DROP_MMAP_CACHE,
|
2018-08-30 16:31:20 +00:00
|
|
|
#if USE_EMBEDDED_COMPILER
|
2018-09-05 11:37:41 +00:00
|
|
|
DROP_COMPILED_EXPRESSION_CACHE,
|
2018-08-30 16:31:20 +00:00
|
|
|
#endif
|
2022-03-30 11:47:44 +00:00
|
|
|
DROP_FILESYSTEM_CACHE,
|
2017-08-04 15:54:00 +00:00
|
|
|
STOP_LISTEN_QUERIES,
|
|
|
|
START_LISTEN_QUERIES,
|
|
|
|
RESTART_REPLICAS,
|
2018-05-21 13:49:54 +00:00
|
|
|
RESTART_REPLICA,
|
2021-06-20 08:24:43 +00:00
|
|
|
RESTORE_REPLICA,
|
2020-05-17 12:44:22 +00:00
|
|
|
DROP_REPLICA,
|
2017-08-04 15:54:00 +00:00
|
|
|
SYNC_REPLICA,
|
2022-05-01 13:40:18 +00:00
|
|
|
SYNC_DATABASE_REPLICA,
|
2017-08-04 15:54:00 +00:00
|
|
|
RELOAD_DICTIONARY,
|
|
|
|
RELOAD_DICTIONARIES,
|
2021-04-16 09:56:40 +00:00
|
|
|
RELOAD_MODEL,
|
|
|
|
RELOAD_MODELS,
|
2021-09-17 13:04:44 +00:00
|
|
|
RELOAD_FUNCTION,
|
|
|
|
RELOAD_FUNCTIONS,
|
2018-03-26 14:12:07 +00:00
|
|
|
RELOAD_EMBEDDED_DICTIONARIES,
|
2018-03-13 10:41:47 +00:00
|
|
|
RELOAD_CONFIG,
|
2020-11-30 14:30:55 +00:00
|
|
|
RELOAD_SYMBOLS,
|
2021-04-20 19:23:54 +00:00
|
|
|
RESTART_DISK,
|
2017-08-04 15:54:00 +00:00
|
|
|
STOP_MERGES,
|
|
|
|
START_MERGES,
|
2019-08-01 15:36:12 +00:00
|
|
|
STOP_TTL_MERGES,
|
|
|
|
START_TTL_MERGES,
|
2018-05-21 13:49:54 +00:00
|
|
|
STOP_FETCHES,
|
|
|
|
START_FETCHES,
|
2019-09-03 14:50:49 +00:00
|
|
|
STOP_MOVES,
|
|
|
|
START_MOVES,
|
2018-05-21 13:49:54 +00:00
|
|
|
STOP_REPLICATED_SENDS,
|
2019-02-02 11:28:43 +00:00
|
|
|
START_REPLICATED_SENDS,
|
2017-08-04 15:54:00 +00:00
|
|
|
STOP_REPLICATION_QUEUES,
|
|
|
|
START_REPLICATION_QUEUES,
|
2018-10-09 10:05:27 +00:00
|
|
|
FLUSH_LOGS,
|
2019-05-10 04:19:02 +00:00
|
|
|
FLUSH_DISTRIBUTED,
|
2019-04-22 15:11:16 +00:00
|
|
|
STOP_DISTRIBUTED_SENDS,
|
|
|
|
START_DISTRIBUTED_SENDS,
|
2021-09-20 14:23:10 +00:00
|
|
|
START_THREAD_FUZZER,
|
|
|
|
STOP_THREAD_FUZZER,
|
2017-08-31 12:55:19 +00:00
|
|
|
END
|
2017-08-04 15:54:00 +00:00
|
|
|
};
|
|
|
|
|
2021-09-20 15:15:23 +00:00
|
|
|
static const char * typeToString(Type type);
|
|
|
|
|
2017-08-31 12:55:19 +00:00
|
|
|
Type type = Type::UNKNOWN;
|
2017-08-04 15:54:00 +00:00
|
|
|
|
2021-10-12 18:11:00 +00:00
|
|
|
ASTPtr database;
|
|
|
|
ASTPtr table;
|
|
|
|
|
|
|
|
String getDatabase() const;
|
|
|
|
String getTable() const;
|
|
|
|
|
|
|
|
void setDatabase(const String & name);
|
|
|
|
void setTable(const String & name);
|
|
|
|
|
2021-04-16 09:56:40 +00:00
|
|
|
String target_model;
|
2021-09-17 13:04:44 +00:00
|
|
|
String target_function;
|
2020-05-17 12:44:22 +00:00
|
|
|
String replica;
|
|
|
|
String replica_zk_path;
|
2021-01-07 19:19:33 +00:00
|
|
|
bool is_drop_whole_replica{};
|
2020-10-20 15:10:24 +00:00
|
|
|
String storage_policy;
|
|
|
|
String volume;
|
2021-04-20 19:23:54 +00:00
|
|
|
String disk;
|
2021-01-07 19:19:33 +00:00
|
|
|
UInt64 seconds{};
|
2022-04-25 16:49:00 +00:00
|
|
|
|
2022-04-25 17:40:28 +00:00
|
|
|
/// Values for `drop filesystem cache` system query.
|
2022-03-30 11:47:44 +00:00
|
|
|
String filesystem_cache_path;
|
2022-04-25 16:49:00 +00:00
|
|
|
bool force_removal = false;
|
2017-08-04 15:54:00 +00:00
|
|
|
|
2018-12-07 12:34:40 +00:00
|
|
|
String getID(char) const override { return "SYSTEM query"; }
|
2017-08-04 15:54:00 +00:00
|
|
|
|
2021-10-12 18:11:00 +00:00
|
|
|
ASTPtr clone() const override
|
|
|
|
{
|
|
|
|
auto res = std::make_shared<ASTSystemQuery>(*this);
|
|
|
|
res->children.clear();
|
|
|
|
|
|
|
|
if (database) { res->database = database->clone(); res->children.push_back(res->database); }
|
|
|
|
if (table) { res->table = table->clone(); res->children.push_back(res->table); }
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
2017-08-04 15:54:00 +00:00
|
|
|
|
2022-04-22 11:31:39 +00:00
|
|
|
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams & params) const override
|
2019-12-19 03:46:20 +00:00
|
|
|
{
|
2022-04-22 11:31:39 +00:00
|
|
|
return removeOnCluster<ASTSystemQuery>(clone(), params.default_database);
|
2019-12-19 03:46:20 +00:00
|
|
|
}
|
|
|
|
|
2021-12-29 12:32:49 +00:00
|
|
|
virtual QueryKind getQueryKind() const override { return QueryKind::System; }
|
2021-08-04 14:09:23 +00:00
|
|
|
|
2017-08-04 15:54:00 +00:00
|
|
|
protected:
|
|
|
|
|
2017-08-06 20:26:23 +00:00
|
|
|
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
|
2017-08-04 15:54:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-08-30 21:25:44 +00:00
|
|
|
}
|