Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
59621459
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
59621459
编写于
12月 24, 2019
作者:
S
slguan
提交者:
GitHub
12月 24, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1000 from taosdata/feature/lihui
[1361]
上级
4f5147de
6e35d6c4
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
581 addition
and
533 deletion
+581
-533
src/client/src/sql.c
src/client/src/sql.c
+524
-517
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+23
-9
src/client/src/tscServer.c
src/client/src/tscServer.c
+2
-1
src/inc/sql.y
src/inc/sql.y
+6
-0
src/system/detail/src/mgmtVgroup.c
src/system/detail/src/mgmtVgroup.c
+26
-6
未找到文件。
src/client/src/sql.c
浏览文件 @
59621459
此差异已折叠。
点击以展开。
src/client/src/tscSQLParser.c
浏览文件 @
59621459
...
...
@@ -2532,15 +2532,29 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
ret
;
}
if
(
type
!=
SHOW_VGROUPS
&&
pInfo
->
pDCLInfo
->
nTokens
==
2
)
{
// set the like conds for show tables
SSQLToken
*
likeToken
=
&
pInfo
->
pDCLInfo
->
a
[
1
];
strncpy
(
pCmd
->
payload
,
likeToken
->
z
,
likeToken
->
n
);
pCmd
->
payloadLen
=
strdequote
(
pCmd
->
payload
);
if
(
pCmd
->
payloadLen
>
TSDB_METER_NAME_LEN
)
{
return
invalidSqlErrMsg
(
pCmd
,
msg2
);
if
(
pInfo
->
pDCLInfo
->
nTokens
==
2
)
{
if
(
type
==
SHOW_VGROUPS
)
{
// set the table name for show vgroups
SSQLToken
*
meterId
=
&
pInfo
->
pDCLInfo
->
a
[
1
];
if
(
0
==
pDbPrefixToken
->
n
)
{
SSQLToken
db
=
{
0
};
getCurrentDBName
(
pSql
,
&
db
);
pDbPrefixToken
=
&
db
;
}
ret
=
setObjFullName
(
pCmd
->
payload
,
NULL
,
pDbPrefixToken
,
meterId
,
&
(
pCmd
->
payloadLen
));
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
}
else
{
// set the like conds for show tables/stables
SSQLToken
*
likeToken
=
&
pInfo
->
pDCLInfo
->
a
[
1
];
strncpy
(
pCmd
->
payload
,
likeToken
->
z
,
likeToken
->
n
);
pCmd
->
payloadLen
=
strdequote
(
pCmd
->
payload
);
if
(
pCmd
->
payloadLen
>
TSDB_METER_NAME_LEN
)
{
return
invalidSqlErrMsg
(
pCmd
,
msg2
);
}
}
}
}
...
...
src/client/src/tscServer.c
浏览文件 @
59621459
...
...
@@ -2191,7 +2191,8 @@ int tscBuildShowMsg(SSqlObj *pSql) {
pShowMsg
=
(
SShowMsg
*
)
pMsg
;
pShowMsg
->
type
=
pCmd
->
showType
;
if
((
pShowMsg
->
type
==
TSDB_MGMT_TABLE_TABLE
||
pShowMsg
->
type
==
TSDB_MGMT_TABLE_METRIC
||
pShowMsg
->
type
==
TSDB_MGMT_TABLE_VNODES
)
&&
pCmd
->
payloadLen
!=
0
)
{
if
((
pShowMsg
->
type
==
TSDB_MGMT_TABLE_TABLE
||
pShowMsg
->
type
==
TSDB_MGMT_TABLE_METRIC
||
pShowMsg
->
type
==
TSDB_MGMT_TABLE_VNODES
||
pShowMsg
->
type
==
TSDB_MGMT_TABLE_VGROUP
)
&&
pCmd
->
payloadLen
!=
0
)
{
// only show tables support wildcard query
pShowMsg
->
payloadLen
=
htons
(
pCmd
->
payloadLen
);
memcpy
(
pShowMsg
->
payload
,
payload
,
pCmd
->
payloadLen
);
...
...
src/inc/sql.y
浏览文件 @
59621459
...
...
@@ -108,6 +108,12 @@ cmd ::= SHOW dbPrefix(X) VGROUPS. {
setDCLSQLElems(pInfo, SHOW_VGROUPS, 1, &token);
}
cmd ::= SHOW dbPrefix(X) VGROUPS ids(Y). {
SSQLToken token;
setDBName(&token, &X);
setDCLSQLElems(pInfo, SHOW_VGROUPS, 2, &token, &Y);
}
//drop configure for tables
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
X.n += Z.n;
...
...
src/system/detail/src/mgmtVgroup.c
浏览文件 @
59621459
...
...
@@ -237,11 +237,25 @@ int mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) {
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
int
maxReplica
=
0
;
SVgObj
*
pVgroup
=
pDb
->
pHead
;
while
(
pVgroup
!=
NULL
)
{
int
maxReplica
=
0
;
SVgObj
*
pVgroup
=
NULL
;
STabObj
*
pMeter
=
NULL
;
if
(
pShow
->
payloadLen
>
0
)
{
pMeter
=
mgmtGetMeter
(
pShow
->
payload
);
if
(
NULL
==
pMeter
)
{
return
TSDB_CODE_INVALID_METER_ID
;
}
pVgroup
=
mgmtGetVgroup
(
pMeter
->
gid
.
vgId
);
if
(
NULL
==
pVgroup
)
return
TSDB_CODE_INVALID_METER_ID
;
maxReplica
=
pVgroup
->
numOfVnodes
>
maxReplica
?
pVgroup
->
numOfVnodes
:
maxReplica
;
pVgroup
=
pVgroup
->
next
;
}
else
{
SVgObj
*
pVgroup
=
pDb
->
pHead
;
while
(
pVgroup
!=
NULL
)
{
maxReplica
=
pVgroup
->
numOfVnodes
>
maxReplica
?
pVgroup
->
numOfVnodes
:
maxReplica
;
pVgroup
=
pVgroup
->
next
;
}
}
for
(
int
i
=
0
;
i
<
maxReplica
;
++
i
)
{
...
...
@@ -276,10 +290,16 @@ int mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) {
pShow
->
offset
[
0
]
=
0
;
for
(
int
i
=
1
;
i
<
cols
;
++
i
)
pShow
->
offset
[
i
]
=
pShow
->
offset
[
i
-
1
]
+
pShow
->
bytes
[
i
-
1
];
pShow
->
numOfRows
=
pDb
->
numOfVgroups
;
pShow
->
pNode
=
pDb
->
pHead
;
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
if
(
NULL
==
pMeter
)
{
pShow
->
numOfRows
=
pDb
->
numOfVgroups
;
pShow
->
pNode
=
pDb
->
pHead
;
}
else
{
pShow
->
numOfRows
=
1
;
pShow
->
pNode
=
pVgroup
;
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录