Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XKZJ_WCL
TDengine
提交
b90807ce
T
TDengine
项目概览
XKZJ_WCL
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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,发现更多精彩内容 >>
提交
b90807ce
编写于
10月 22, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1373]
上级
e06d7083
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
94 addition
and
16 deletion
+94
-16
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+3
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+27
-0
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+63
-14
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
b90807ce
...
...
@@ -215,7 +215,7 @@ SQueryInfo *tscGetQueryInfoDetailSafely(SSqlCmd *pCmd, int32_t subClauseIndex);
void
tscClearTableMetaInfo
(
STableMetaInfo
*
pTableMetaInfo
,
bool
removeFromCache
);
STableMetaInfo
*
tscAddTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
SVgroupsInfo
*
vgroupList
,
SArray
*
pTagCols
);
SVgroupsInfo
*
vgroupList
,
SArray
*
pTagCols
,
SArray
*
pVgroupTables
);
STableMetaInfo
*
tscAddEmptyMetaInfo
(
SQueryInfo
*
pQueryInfo
);
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
);
...
...
@@ -224,6 +224,8 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo);
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscFreeVgroupTableInfo
(
SArray
*
pVgroupTables
);
SArray
*
tscCloneVgroupTableInfo
(
SArray
*
pVgroupTables
);
void
tscRemoveVgroupTableGroup
(
SArray
*
pVgroupTable
,
int32_t
index
);
int
tscGetSTableVgroupInfo
(
SSqlObj
*
pSql
,
int32_t
clauseIndex
);
int
tscGetTableMeta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
);
...
...
src/client/src/tscServer.c
浏览文件 @
b90807ce
...
...
@@ -2283,7 +2283,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pMInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
STableMeta
*
pTableMeta
=
taosCacheAcquireByData
(
tscMetaCache
,
pMInfo
->
pTableMeta
);
tscAddTableMetaInfo
(
pNewQueryInfo
,
pMInfo
->
name
,
pTableMeta
,
NULL
,
pMInfo
->
tagColList
);
tscAddTableMetaInfo
(
pNewQueryInfo
,
pMInfo
->
name
,
pTableMeta
,
NULL
,
pMInfo
->
tagColList
,
pMInfo
->
pVgroupTables
);
}
if
((
code
=
tscAllocPayload
(
&
pNew
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSubquery.c
浏览文件 @
b90807ce
...
...
@@ -360,6 +360,31 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
pExpr
->
numOfParams
=
1
;
}
int32_t
num
=
0
;
int32_t
*
list
=
NULL
;
tsBufGetVnodeIdList
(
pSupporter
->
pTSBuf
,
&
num
,
&
list
);
for
(
int32_t
k
=
0
;
k
<
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);)
{
SVgroupTableInfo
*
p
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
k
);
bool
found
=
false
;
for
(
int32_t
f
=
0
;
f
<
num
;
++
f
)
{
if
(
p
->
vgInfo
.
vgId
==
list
[
f
])
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
tscRemoveVgroupTableGroup
(
pTableMetaInfo
->
pVgroupTables
,
k
);
}
else
{
k
++
;
}
}
taosTFree
(
list
);
assert
(
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
)
>
0
);
size_t
numOfCols
=
taosArrayGetSize
(
pNewQueryInfo
->
colList
);
tscDebug
(
"%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%"
PRIzu
", colList:%"
PRIzu
", fieldsInfo:%d, name:%s"
,
pSql
,
pNew
,
0
,
pTableMetaInfo
->
vgroupIndex
,
pNewQueryInfo
->
type
,
taosArrayGetSize
(
pNewQueryInfo
->
exprList
),
...
...
@@ -828,6 +853,8 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
// launch the query the retrieve actual results from vnode along with the filtered timestamp
SQueryInfo
*
pPQueryInfo
=
tscGetQueryInfoDetail
(
&
pParentSql
->
cmd
,
pParentSql
->
cmd
.
clauseIndex
);
updateQueryTimeRange
(
pPQueryInfo
,
&
win
);
//update the vgroup that involved in real data query
tscLaunchRealSubqueries
(
pParentSql
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
b90807ce
...
...
@@ -1680,19 +1680,64 @@ void tscClearSubqueryInfo(SSqlCmd* pCmd) {
}
void
tscFreeVgroupTableInfo
(
SArray
*
pVgroupTables
)
{
if
(
pVgroupTables
!=
NULL
)
{
size_t
num
=
taosArrayGetSize
(
pVgroupTables
);
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTables
,
i
);
if
(
pVgroupTables
==
NULL
)
{
return
;
}
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
taosTFree
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
size_t
num
=
taosArrayGetSize
(
pVgroupTables
);
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTables
,
i
);
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
taosTFree
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
taosArrayDestroy
(
pInfo
->
itemList
);
}
taosArrayDestroy
(
pVgroupTables
);
}
void
tscRemoveVgroupTableGroup
(
SArray
*
pVgroupTable
,
int32_t
index
)
{
assert
(
pVgroupTable
!=
NULL
&&
index
>=
0
);
size_t
size
=
taosArrayGetSize
(
pVgroupTable
);
assert
(
size
>
index
);
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTable
,
index
);
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
taosTFree
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
taosArrayDestroy
(
pInfo
->
itemList
);
taosArrayDestroy
(
pInfo
->
itemList
);
taosArrayRemove
(
pVgroupTable
,
index
);
}
SArray
*
tscCloneVgroupTableInfo
(
SArray
*
pVgroupTables
)
{
if
(
pVgroupTables
==
NULL
)
{
return
NULL
;
}
size_t
num
=
taosArrayGetSize
(
pVgroupTables
);
SArray
*
pa
=
taosArrayInit
(
num
,
sizeof
(
SVgroupTableInfo
));
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTables
,
i
);
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
taosTFree
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
taosArrayDestroy
(
pVgroupTables
);
SVgroupTableInfo
info
=
{
0
};
info
.
vgInfo
=
pInfo
->
vgInfo
;
info
.
itemList
=
taosArrayClone
(
pInfo
->
itemList
);
taosArrayPush
(
pa
,
&
info
);
}
return
pa
;
}
void
clearAllTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
address
,
bool
removeFromCache
)
{
...
...
@@ -1710,7 +1755,7 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool rem
}
STableMetaInfo
*
tscAddTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
SVgroupsInfo
*
vgroupList
,
SArray
*
pTagCols
)
{
SVgroupsInfo
*
vgroupList
,
SArray
*
pTagCols
,
SArray
*
pVgroupTables
)
{
void
*
pAlloc
=
realloc
(
pQueryInfo
->
pTableMetaInfo
,
(
pQueryInfo
->
numOfTables
+
1
)
*
POINTER_BYTES
);
if
(
pAlloc
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
@@ -1744,13 +1789,15 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
if
(
pTagCols
!=
NULL
)
{
tscColumnListCopy
(
pTableMetaInfo
->
tagColList
,
pTagCols
,
-
1
);
}
pTableMetaInfo
->
pVgroupTables
=
tscCloneVgroupTableInfo
(
pVgroupTables
);
pQueryInfo
->
numOfTables
+=
1
;
return
pTableMetaInfo
;
}
STableMetaInfo
*
tscAddEmptyMetaInfo
(
SQueryInfo
*
pQueryInfo
)
{
return
tscAddTableMetaInfo
(
pQueryInfo
,
NULL
,
NULL
,
NULL
,
NULL
);
return
tscAddTableMetaInfo
(
pQueryInfo
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
}
void
tscClearTableMetaInfo
(
STableMetaInfo
*
pTableMetaInfo
,
bool
removeFromCache
)
{
...
...
@@ -1824,7 +1871,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm
assert
(
pSql
->
cmd
.
clauseIndex
==
0
);
STableMetaInfo
*
pMasterTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
,
0
);
tscAddTableMetaInfo
(
pQueryInfo
,
pMasterTableMetaInfo
->
name
,
NULL
,
NULL
,
NULL
);
tscAddTableMetaInfo
(
pQueryInfo
,
pMasterTableMetaInfo
->
name
,
NULL
,
NULL
,
NULL
,
NULL
);
registerSqlObj
(
pNew
);
return
pNew
;
...
...
@@ -1989,14 +2036,16 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
STableMeta
*
pTableMeta
=
taosCacheAcquireByData
(
tscMetaCache
,
pTableMetaInfo
->
pTableMeta
);
// get by name may failed due to the cache cleanup
assert
(
pTableMeta
!=
NULL
);
pFinalInfo
=
tscAddTableMetaInfo
(
pNewQueryInfo
,
name
,
pTableMeta
,
pTableMetaInfo
->
vgroupList
,
pTableMetaInfo
->
tagColList
);
pFinalInfo
=
tscAddTableMetaInfo
(
pNewQueryInfo
,
name
,
pTableMeta
,
pTableMetaInfo
->
vgroupList
,
pTableMetaInfo
->
tagColList
,
pTableMetaInfo
->
pVgroupTables
);
}
else
{
// transfer the ownership of pTableMeta to the newly create sql object.
STableMetaInfo
*
pPrevInfo
=
tscGetTableMetaInfoFromCmd
(
&
pPrevSql
->
cmd
,
pPrevSql
->
cmd
.
clauseIndex
,
0
);
STableMeta
*
pPrevTableMeta
=
taosCacheTransfer
(
tscMetaCache
,
(
void
**
)
&
pPrevInfo
->
pTableMeta
);
SVgroupsInfo
*
pVgroupsInfo
=
pPrevInfo
->
vgroupList
;
pFinalInfo
=
tscAddTableMetaInfo
(
pNewQueryInfo
,
name
,
pPrevTableMeta
,
pVgroupsInfo
,
pTableMetaInfo
->
tagColList
);
pFinalInfo
=
tscAddTableMetaInfo
(
pNewQueryInfo
,
name
,
pPrevTableMeta
,
pVgroupsInfo
,
pTableMetaInfo
->
tagColList
,
pTableMetaInfo
->
pVgroupTables
);
}
if
(
pFinalInfo
->
pTableMeta
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录