Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
313e7259
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
未验证
提交
313e7259
编写于
8月 08, 2022
作者:
D
dapan1121
提交者:
GitHub
8月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15855 from taosdata/fix/TD-18261
fix: fix catalog crash issue
上级
f25ca55a
d2819901
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
98 addition
and
12 deletion
+98
-12
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+1
-1
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+89
-6
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+8
-5
未找到文件。
source/libs/catalog/inc/catalogInt.h
浏览文件 @
313e7259
...
...
@@ -279,6 +279,7 @@ typedef struct SCtgMsgCtx {
void
*
lastOut
;
void
*
out
;
char
*
target
;
SHashObj
*
pBatchs
;
}
SCtgMsgCtx
;
...
...
@@ -315,7 +316,6 @@ typedef struct SCtgTask {
SRWLatch
lock
;
SArray
*
pParents
;
SCtgSubRes
subRes
;
SHashObj
*
pBatchs
;
}
SCtgTask
;
typedef
struct
SCtgTaskReq
{
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
313e7259
...
...
@@ -855,6 +855,7 @@ int32_t ctgCallSubCb(SCtgTask *pTask) {
int32_t
parentNum
=
taosArrayGetSize
(
pTask
->
pParents
);
for
(
int32_t
i
=
0
;
i
<
parentNum
;
++
i
)
{
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
SCtgTask
*
pParent
=
taosArrayGetP
(
pTask
->
pParents
,
i
);
pParent
->
subRes
.
code
=
pTask
->
code
;
...
...
@@ -865,7 +866,9 @@ int32_t ctgCallSubCb(SCtgTask *pTask) {
}
}
pParent
->
pBatchs
=
pTask
->
pBatchs
;
SCtgMsgCtx
*
pParMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pParent
,
-
1
);
pParMsgCtx
->
pBatchs
=
pMsgCtx
->
pBatchs
;
CTG_ERR_JRET
(
pParent
->
subRes
.
fp
(
pParent
));
}
...
...
@@ -1625,6 +1628,11 @@ _return:
int32_t
ctgLaunchGetTbMetaTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetTbMetaFromCache
(
pCtg
,
pConn
,
(
SCtgTbMetaCtx
*
)
pTask
->
taskCtx
,
(
STableMeta
**
)
&
pTask
->
res
));
if
(
pTask
->
res
)
{
...
...
@@ -1645,6 +1653,7 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask *pTask) {
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgTbMetasCtx
*
pCtx
=
(
SCtgTbMetasCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
int32_t
dbNum
=
taosArrayGetSize
(
pCtx
->
pNames
);
int32_t
fetchIdx
=
0
;
...
...
@@ -1670,7 +1679,11 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask *pTask) {
for
(
int32_t
i
=
0
;
i
<
pCtx
->
fetchNum
;
++
i
)
{
SCtgFetch
*
pFetch
=
taosArrayGet
(
pCtx
->
pFetchs
,
i
);
SName
*
pName
=
ctgGetFetchName
(
pCtx
->
pNames
,
pFetch
);
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
i
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
SCtgTaskReq
tReq
;
tReq
.
pTask
=
pTask
;
tReq
.
msgIdx
=
pFetch
->
fetchIdx
;
...
...
@@ -1686,6 +1699,11 @@ int32_t ctgLaunchGetDbVgTask(SCtgTask *pTask) {
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgDBCache
*
dbCache
=
NULL
;
SCtgDbVgCtx
*
pCtx
=
(
SCtgDbVgCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
pCtx
->
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
...
...
@@ -1722,6 +1740,11 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgDBCache
*
dbCache
=
NULL
;
SCtgTbHashCtx
*
pCtx
=
(
SCtgTbHashCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
pCtx
->
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
...
...
@@ -1761,6 +1784,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask *pTask) {
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgTbHashsCtx
*
pCtx
=
(
SCtgTbHashsCtx
*
)
pTask
->
taskCtx
;
SCtgDBCache
*
dbCache
=
NULL
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
int32_t
dbNum
=
taosArrayGetSize
(
pCtx
->
pNames
);
int32_t
fetchIdx
=
0
;
int32_t
baseResIdx
=
0
;
...
...
@@ -1803,7 +1827,11 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask *pTask) {
for
(
int32_t
i
=
0
;
i
<
pCtx
->
fetchNum
;
++
i
)
{
SCtgFetch
*
pFetch
=
taosArrayGet
(
pCtx
->
pFetchs
,
i
);
STablesReq
*
pReq
=
taosArrayGet
(
pCtx
->
pNames
,
pFetch
->
dbIdx
);
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
i
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
SBuildUseDBInput
input
=
{
0
};
strcpy
(
input
.
db
,
pReq
->
dbFName
);
...
...
@@ -1831,6 +1859,11 @@ int32_t ctgLaunchGetTbIndexTask(SCtgTask *pTask) {
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgTbIndexCtx
*
pCtx
=
(
SCtgTbIndexCtx
*
)
pTask
->
taskCtx
;
SArray
*
pRes
=
NULL
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgReadTbIndexFromCache
(
pCtg
,
pCtx
->
pName
,
&
pRes
));
if
(
pRes
)
{
...
...
@@ -1852,6 +1885,11 @@ int32_t ctgLaunchGetTbCfgTask(SCtgTask *pTask) {
SArray
*
pRes
=
NULL
;
char
dbFName
[
TSDB_DB_FNAME_LEN
];
tNameGetFullDbName
(
pCtx
->
pName
,
dbFName
);
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
if
(
pCtx
->
tbType
<=
0
)
{
CTG_ERR_JRET
(
ctgReadTbTypeFromCache
(
pCtg
,
dbFName
,
pCtx
->
pName
->
tname
,
&
pCtx
->
tbType
));
...
...
@@ -1890,6 +1928,11 @@ _return:
int32_t
ctgLaunchGetQnodeTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetQnodeListFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1898,6 +1941,11 @@ int32_t ctgLaunchGetQnodeTask(SCtgTask *pTask) {
int32_t
ctgLaunchGetDnodeTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetDnodeListFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1908,6 +1956,11 @@ int32_t ctgLaunchGetDbCfgTask(SCtgTask *pTask) {
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgDbCfgCtx
*
pCtx
=
(
SCtgDbCfgCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetDBCfgFromMnode
(
pCtg
,
pConn
,
pCtx
->
dbFName
,
NULL
,
pTask
));
...
...
@@ -1919,6 +1972,11 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask *pTask) {
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SCtgDBCache
*
dbCache
=
NULL
;
SCtgDbInfoCtx
*
pCtx
=
(
SCtgDbInfoCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
pTask
->
res
=
taosMemoryCalloc
(
1
,
sizeof
(
SDbInfo
));
if
(
NULL
==
pTask
->
res
)
{
...
...
@@ -1953,6 +2011,11 @@ int32_t ctgLaunchGetIndexTask(SCtgTask *pTask) {
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgIndexCtx
*
pCtx
=
(
SCtgIndexCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetIndexInfoFromMnode
(
pCtg
,
pConn
,
pCtx
->
indexFName
,
NULL
,
pTask
));
...
...
@@ -1963,6 +2026,11 @@ int32_t ctgLaunchGetUdfTask(SCtgTask *pTask) {
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgUdfCtx
*
pCtx
=
(
SCtgUdfCtx
*
)
pTask
->
taskCtx
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetUdfInfoFromMnode
(
pCtg
,
pConn
,
pCtx
->
udfName
,
NULL
,
pTask
));
...
...
@@ -1975,6 +2043,11 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
SCtgUserCtx
*
pCtx
=
(
SCtgUserCtx
*
)
pTask
->
taskCtx
;
bool
inCache
=
false
;
bool
pass
=
false
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgChkAuthFromCache
(
pCtg
,
pCtx
->
user
.
user
,
pCtx
->
user
.
dbFName
,
pCtx
->
user
.
type
,
&
inCache
,
&
pass
));
if
(
inCache
)
{
...
...
@@ -1996,6 +2069,11 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
int32_t
ctgLaunchGetSvrVerTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
if
(
NULL
==
pMsgCtx
->
pBatchs
)
{
pMsgCtx
->
pBatchs
=
pJob
->
pBatchs
;
}
CTG_ERR_RET
(
ctgGetSvrVerFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
...
...
@@ -2129,7 +2207,10 @@ int32_t ctgSetSubTaskCb(SCtgTask *pSub, SCtgTask *pTask) {
if
(
CTG_TASK_DONE
==
pSub
->
status
)
{
pTask
->
subRes
.
code
=
pSub
->
code
;
CTG_ERR_JRET
((
*
gCtgAsyncFps
[
pTask
->
type
].
cloneFp
)(
pSub
,
&
pTask
->
subRes
.
res
));
pTask
->
pBatchs
=
pSub
->
pBatchs
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
SCtgMsgCtx
*
pSubMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pSub
,
-
1
);
pMsgCtx
->
pBatchs
=
pSubMsgCtx
->
pBatchs
;
CTG_ERR_JRET
(
pTask
->
subRes
.
fp
(
pTask
));
}
else
{
if
(
NULL
==
pSub
->
pParents
)
{
...
...
@@ -2167,7 +2248,10 @@ int32_t ctgLaunchSubTask(SCtgTask *pTask, CTG_TASK_TYPE type, ctgSubTaskCbFp fp,
CTG_ERR_RET
(
ctgSetSubTaskCb
(
pSub
,
pTask
));
if
(
newTask
)
{
pSub
->
pBatchs
=
pTask
->
pBatchs
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
SCtgMsgCtx
*
pSubMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pSub
,
-
1
);
pSubMsgCtx
->
pBatchs
=
pMsgCtx
->
pBatchs
;
CTG_ERR_RET
((
*
gCtgAsyncFps
[
pSub
->
type
].
launchFp
)(
pSub
));
pSub
->
status
=
CTG_TASK_LAUNCHED
;
}
...
...
@@ -2180,7 +2264,6 @@ int32_t ctgLaunchJob(SCtgJob *pJob) {
for
(
int32_t
i
=
0
;
i
<
taskNum
;
++
i
)
{
SCtgTask
*
pTask
=
taosArrayGet
(
pJob
->
pTasks
,
i
);
pTask
->
pBatchs
=
pJob
->
pBatchs
;
qDebug
(
"QID:0x%"
PRIx64
" ctg launch [%dth] task"
,
pJob
->
queryId
,
pTask
->
taskId
);
CTG_ERR_RET
((
*
gCtgAsyncFps
[
pTask
->
type
].
launchFp
)(
pTask
));
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
313e7259
...
...
@@ -68,14 +68,14 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
taskMsg
.
pData
=
NULL
;
taskMsg
.
len
=
0
;
}
pTask
->
pBatchs
=
pBatchs
;
SCtgTaskReq
tReq
;
tReq
.
pTask
=
pTask
;
tReq
.
msgIdx
=
rsp
.
msgIdx
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
tReq
.
msgIdx
);
pMsgCtx
->
pBatchs
=
pBatchs
;
ctgDebug
(
"QID:0x%"
PRIx64
" ctg task %d idx %d start to handle rsp %s
"
,
pJob
->
queryId
,
pTask
->
taskId
,
rsp
.
msgIdx
,
TMSG_INFO
(
taskMsg
.
msgType
+
1
)
);
ctgDebug
(
"QID:0x%"
PRIx64
" ctg task %d idx %d start to handle rsp %s
, pBatchs: %p"
,
pJob
->
queryId
,
pTask
->
taskId
,
rsp
.
msgIdx
,
TMSG_INFO
(
taskMsg
.
msgType
+
1
),
pBatchs
);
(
*
gCtgAsyncFps
[
pTask
->
type
].
handleRspFp
)(
&
tReq
,
rsp
.
reqType
,
&
taskMsg
,
(
rsp
.
rspCode
?
rsp
.
rspCode
:
rspCode
));
}
...
...
@@ -343,7 +343,9 @@ int32_t ctgHandleMsgCallback(void* param, SDataBuf* pMsg, int32_t rspCode) {
ctgError
(
"taosHashInit %d batch failed"
,
CTG_DEFAULT_BATCH_NUM
);
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
pTask
->
pBatchs
=
pBatchs
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
-
1
);
pMsgCtx
->
pBatchs
=
pBatchs
;
#endif
SCtgTaskReq
tReq
;
...
...
@@ -444,7 +446,8 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo* pConn, SCtgT
uint32_t
msgSize
)
{
int32_t
code
=
0
;
SCtgTask
*
pTask
=
tReq
->
pTask
;
SHashObj
*
pBatchs
=
pTask
->
pBatchs
;
SCtgMsgCtx
*
pMsgCtx
=
CTG_GET_TASK_MSGCTX
(
pTask
,
tReq
->
msgIdx
);
SHashObj
*
pBatchs
=
pMsgCtx
->
pBatchs
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgBatch
*
pBatch
=
taosHashGet
(
pBatchs
,
&
vgId
,
sizeof
(
vgId
));
SCtgBatch
newBatch
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录