Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a353b1a1
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看板
提交
a353b1a1
编写于
5月 20, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refresh meta
上级
40a3f024
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
38 deletion
+62
-38
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+37
-17
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+3
-8
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+1
-1
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+1
-2
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+18
-10
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
a353b1a1
...
...
@@ -299,6 +299,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
schedulerFreeJob
(
pRequest
->
body
.
queryJob
);
}
*
pRes
=
res
.
res
;
pRequest
->
code
=
code
;
terrno
=
code
;
return
pRequest
->
code
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
a353b1a1
...
...
@@ -2885,7 +2885,7 @@ _return:
int32_t
ctgGetTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
)
{
int32_t
ctgGetTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
,
int32_t
*
tbType
,
uint64_t
*
suid
,
char
*
stbName
)
{
*
sver
=
-
1
;
if
(
NULL
==
pCtg
->
dbCache
)
{
...
...
@@ -2903,14 +2903,12 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
return
TSDB_CODE_SUCCESS
;
}
int32_t
tbType
=
0
;
uint64_t
suid
=
0
;
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
STableMeta
*
tbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
metaCache
,
pTableName
->
tname
,
strlen
(
pTableName
->
tname
));
if
(
tbMeta
)
{
tbType
=
tbMeta
->
tableType
;
suid
=
tbMeta
->
suid
;
if
(
tbType
!=
TSDB_CHILD_TABLE
)
{
*
tbType
=
tbMeta
->
tableType
;
*
suid
=
tbMeta
->
suid
;
if
(
*
tbType
!=
TSDB_CHILD_TABLE
)
{
*
sver
=
tbMeta
->
sversion
;
}
}
...
...
@@ -2921,44 +2919,49 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
return
TSDB_CODE_SUCCESS
;
}
if
(
tbType
!=
TSDB_CHILD_TABLE
)
{
if
(
*
tbType
!=
TSDB_CHILD_TABLE
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
tbType
,
dbFName
,
pTableName
->
tname
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
*
tbType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
ctgDebug
(
"Got subtable meta from cache, dbFName:%s, tbName:%s, suid:%"
PRIx64
,
dbFName
,
pTableName
->
tname
,
suid
);
ctgDebug
(
"Got subtable meta from cache, dbFName:%s, tbName:%s, suid:%"
PRIx64
,
dbFName
,
pTableName
->
tname
,
*
suid
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
&
suid
,
sizeof
(
suid
));
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
suid
,
sizeof
(
*
suid
));
if
(
NULL
==
stbMeta
||
NULL
==
*
stbMeta
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"stb not in stbCache, suid:%"
PRIx64
,
suid
);
ctgDebug
(
"stb not in stbCache, suid:%"
PRIx64
,
*
suid
);
return
TSDB_CODE_SUCCESS
;
}
if
((
*
stbMeta
)
->
suid
!=
suid
)
{
if
((
*
stbMeta
)
->
suid
!=
*
suid
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgError
(
"stable suid in stbCache mis-match, expected suid:%"
PRIx64
",actual suid:%"
PRIx64
,
suid
,
(
*
stbMeta
)
->
suid
);
ctgError
(
"stable suid in stbCache mis-match, expected suid:%"
PRIx64
",actual suid:%"
PRIx64
,
*
suid
,
(
*
stbMeta
)
->
suid
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
size_t
nameLen
=
0
;
char
*
name
=
taosHashGetKey
(
*
stbMeta
,
&
nameLen
);
strncpy
(
stbName
,
name
,
nameLen
);
stbName
[
nameLen
]
=
0
;
*
sver
=
(
*
stbMeta
)
->
sversion
;
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
tbType
,
dbFName
,
pTableName
->
tname
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
*
tbType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogChkTbMetaVersion
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
SArray
*
pTables
)
{
CTG_API_ENTER
();
...
...
@@ -2977,9 +2980,26 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm
continue
;
}
ctgGetTbSverFromCache
(
pCtg
,
&
name
,
&
sver
);
int32_t
tbType
=
0
;
uint64_t
suid
=
0
;
char
stbName
[
TSDB_TABLE_FNAME_LEN
];
ctgGetTbSverFromCache
(
pCtg
,
&
name
,
&
sver
,
&
tbType
,
&
suid
,
stbName
);
if
(
sver
>=
0
&&
sver
<
pTb
->
sver
)
{
catalogRemoveTableMeta
(
pCtg
,
&
name
);
//TODO REMOVE STB FROM CACHE
switch
(
tbType
)
{
case
TSDB_CHILD_TABLE
:
{
SName
stb
=
name
;
strcpy
(
stb
.
tname
,
stbName
);
catalogRemoveTableMeta
(
pCtg
,
&
stb
);
break
;
}
case
TSDB_SUPER_TABLE
:
case
TSDB_NORMAL_TABLE
:
catalogRemoveTableMeta
(
pCtg
,
&
name
);
break
;
default:
ctgError
(
"ignore table type %d"
,
tbType
);
break
;
}
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
a353b1a1
...
...
@@ -4576,10 +4576,11 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t*
return
pExprs
;
}
static
SExecTaskInfo
*
createExecTaskInfo
(
uint64_t
queryId
,
uint64_t
taskId
,
EOPTR_EXEC_MODEL
model
)
{
static
SExecTaskInfo
*
createExecTaskInfo
(
uint64_t
queryId
,
uint64_t
taskId
,
EOPTR_EXEC_MODEL
model
,
char
*
dbFName
)
{
SExecTaskInfo
*
pTaskInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SExecTaskInfo
));
setTaskStatus
(
pTaskInfo
,
TASK_NOT_COMPLETED
);
pTaskInfo
->
schemaVer
.
dbname
=
strdup
(
dbFName
);
pTaskInfo
->
cost
.
created
=
taosGetTimestampMs
();
pTaskInfo
->
id
.
queryId
=
queryId
;
pTaskInfo
->
execModel
=
model
;
...
...
@@ -4994,16 +4995,10 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod
return
NULL
;
}
const
char
*
tname
=
pTaskInfo
->
schemaVer
.
tablename
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
STargetNode
*
pNode
=
(
STargetNode
*
)
nodesListGetNode
(
pNodeList
,
i
);
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
pNode
->
pExpr
;
if
(
tname
!=
NULL
&&
(
pTaskInfo
->
schemaVer
.
dbname
==
NULL
)
&&
strncmp
(
pColNode
->
tableName
,
tname
,
tListLen
(
pColNode
->
tableName
))
==
0
)
{
pTaskInfo
->
schemaVer
.
dbname
=
strdup
(
pColNode
->
dbName
);
}
SColMatchInfo
c
=
{
0
};
c
.
output
=
true
;
c
.
colId
=
pColNode
->
colId
;
...
...
@@ -5099,7 +5094,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
uint64_t
queryId
=
pPlan
->
id
.
queryId
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
*
pTaskInfo
=
createExecTaskInfo
(
queryId
,
taskId
,
model
);
*
pTaskInfo
=
createExecTaskInfo
(
queryId
,
taskId
,
model
,
pPlan
->
dbFName
);
if
(
*
pTaskInfo
==
NULL
)
{
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_complete
;
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
a353b1a1
...
...
@@ -58,7 +58,7 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen
// 3. valid column names
for
(
int32_t
j
=
i
+
1
;
j
<
numOfCols
;
++
j
)
{
if
(
strnc
asec
mp
(
pSchema
[
i
].
name
,
pSchema
[
j
].
name
,
sizeof
(
pSchema
[
i
].
name
)
-
1
)
==
0
)
{
if
(
strncmp
(
pSchema
[
i
].
name
,
pSchema
[
j
].
name
,
sizeof
(
pSchema
[
i
].
name
)
-
1
)
==
0
)
{
return
false
;
}
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
a353b1a1
...
...
@@ -1161,8 +1161,7 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
QW_ERR_JRET
(
qwGetResFromSink
(
QW_FPARAMS
(),
ctx
,
&
dataLen
,
&
rsp
,
&
sOutput
));
if
(
NULL
==
rsp
)
{
atomic_store_ptr
(
&
ctx
->
dataConnInfo
.
handle
,
qwMsg
->
connInfo
.
handle
);
atomic_store_ptr
(
&
ctx
->
dataConnInfo
.
ahandle
,
qwMsg
->
connInfo
.
ahandle
);
ctx
->
dataConnInfo
=
qwMsg
->
connInfo
;
QW_SET_EVENT_RECEIVED
(
ctx
,
QW_EVENT_FETCH
);
}
else
{
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
a353b1a1
...
...
@@ -2565,24 +2565,32 @@ int32_t schedulerExecJob(void *transport, SArray *nodeList, SQueryPlan *pDag, in
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
int32_t
code
=
0
;
*
pJob
=
0
;
if
(
EXPLAIN_MODE_STATIC
==
pDag
->
explainInfo
.
mode
)
{
SCH_ERR_RET
(
schExecStaticExplain
(
transport
,
nodeList
,
pDag
,
pJob
,
sql
,
true
));
}
else
{
SCH_ERR_RET
(
schExecJobImpl
(
transport
,
nodeList
,
pDag
,
pJob
,
sql
,
startTs
,
true
));
SCH_ERR_
J
RET
(
schExecJobImpl
(
transport
,
nodeList
,
pDag
,
pJob
,
sql
,
startTs
,
true
));
}
SSchJob
*
job
=
schAcquireJob
(
*
pJob
);
_return:
pRes
->
code
=
atomic_load_32
(
&
job
->
errCode
);
pRes
->
numOfRows
=
job
->
resNumOfRows
;
if
(
SCH_RES_TYPE_QUERY
==
job
->
resType
)
{
pRes
->
res
=
job
->
resData
;
job
->
resData
=
NULL
;
}
if
(
*
pJob
)
{
SSchJob
*
job
=
schAcquireJob
(
*
pJob
);
schReleaseJob
(
*
pJob
);
pRes
->
code
=
atomic_load_32
(
&
job
->
errCode
);
pRes
->
numOfRows
=
job
->
resNumOfRows
;
if
(
SCH_RES_TYPE_QUERY
==
job
->
resType
)
{
pRes
->
res
=
job
->
resData
;
job
->
resData
=
NULL
;
}
return
TSDB_CODE_SUCCESS
;
schReleaseJob
(
*
pJob
);
}
return
code
;
}
int32_t
schedulerAsyncExecJob
(
void
*
transport
,
SArray
*
pNodeList
,
SQueryPlan
*
pDag
,
const
char
*
sql
,
int64_t
*
pJob
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录