Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
133adc98
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
133adc98
编写于
8月 09, 2021
作者:
D
dapan1121
提交者:
GitHub
8月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7173 from taosdata/feature/td-5803
revive show vnodes with dnode ep
上级
8357859a
84d15a7e
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
2095 addition
and
1299 deletion
+2095
-1299
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-21
src/inc/ttokendef.h
src/inc/ttokendef.h
+125
-125
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+4
-2
src/query/inc/sql.y
src/query/inc/sql.y
+1
-1
src/query/src/sql.c
src/query/src/sql.c
+1949
-1148
tests/pytest/client/client.py
tests/pytest/client/client.py
+13
-2
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
133adc98
...
...
@@ -87,7 +87,6 @@ static uint8_t convertRelationalOperator(SStrToken *pToken);
static
int32_t
validateSelectNodeList
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SArray
*
pSelNodeList
,
bool
isSTable
,
bool
joinQuery
,
bool
timeWindowQuery
);
static
bool
validateIpAddress
(
const
char
*
ip
,
size_t
size
);
static
bool
hasUnsupportFunctionsForSTableQuery
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
);
static
bool
functionCompatibleCheck
(
SQueryInfo
*
pQueryInfo
,
bool
joinQuery
,
bool
twQuery
);
...
...
@@ -3220,7 +3219,6 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const
char
*
msg1
=
"invalid name"
;
const
char
*
msg2
=
"pattern filter string too long"
;
const
char
*
msg3
=
"database name too long"
;
const
char
*
msg4
=
"invalid ip address"
;
const
char
*
msg5
=
"database name is empty"
;
const
char
*
msg6
=
"pattern string is empty"
;
...
...
@@ -3268,17 +3266,11 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
}
else
if
(
showType
==
TSDB_MGMT_TABLE_VNODES
)
{
if
(
pShowInfo
->
prefix
.
type
==
0
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
"No specified
ip of dnode
"
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
"No specified
dnode ep
"
);
}
// show vnodes may be ip addr of dnode in payload
SStrToken
*
pDnodeIp
=
&
pShowInfo
->
prefix
;
if
(
pDnodeIp
->
n
>=
TSDB_IPv4ADDR_LEN
)
{
// ip addr is too long
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
if
(
!
validateIpAddress
(
pDnodeIp
->
z
,
pDnodeIp
->
n
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
if
(
pShowInfo
->
prefix
.
type
==
TK_STRING
)
{
pShowInfo
->
prefix
.
n
=
strdequote
(
pShowInfo
->
prefix
.
z
);
}
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -3331,16 +3323,6 @@ static int32_t setCompactVnodeInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
TSDB_CODE_SUCCESS
;
}
bool
validateIpAddress
(
const
char
*
ip
,
size_t
size
)
{
char
tmp
[
128
]
=
{
0
};
// buffer to build null-terminated string
assert
(
size
<
128
);
strncpy
(
tmp
,
ip
,
size
);
in_addr_t
epAddr
=
taosInetAddr
(
tmp
);
return
epAddr
!=
INADDR_NONE
;
}
int32_t
tscTansformFuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
...
...
src/inc/ttokendef.h
浏览文件 @
133adc98
...
...
@@ -75,131 +75,131 @@
#define TK_SCORES 57
#define TK_GRANTS 58
#define TK_VNODES 59
#define TK_
IPTOKEN
60
#define TK_
DOT
61
#define TK_
CREATE
62
#define TK_
TABLE
63
#define TK_
STABLE
64
#define TK_
DATABASE
65
#define TK_
TABLES
66
#define TK_
STABLE
S 67
#define TK_
VGROUPS
68
#define TK_
DROP
69
#define TK_
TOPIC
70
#define TK_
FUNCTION
71
#define TK_
DNODE
72
#define TK_
USER
73
#define TK_
ACCOUNT
74
#define TK_
USE
75
#define TK_
DESCRIBE
76
#define TK_
ALTER
77
#define TK_P
ASS
78
#define TK_
PRIVILEGE
79
#define TK_
LOCAL
80
#define TK_
COMPACT
81
#define TK_
L
P 82
#define TK_
RP
83
#define TK_
IF
84
#define TK_
EXISTS
85
#define TK_
AS
86
#define TK_
OUTPUTTYPE
87
#define TK_
AGGREGATE
88
#define TK_
BUFSIZE
89
#define TK_
PPS
90
#define TK_
TSERIES
91
#define TK_
DBS
92
#define TK_
STORAGE
93
#define TK_
QTIME
94
#define TK_
CONNS
95
#define TK_
STATE
96
#define TK_
COMMA
97
#define TK_
KEEP
98
#define TK_
CACHE
99
#define TK_
REPLICA
100
#define TK_
QUORUM
101
#define TK_
DAYS
102
#define TK_M
IN
ROWS 103
#define TK_
MAXROWS
104
#define TK_
BLOCKS
105
#define TK_
CTIME
106
#define TK_
WAL
107
#define TK_
FSYNC
108
#define TK_
COMP
109
#define TK_
PRECISION
110
#define TK_
UPDATE
111
#define TK_
CACHELAST
112
#define TK_
PARTITIONS
113
#define TK_
UNSIGNED
114
#define TK_
TAGS
115
#define TK_
USING
116
#define TK_N
ULL
117
#define TK_
NOW
118
#define TK_
SELECT
119
#define TK_
UNION
120
#define TK_
ALL
121
#define TK_
DISTINCT
122
#define TK_
FROM
123
#define TK_
VARIABLE
124
#define TK_
INTERVAL
125
#define TK_S
ESSION
126
#define TK_
STATE_WINDOW
127
#define TK_
FILL
128
#define TK_
SLIDING
129
#define TK_
ORDER
130
#define TK_
BY
131
#define TK_
ASC
132
#define TK_
DESC
133
#define TK_
GROUP
134
#define TK_
HAVING
135
#define TK_
LIMIT
136
#define TK_
OFFSE
T 137
#define TK_S
LIMIT
138
#define TK_
SOFFSET
139
#define TK_
WHERE
140
#define TK_
RESET
141
#define TK_
QUERY
142
#define TK_
SYNCDB
143
#define TK_
ADD
144
#define TK_
COLUMN
145
#define TK_
MODIFY
146
#define TK_
TAG
147
#define TK_
CHANGE
148
#define TK_
SET
149
#define TK_
KILL
150
#define TK_
CONNECTION
151
#define TK_
STREAM
152
#define TK_
COLON
153
#define TK_A
BORT
154
#define TK_A
FTER
155
#define TK_
ATTACH
156
#define TK_BE
FORE
157
#define TK_
BEGIN
158
#define TK_C
ASCADE
159
#define TK_C
LUSTER
160
#define TK_CO
NFLICT
161
#define TK_
COPY
162
#define TK_DE
FERRED
163
#define TK_DE
LIMITERS
164
#define TK_
DETACH
165
#define TK_E
ACH
166
#define TK_E
ND
167
#define TK_
EXPLAIN
168
#define TK_F
AIL
169
#define TK_
FOR
170
#define TK_I
GNORE
171
#define TK_I
MMEDIATE
172
#define TK_IN
ITIALLY
173
#define TK_
INSTEAD
174
#define TK_
MATCH
175
#define TK_
KEY
176
#define TK_
OF
177
#define TK_R
AISE
178
#define TK_RE
PLACE
179
#define TK_R
ESTRICT
180
#define TK_
ROW
181
#define TK_
STATEMENT
182
#define TK_
TRIGGER
183
#define TK_
VIEW
184
#define TK_
DOT
60
#define TK_
CREATE
61
#define TK_
TABLE
62
#define TK_
STABLE
63
#define TK_
DATABASE
64
#define TK_
TABLES
65
#define TK_
STABLES
66
#define TK_
VGROUP
S 67
#define TK_
DROP
68
#define TK_
TOPIC
69
#define TK_
FUNCTION
70
#define TK_
DNODE
71
#define TK_
USER
72
#define TK_
ACCOUNT
73
#define TK_
USE
74
#define TK_
DESCRIBE
75
#define TK_
ALTER
76
#define TK_
PASS
77
#define TK_P
RIVILEGE
78
#define TK_
LOCAL
79
#define TK_
COMPACT
80
#define TK_
LP
81
#define TK_
R
P 82
#define TK_
IF
83
#define TK_
EXISTS
84
#define TK_
AS
85
#define TK_
OUTPUTTYPE
86
#define TK_
AGGREGATE
87
#define TK_
BUFSIZE
88
#define TK_
PPS
89
#define TK_
TSERIES
90
#define TK_
DBS
91
#define TK_
STORAGE
92
#define TK_
QTIME
93
#define TK_
CONNS
94
#define TK_
STATE
95
#define TK_
COMMA
96
#define TK_
KEEP
97
#define TK_
CACHE
98
#define TK_
REPLICA
99
#define TK_
QUORUM
100
#define TK_
DAYS
101
#define TK_
MINROWS
102
#define TK_M
AX
ROWS 103
#define TK_
BLOCKS
104
#define TK_
CTIME
105
#define TK_
WAL
106
#define TK_
FSYNC
107
#define TK_
COMP
108
#define TK_
PRECISION
109
#define TK_
UPDATE
110
#define TK_
CACHELAST
111
#define TK_
PARTITIONS
112
#define TK_
UNSIGNED
113
#define TK_
TAGS
114
#define TK_
USING
115
#define TK_
NULL
116
#define TK_N
OW
117
#define TK_
SELECT
118
#define TK_
UNION
119
#define TK_
ALL
120
#define TK_
DISTINCT
121
#define TK_
FROM
122
#define TK_
VARIABLE
123
#define TK_
INTERVAL
124
#define TK_
SESSION
125
#define TK_S
TATE_WINDOW
126
#define TK_
FILL
127
#define TK_
SLIDING
128
#define TK_
ORDER
129
#define TK_
BY
130
#define TK_
ASC
131
#define TK_
DESC
132
#define TK_
GROUP
133
#define TK_
HAVING
134
#define TK_
LIMIT
135
#define TK_
OFFSET
136
#define TK_
SLIMI
T 137
#define TK_S
OFFSET
138
#define TK_
WHERE
139
#define TK_
RESET
140
#define TK_
QUERY
141
#define TK_
SYNCDB
142
#define TK_
ADD
143
#define TK_
COLUMN
144
#define TK_
MODIFY
145
#define TK_
TAG
146
#define TK_
CHANGE
147
#define TK_
SET
148
#define TK_
KILL
149
#define TK_
CONNECTION
150
#define TK_
STREAM
151
#define TK_
COLON
152
#define TK_
ABORT
153
#define TK_A
FTER
154
#define TK_A
TTACH
155
#define TK_
BEFORE
156
#define TK_BE
GIN
157
#define TK_
CASCADE
158
#define TK_C
LUSTER
159
#define TK_C
ONFLICT
160
#define TK_CO
PY
161
#define TK_
DEFERRED
162
#define TK_DE
LIMITERS
163
#define TK_DE
TACH
164
#define TK_
EACH
165
#define TK_E
ND
166
#define TK_E
XPLAIN
167
#define TK_
FAIL
168
#define TK_F
OR
169
#define TK_
IGNORE
170
#define TK_I
MMEDIATE
171
#define TK_I
NITIALLY
172
#define TK_IN
STEAD
173
#define TK_
MATCH
174
#define TK_
KEY
175
#define TK_
OF
176
#define TK_
RAISE
177
#define TK_R
EPLACE
178
#define TK_RE
STRICT
179
#define TK_R
OW
180
#define TK_
STATEMENT
181
#define TK_
TRIGGER
182
#define TK_
VIEW
183
#define TK_
IPTOKEN
184
#define TK_SEMI 185
#define TK_NONE 186
#define TK_PREV 187
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
133adc98
...
...
@@ -1181,7 +1181,7 @@ static int32_t mnodeGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"v
node
"
);
strcpy
(
pSchema
[
cols
].
name
,
"v
gId
"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -1243,8 +1243,10 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
syncRole
[
pVgid
->
role
]);
STR_TO_VARSTR
(
pWrite
,
syncRole
[
pVgid
->
role
]);
cols
++
;
numOfRows
++
;
}
}
...
...
src/query/inc/sql.y
浏览文件 @
133adc98
...
...
@@ -80,7 +80,7 @@ cmd ::= SHOW SCORES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0);
cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); }
cmd ::= SHOW VNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); }
cmd ::= SHOW VNODES
IPTOKEN
(X). { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &X, 0); }
cmd ::= SHOW VNODES
ids
(X). { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &X, 0); }
%type dbPrefix {SStrToken}
...
...
src/query/src/sql.c
浏览文件 @
133adc98
此差异已折叠。
点击以展开。
tests/pytest/client/client.py
浏览文件 @
133adc98
...
...
@@ -37,8 +37,12 @@ class TDTestCase:
ret
=
tdSql
.
query
(
'show dnodes'
)
ret
=
tdSql
.
execute
(
'alter dnode "%s" debugFlag 135'
%
tdSql
.
getData
(
0
,
0
))
tdLog
.
info
(
'alter dnode "%s" debugFlag 135 -> ret: %d'
%
(
tdSql
.
getData
(
0
,
0
),
ret
))
dnodeId
=
tdSql
.
getData
(
0
,
0
);
dnodeEndpoint
=
tdSql
.
getData
(
0
,
1
);
ret
=
tdSql
.
execute
(
'alter dnode "%s" debugFlag 135'
%
dnodeId
)
tdLog
.
info
(
'alter dnode "%s" debugFlag 135 -> ret: %d'
%
(
dnodeId
,
ret
))
ret
=
tdSql
.
query
(
'show mnodes'
)
tdSql
.
checkRows
(
1
)
...
...
@@ -56,6 +60,13 @@ class TDTestCase:
ret
=
tdSql
.
query
(
'show vgroups'
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
'create stable st (ts timestamp, f int) tags(t int)'
)
tdSql
.
execute
(
'create table ct1 using st tags(1)'
);
tdSql
.
execute
(
'create table ct2 using st tags(2)'
);
ret
=
tdSql
.
query
(
'show vnodes "{}"'
.
format
(
dnodeEndpoint
))
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
1
,
"master"
)
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录