Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
ffe7558f
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ffe7558f
编写于
8月 06, 2017
作者:
V
Vitaliy Lyudvichenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add SYSTEM KILL and SHUTDOWN implementations. [#CLICKHOUSE-2931]
上级
eb057981
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
13 deletion
+73
-13
dbms/src/Core/ErrorCodes.cpp
dbms/src/Core/ErrorCodes.cpp
+1
-0
dbms/src/Interpreters/InterpreterSystemQuery.cpp
dbms/src/Interpreters/InterpreterSystemQuery.cpp
+49
-1
dbms/src/Interpreters/InterpreterSystemQuery.h
dbms/src/Interpreters/InterpreterSystemQuery.h
+1
-2
dbms/src/Parsers/ASTSystemQuery.cpp
dbms/src/Parsers/ASTSystemQuery.cpp
+18
-4
dbms/src/Parsers/ASTSystemQuery.h
dbms/src/Parsers/ASTSystemQuery.h
+4
-6
未找到文件。
dbms/src/Core/ErrorCodes.cpp
浏览文件 @
ffe7558f
...
...
@@ -382,6 +382,7 @@ namespace ErrorCodes
extern
const
int
ILLEGAL_SYNTAX_FOR_DATA_TYPE
=
377
;
extern
const
int
DATA_TYPE_CANNOT_HAVE_ARGUMENTS
=
378
;
extern
const
int
UNKNOWN_STATUS_OF_DISTRIBUTED_DDL_TASK
=
379
;
extern
const
int
CANNOT_KILL
=
380
;
extern
const
int
KEEPER_EXCEPTION
=
999
;
extern
const
int
POCO_EXCEPTION
=
1000
;
...
...
dbms/src/Interpreters/InterpreterSystemQuery.cpp
浏览文件 @
ffe7558f
#include "InterpreterSystemQuery.h"
#include <Interpreters/InterpreterSystemQuery.h>
#include <Parsers/ASTSystemQuery.h>
#include <Common/typeid_cast.h>
#include <csignal>
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
BAD_ARGUMENTS
;
extern
const
int
CANNOT_KILL
;
}
InterpreterSystemQuery
::
InterpreterSystemQuery
(
const
ASTPtr
&
query_ptr_
,
Context
&
context_
)
:
query_ptr
(
query_ptr_
),
context
(
context_
)
{}
BlockIO
InterpreterSystemQuery
::
execute
()
{
auto
&
query
=
typeid_cast
<
ASTSystemQuery
&>
(
*
query_ptr
);
using
Type
=
ASTSystemQuery
::
Type
;
switch
(
query
.
type
)
{
case
Type
::
SHUTDOWN
:
if
(
kill
(
0
,
SIGTERM
))
throw
Exception
(
"System call kill() failed"
,
ErrorCodes
::
CANNOT_KILL
);
break
;
case
Type
::
KILL
:
if
(
kill
(
0
,
SIGKILL
))
throw
Exception
(
"System call kill() failed"
,
ErrorCodes
::
CANNOT_KILL
);
break
;
case
Type
::
DROP_DNS_CACHE
:
break
;
case
Type
::
DROP_MARK_CACHE
:
break
;
case
Type
::
DROP_UNCOMPRESSED_CACHE
:
break
;
case
Type
::
STOP_LISTEN_QUERIES
:
break
;
case
Type
::
START_LISTEN_QUERIES
:
break
;
case
Type
::
RESTART_REPLICAS
:
break
;
case
Type
::
SYNC_REPLICA
:
break
;
case
Type
::
RELOAD_DICTIONARY
:
break
;
case
Type
::
RELOAD_DICTIONARIES
:
break
;
case
Type
::
STOP_MERGES
:
break
;
case
Type
::
START_MERGES
:
break
;
case
Type
::
STOP_REPLICATION_QUEUES
:
break
;
case
Type
::
START_REPLICATION_QUEUES
:
break
;
default:
throw
Exception
(
"Unknown type of SYSTEM query"
,
ErrorCodes
::
BAD_ARGUMENTS
);
}
return
BlockIO
();
}
}
\ No newline at end of file
dbms/src/Interpreters/InterpreterSystemQuery.h
浏览文件 @
ffe7558f
#pragma once
#include <Interpreters/IInterpreter.h>
namespace
DB
{
...
...
@@ -9,8 +10,6 @@ class IAST;
using
ASTPtr
=
std
::
shared_ptr
<
IAST
>
;
/** Return list of currently executing queries.
*/
class
InterpreterSystemQuery
:
public
IInterpreter
{
public:
...
...
dbms/src/Parsers/ASTSystemQuery.cpp
浏览文件 @
ffe7558f
...
...
@@ -2,14 +2,15 @@
#include <Parsers/ASTSystemQuery.h>
namespace
ErrorCodes
namespace
DB
{
extern
const
int
BAD_TYPE_OF_FIELD
;
}
namespace
DB
namespace
ErrorCodes
{
extern
const
int
BAD_TYPE_OF_FIELD
;
extern
const
int
NOT_IMPLEMENTED
;
}
const
char
*
ASTSystemQuery
::
typeToString
(
Type
type
)
...
...
@@ -52,4 +53,17 @@ const char * ASTSystemQuery::typeToString(Type type)
}
void
ASTSystemQuery
::
formatImpl
(
const
IAST
::
FormatSettings
&
settings
,
IAST
::
FormatState
&
state
,
IAST
::
FormatStateStacked
frame
)
const
{
settings
.
ostr
<<
(
settings
.
hilite
?
hilite_keyword
:
""
)
<<
"SYSTEM "
<<
(
settings
.
hilite
?
hilite_none
:
""
);
settings
.
ostr
<<
typeToString
(
type
);
if
(
type
==
Type
::
RELOAD_DICTIONARY
)
settings
.
ostr
<<
" "
<<
backQuoteIfNeed
(
target_dictionary
);
else
if
(
type
==
Type
::
SYNC_REPLICA
)
throw
Exception
(
"SYNC_REPLICA isn't supported yet"
,
ErrorCodes
::
NOT_IMPLEMENTED
);
}
}
\ No newline at end of file
dbms/src/Parsers/ASTSystemQuery.h
浏览文件 @
ffe7558f
...
...
@@ -36,12 +36,13 @@ public:
Type
type
=
Type
::
_UNKNOWN
;
String
target_dictionary
;
//String target_replica;
//String target_replica_database;
//String target_replica_table;
ASTSystemQuery
()
=
default
;
explicit
ASTSystemQuery
(
const
StringRange
range
)
:
IAST
(
range
)
{}
String
getID
()
const
override
{
return
"SYSTEM"
;
};
String
getID
()
const
override
{
return
"SYSTEM
query
"
;
};
ASTPtr
clone
()
const
override
{
return
std
::
make_shared
<
ASTSystemQuery
>
(
*
this
);
}
...
...
@@ -49,10 +50,7 @@ public:
protected:
void
formatImpl
(
const
FormatSettings
&
settings
,
FormatState
&
state
,
FormatStateStacked
frame
)
const
override
{
settings
.
ostr
<<
(
settings
.
hilite
?
hilite_keyword
:
""
)
<<
"SYSTEM "
<<
(
settings
.
hilite
?
hilite_none
:
""
);
}
void
formatImpl
(
const
FormatSettings
&
settings
,
FormatState
&
state
,
FormatStateStacked
frame
)
const
override
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录