Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
65e7a9e8
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
65e7a9e8
编写于
10月 20, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1661
上级
ebb7afd6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
97 addition
and
11 deletion
+97
-11
src/client/src/tscSql.c
src/client/src/tscSql.c
+40
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+15
-3
src/inc/vnode.h
src/inc/vnode.h
+2
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+8
-0
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+32
-7
未找到文件。
src/client/src/tscSql.c
浏览文件 @
65e7a9e8
...
...
@@ -588,7 +588,20 @@ static UNUSED_FUNC bool tscKillQueryInDnode(SSqlObj* pSql) {
return
true
;
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
if
(
pQueryInfo
!=
0
)
{
STableMetaInfo
*
pTableMetaInfo1
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pTableMetaInfo1
!=
NULL
)
{
// for select query super table, the super table vgroup list can not be null in any cases.
if
(
pQueryInfo
->
command
==
TSDB_SQL_SELECT
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo1
))
{
if
(
pTableMetaInfo1
->
pVgroupTables
==
0
)
{
tscError
(
"error !!!%p, vgroupTable is null"
,
pSql
);
}
}
}
}
if
((
pQueryInfo
==
NULL
)
||
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
))
{
return
true
;
}
...
...
@@ -702,6 +715,19 @@ static void tscKillSTableQuery(SSqlObj *pSql) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
if
(
pQueryInfo
!=
0
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pTableMetaInfo
!=
NULL
)
{
// for select query super table, the super table vgroup list can not be null in any cases.
if
(
pQueryInfo
->
command
==
TSDB_SQL_SELECT
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
if
(
pTableMetaInfo
->
pVgroupTables
==
0
)
{
tscError
(
"error !!!%p, vgroupTable is null"
,
pSql
);
}
}
}
}
if
(
!
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
))
{
return
;
}
...
...
@@ -750,6 +776,19 @@ void taos_stop_query(TAOS_RES *res) {
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
if
(
pQueryInfo
!=
0
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pTableMetaInfo
!=
NULL
)
{
// for select query super table, the super table vgroup list can not be null in any cases.
if
(
pQueryInfo
->
command
==
TSDB_SQL_SELECT
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
if
(
pTableMetaInfo
->
pVgroupTables
==
0
)
{
tscError
(
"error !!!%p, vgroupTable is null"
,
pSql
);
}
}
}
}
if
(
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
))
{
assert
(
pSql
->
pRpcCtx
==
NULL
);
tscKillSTableQuery
(
pSql
);
...
...
src/client/src/tscUtil.c
浏览文件 @
65e7a9e8
...
...
@@ -114,9 +114,9 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
}
// for select query super table, the super table vgroup list can not be null in any cases.
if
(
pQueryInfo
->
command
==
TSDB_SQL_SELECT
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
assert
(
pTableMetaInfo
->
vgroupList
!=
NULL
);
}
//
if (pQueryInfo->command == TSDB_SQL_SELECT && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
//
assert(pTableMetaInfo->vgroupList != NULL);
//
}
if
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
==
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
return
false
;
...
...
@@ -2098,6 +2098,18 @@ void tscDoQuery(SSqlObj* pSql) {
}
else
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
uint16_t
type
=
pQueryInfo
->
type
;
if
(
pQueryInfo
!=
0
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pTableMetaInfo
!=
NULL
)
{
// for select query super table, the super table vgroup list can not be null in any cases.
if
(
pQueryInfo
->
command
==
TSDB_SQL_SELECT
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
if
(
pTableMetaInfo
->
pVgroupTables
==
0
)
{
tscError
(
"error !!!%p, vgroupTable is null"
,
pSql
);
}
}
}
}
if
(
pSql
->
fp
==
(
void
(
*
)())
tscHandleMultivnodeInsert
)
{
// multi-vnodes insertion
tscHandleMultivnodeInsert
(
pSql
);
...
...
src/inc/vnode.h
浏览文件 @
65e7a9e8
...
...
@@ -41,6 +41,8 @@ typedef struct {
SRpcMsg
rpcMsg
;
}
SReadMsg
;
extern
char
*
vnodeStatus
[];
int32_t
vnodeCreate
(
SMDCreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeDrop
(
int32_t
vgId
);
int32_t
vnodeOpen
(
int32_t
vgId
,
char
*
rootDir
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
65e7a9e8
...
...
@@ -57,6 +57,14 @@ int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; }
void
syncConfirmForward
(
tsync_h
shandle
,
uint64_t
version
,
int32_t
code
)
{}
#endif
char
*
vnodeStatus
[]
=
{
"init"
,
"ready"
,
"closing"
,
"updating"
,
"reset"
};
int32_t
vnodeInitResources
()
{
int
code
=
syncInit
();
if
(
code
!=
0
)
return
code
;
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
65e7a9e8
...
...
@@ -38,8 +38,7 @@ void vnodeInitReadFp(void) {
vnodeProcessReadMsgFp
[
TSDB_MSG_TYPE_FETCH
]
=
vnodeProcessFetchMsg
;
}
int32_t
vnodeProcessRead
(
void
*
param
,
SReadMsg
*
pReadMsg
)
{
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
param
;
static
int32_t
vnodeProcessReadImp
(
SVnodeObj
*
pVnode
,
SReadMsg
*
pReadMsg
)
{
int
msgType
=
pReadMsg
->
rpcMsg
.
msgType
;
if
(
vnodeProcessReadMsgFp
[
msgType
]
==
NULL
)
{
...
...
@@ -48,16 +47,23 @@ int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) {
}
if
(
pVnode
->
status
!=
TAOS_VN_STATUS_READY
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, vnode status is %d"
,
pVnode
->
vgId
,
taosMsg
[
msgType
],
pVnode
->
status
);
vDebug
(
"vgId:%d, msgType:%s not processed, vnode status is %s"
,
pVnode
->
vgId
,
taosMsg
[
msgType
],
vnodeStatus
[
pVnode
->
status
]);
return
TSDB_CODE_APP_NOT_READY
;
}
// tsdb may be in reset state
if
(
pVnode
->
tsdb
==
NULL
)
return
TSDB_CODE_APP_NOT_READY
;
if
(
pVnode
->
status
==
TAOS_VN_STATUS_CLOSING
)
return
TSDB_CODE_APP_NOT_READY
;
if
(
pVnode
->
tsdb
==
NULL
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, tsdb is null"
,
pVnode
->
vgId
,
taosMsg
[
msgType
]);
return
TSDB_CODE_APP_NOT_READY
;
}
if
(
pVnode
->
status
==
TAOS_VN_STATUS_CLOSING
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, vstatus is %s"
,
pVnode
->
vgId
,
taosMsg
[
msgType
],
vnodeStatus
[
pVnode
->
status
]);
return
TSDB_CODE_APP_NOT_READY
;
}
// TODO: Later, let slave to support query
// if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) {
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_SLAVE
&&
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, replica:%d role:%s"
,
pVnode
->
vgId
,
taosMsg
[
msgType
],
pVnode
->
syncCfg
.
replica
,
syncRole
[
pVnode
->
role
]);
...
...
@@ -67,6 +73,25 @@ int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) {
return
(
*
vnodeProcessReadMsgFp
[
msgType
])(
pVnode
,
pReadMsg
);
}
int32_t
vnodeProcessRead
(
void
*
param
,
SReadMsg
*
pRead
)
{
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
param
;
int32_t
code
=
vnodeProcessReadImp
(
pVnode
,
pRead
);
if
(
code
==
TSDB_CODE_APP_NOT_READY
&&
pRead
->
rpcMsg
.
msgType
==
TSDB_MSG_TYPE_QUERY
)
{
// After the fetch request enters the vnode queue
// If the vnode cannot provide services, the following operations are still required
// Or there will be a deadlock
void
**
qhandle
=
(
void
**
)
pRead
->
pCont
;
vError
(
"QInfo:%p msg:%p will be killed for vstatus is %s"
,
*
qhandle
,
pRead
,
vnodeStatus
[
pVnode
->
status
]);
qKillQuery
(
*
qhandle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
true
);
return
TSDB_CODE_APP_NOT_READY
;
}
else
{
return
code
;
}
}
static
void
vnodePutItemIntoReadQueue
(
SVnodeObj
*
pVnode
,
void
**
qhandle
)
{
SReadMsg
*
pRead
=
(
SReadMsg
*
)
taosAllocateQitem
(
sizeof
(
SReadMsg
));
pRead
->
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_QUERY
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录