Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b08ee99c
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b08ee99c
编写于
12月 02, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: vgroup array not made in some cases
上级
3c1e52eb
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
62 addition
and
44 deletion
+62
-44
include/libs/qcom/query.h
include/libs/qcom/query.h
+1
-0
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+1
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+5
-9
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+12
-16
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+29
-16
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+14
-2
未找到文件。
include/libs/qcom/query.h
浏览文件 @
b08ee99c
...
@@ -239,6 +239,7 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t
...
@@ -239,6 +239,7 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t
char
*
parseTagDatatoJson
(
void
*
p
);
char
*
parseTagDatatoJson
(
void
*
p
);
int32_t
cloneTableMeta
(
STableMeta
*
pSrc
,
STableMeta
**
pDst
);
int32_t
cloneTableMeta
(
STableMeta
*
pSrc
,
STableMeta
**
pDst
);
int32_t
cloneDbVgInfo
(
SDBVgInfo
*
pSrc
,
SDBVgInfo
**
pDst
);
int32_t
cloneDbVgInfo
(
SDBVgInfo
*
pSrc
,
SDBVgInfo
**
pDst
);
void
freeVgInfo
(
SDBVgInfo
*
vgInfo
);
extern
int32_t
(
*
queryBuildMsg
[
TDMT_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
,
extern
int32_t
(
*
queryBuildMsg
[
TDMT_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
,
void
*
(
*
mallocFp
)(
int64_t
));
void
*
(
*
mallocFp
)(
int64_t
));
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
b08ee99c
...
@@ -762,7 +762,6 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
...
@@ -762,7 +762,6 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
int32_t
ctgGenerateVgList
(
SCatalog
*
pCtg
,
SHashObj
*
vgHash
,
SArray
**
pList
);
int32_t
ctgGenerateVgList
(
SCatalog
*
pCtg
,
SHashObj
*
vgHash
,
SArray
**
pList
);
void
ctgFreeJob
(
void
*
job
);
void
ctgFreeJob
(
void
*
job
);
void
ctgFreeHandleImpl
(
SCatalog
*
pCtg
);
void
ctgFreeHandleImpl
(
SCatalog
*
pCtg
);
void
ctgFreeVgInfo
(
SDBVgInfo
*
vgInfo
);
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
SCtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
SCtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
char
*
dbFName
,
SArray
*
pNames
,
bool
update
);
char
*
dbFName
,
SArray
*
pNames
,
bool
update
);
...
@@ -790,6 +789,7 @@ int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName*
...
@@ -790,6 +789,7 @@ int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName*
SName
*
ctgGetFetchName
(
SArray
*
pNames
,
SCtgFetch
*
pFetch
);
SName
*
ctgGetFetchName
(
SArray
*
pNames
,
SCtgFetch
*
pFetch
);
int32_t
ctgdGetOneHandle
(
SCatalog
**
pHandle
);
int32_t
ctgdGetOneHandle
(
SCatalog
**
pHandle
);
int
ctgVgInfoComp
(
const
void
*
lp
,
const
void
*
rp
);
int
ctgVgInfoComp
(
const
void
*
lp
,
const
void
*
rp
);
int32_t
ctgMakeVgArray
(
SDBVgInfo
*
dbInfo
);
extern
SCatalogMgmt
gCtgMgmt
;
extern
SCatalogMgmt
gCtgMgmt
;
extern
SCtgDebug
gCTGDebug
;
extern
SCtgDebug
gCTGDebug
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
b08ee99c
...
@@ -505,8 +505,7 @@ _return:
...
@@ -505,8 +505,7 @@ _return:
taosMemoryFreeClear
(
tbMeta
);
taosMemoryFreeClear
(
tbMeta
);
if
(
vgInfo
)
{
if
(
vgInfo
)
{
taosHashCleanup
(
vgInfo
->
vgHash
);
freeVgInfo
(
vgInfo
);
taosMemoryFreeClear
(
vgInfo
);
}
}
if
(
vgList
)
{
if
(
vgList
)
{
...
@@ -546,8 +545,7 @@ _return:
...
@@ -546,8 +545,7 @@ _return:
}
}
if
(
vgInfo
)
{
if
(
vgInfo
)
{
taosHashCleanup
(
vgInfo
->
vgHash
);
freeVgInfo
(
vgInfo
);
taosMemoryFreeClear
(
vgInfo
);
}
}
CTG_RET
(
code
);
CTG_RET
(
code
);
...
@@ -778,8 +776,7 @@ _return:
...
@@ -778,8 +776,7 @@ _return:
}
}
if
(
vgInfo
)
{
if
(
vgInfo
)
{
taosHashCleanup
(
vgInfo
->
vgHash
);
freeVgInfo
(
vgInfo
);
taosMemoryFreeClear
(
vgInfo
);
}
}
CTG_API_LEAVE
(
code
);
CTG_API_LEAVE
(
code
);
...
@@ -836,8 +833,7 @@ _return:
...
@@ -836,8 +833,7 @@ _return:
ctgRUnlockVgInfo
(
dbCache
);
ctgRUnlockVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
else
if
(
dbInfo
)
{
}
else
if
(
dbInfo
)
{
taosHashCleanup
(
dbInfo
->
vgHash
);
freeVgInfo
(
dbInfo
);
taosMemoryFreeClear
(
dbInfo
);
}
}
CTG_API_LEAVE
(
code
);
CTG_API_LEAVE
(
code
);
...
@@ -849,7 +845,7 @@ int32_t catalogUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId
...
@@ -849,7 +845,7 @@ int32_t catalogUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
NULL
==
pCtg
||
NULL
==
dbFName
||
NULL
==
dbInfo
)
{
if
(
NULL
==
pCtg
||
NULL
==
dbFName
||
NULL
==
dbInfo
)
{
ctgF
reeVgInfo
(
dbInfo
);
f
reeVgInfo
(
dbInfo
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INVALID_INPUT
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
}
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
b08ee99c
...
@@ -843,7 +843,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
...
@@ -843,7 +843,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
if
(
NULL
==
msg
)
{
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgUpdateVgMsg
));
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgUpdateVgMsg
));
taosMemoryFree
(
op
);
taosMemoryFree
(
op
);
ctgF
reeVgInfo
(
dbInfo
);
f
reeVgInfo
(
dbInfo
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
...
@@ -852,16 +852,12 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
...
@@ -852,16 +852,12 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
dbFName
=
p
+
1
;
dbFName
=
p
+
1
;
}
}
if
(
dbInfo
->
vgHash
&&
NULL
==
dbInfo
->
vgArray
)
{
code
=
ctgMakeVgArray
(
dbInfo
);
dbInfo
->
vgArray
=
taosArrayInit
(
100
,
sizeof
(
SVgroupInfo
));
if
(
code
)
{
taosMemoryFree
(
op
);
void
*
pIter
=
taosHashIterate
(
dbInfo
->
vgHash
,
NULL
);
taosMemoryFree
(
msg
);
while
(
pIter
)
{
freeVgInfo
(
dbInfo
);
taosArrayPush
(
dbInfo
->
vgArray
,
pIter
);
CTG_ERR_RET
(
code
);
pIter
=
taosHashIterate
(
dbInfo
->
vgHash
,
pIter
);
}
taosArraySort
(
dbInfo
->
vgArray
,
ctgVgInfoComp
);
}
}
tstrncpy
(
msg
->
dbFName
,
dbFName
,
sizeof
(
msg
->
dbFName
));
tstrncpy
(
msg
->
dbFName
,
dbFName
,
sizeof
(
msg
->
dbFName
));
...
@@ -877,7 +873,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
...
@@ -877,7 +873,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
_return:
_return:
ctgF
reeVgInfo
(
dbInfo
);
f
reeVgInfo
(
dbInfo
);
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
...
@@ -1675,7 +1671,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
...
@@ -1675,7 +1671,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
goto
_return
;
goto
_return
;
}
}
ctgF
reeVgInfo
(
vgInfo
);
f
reeVgInfo
(
vgInfo
);
}
}
vgCache
->
vgInfo
=
dbInfo
;
vgCache
->
vgInfo
=
dbInfo
;
...
@@ -1696,7 +1692,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
...
@@ -1696,7 +1692,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
_return:
_return:
ctgF
reeVgInfo
(
msg
->
dbInfo
);
f
reeVgInfo
(
msg
->
dbInfo
);
taosMemoryFreeClear
(
msg
);
taosMemoryFreeClear
(
msg
);
CTG_RET
(
code
);
CTG_RET
(
code
);
...
@@ -1749,7 +1745,7 @@ int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) {
...
@@ -1749,7 +1745,7 @@ int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) {
CTG_ERR_JRET
(
ctgWLockVgInfo
(
pCtg
,
dbCache
));
CTG_ERR_JRET
(
ctgWLockVgInfo
(
pCtg
,
dbCache
));
ctgF
reeVgInfo
(
dbCache
->
vgCache
.
vgInfo
);
f
reeVgInfo
(
dbCache
->
vgCache
.
vgInfo
);
dbCache
->
vgCache
.
vgInfo
=
NULL
;
dbCache
->
vgCache
.
vgInfo
=
NULL
;
ctgDebug
(
"db vgInfo removed, dbFName:%s"
,
msg
->
dbFName
);
ctgDebug
(
"db vgInfo removed, dbFName:%s"
,
msg
->
dbFName
);
...
@@ -2139,7 +2135,7 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) {
...
@@ -2139,7 +2135,7 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) {
switch
(
op
->
opId
)
{
switch
(
op
->
opId
)
{
case
CTG_OP_UPDATE_VGROUP
:
{
case
CTG_OP_UPDATE_VGROUP
:
{
SCtgUpdateVgMsg
*
msg
=
op
->
data
;
SCtgUpdateVgMsg
*
msg
=
op
->
data
;
ctgF
reeVgInfo
(
msg
->
dbInfo
);
f
reeVgInfo
(
msg
->
dbInfo
);
taosMemoryFreeClear
(
op
->
data
);
taosMemoryFreeClear
(
op
->
data
);
break
;
break
;
}
}
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
b08ee99c
...
@@ -231,18 +231,7 @@ void ctgFreeTbCache(SCtgDBCache* dbCache) {
...
@@ -231,18 +231,7 @@ void ctgFreeTbCache(SCtgDBCache* dbCache) {
CTG_CACHE_STAT_DEC
(
numOfTbl
,
tblNum
);
CTG_CACHE_STAT_DEC
(
numOfTbl
,
tblNum
);
}
}
void
ctgFreeVgInfo
(
SDBVgInfo
*
vgInfo
)
{
void
ctgFreeVgInfoCache
(
SCtgDBCache
*
dbCache
)
{
freeVgInfo
(
dbCache
->
vgCache
.
vgInfo
);
}
if
(
NULL
==
vgInfo
)
{
return
;
}
taosHashCleanup
(
vgInfo
->
vgHash
);
taosArrayDestroy
(
vgInfo
->
vgArray
);
taosMemoryFreeClear
(
vgInfo
);
}
void
ctgFreeVgInfoCache
(
SCtgDBCache
*
dbCache
)
{
ctgFreeVgInfo
(
dbCache
->
vgCache
.
vgInfo
);
}
void
ctgFreeDbCache
(
SCtgDBCache
*
dbCache
)
{
void
ctgFreeDbCache
(
SCtgDBCache
*
dbCache
)
{
if
(
NULL
==
dbCache
)
{
if
(
NULL
==
dbCache
)
{
...
@@ -364,8 +353,7 @@ void ctgFreeSUseDbOutput(SUseDbOutput* pOutput) {
...
@@ -364,8 +353,7 @@ void ctgFreeSUseDbOutput(SUseDbOutput* pOutput) {
}
}
if
(
pOutput
->
dbVgroup
)
{
if
(
pOutput
->
dbVgroup
)
{
taosHashCleanup
(
pOutput
->
dbVgroup
->
vgHash
);
freeVgInfo
(
pOutput
->
dbVgroup
);
taosMemoryFreeClear
(
pOutput
->
dbVgroup
);
}
}
taosMemoryFree
(
pOutput
);
taosMemoryFree
(
pOutput
);
...
@@ -571,8 +559,7 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void** pRes) {
...
@@ -571,8 +559,7 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void** pRes) {
case
CTG_TASK_GET_DB_VGROUP
:
{
case
CTG_TASK_GET_DB_VGROUP
:
{
if
(
*
pRes
)
{
if
(
*
pRes
)
{
SDBVgInfo
*
pInfo
=
(
SDBVgInfo
*
)
*
pRes
;
SDBVgInfo
*
pInfo
=
(
SDBVgInfo
*
)
*
pRes
;
taosHashCleanup
(
pInfo
->
vgHash
);
freeVgInfo
(
pInfo
);
taosMemoryFreeClear
(
*
pRes
);
}
}
break
;
break
;
}
}
...
@@ -1035,7 +1022,33 @@ int32_t ctgDbVgVersionSortCompare(const void* key1, const void* key2) {
...
@@ -1035,7 +1022,33 @@ int32_t ctgDbVgVersionSortCompare(const void* key1, const void* key2) {
}
}
}
}
int32_t
ctgMakeVgArray
(
SDBVgInfo
*
dbInfo
)
{
if
(
NULL
==
dbInfo
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
dbInfo
->
vgHash
&&
NULL
==
dbInfo
->
vgArray
)
{
dbInfo
->
vgArray
=
taosArrayInit
(
100
,
sizeof
(
SVgroupInfo
));
if
(
NULL
==
dbInfo
->
vgArray
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
void
*
pIter
=
taosHashIterate
(
dbInfo
->
vgHash
,
NULL
);
while
(
pIter
)
{
taosArrayPush
(
dbInfo
->
vgArray
,
pIter
);
pIter
=
taosHashIterate
(
dbInfo
->
vgHash
,
pIter
);
}
taosArraySort
(
dbInfo
->
vgArray
,
ctgVgInfoComp
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgCloneVgInfo
(
SDBVgInfo
*
src
,
SDBVgInfo
**
dst
)
{
int32_t
ctgCloneVgInfo
(
SDBVgInfo
*
src
,
SDBVgInfo
**
dst
)
{
CTG_ERR_RET
(
ctgMakeVgArray
(
src
));
*
dst
=
taosMemoryMalloc
(
sizeof
(
SDBVgInfo
));
*
dst
=
taosMemoryMalloc
(
sizeof
(
SDBVgInfo
));
if
(
NULL
==
*
dst
)
{
if
(
NULL
==
*
dst
)
{
qError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SDBVgInfo
));
qError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SDBVgInfo
));
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
b08ee99c
...
@@ -447,6 +447,19 @@ int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
...
@@ -447,6 +447,19 @@ int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
freeVgInfo
(
SDBVgInfo
*
vgInfo
)
{
if
(
NULL
==
vgInfo
)
{
return
;
}
taosHashCleanup
(
vgInfo
->
vgHash
);
taosArrayDestroy
(
vgInfo
->
vgArray
);
taosMemoryFreeClear
(
vgInfo
);
}
int32_t
cloneDbVgInfo
(
SDBVgInfo
*
pSrc
,
SDBVgInfo
**
pDst
)
{
int32_t
cloneDbVgInfo
(
SDBVgInfo
*
pSrc
,
SDBVgInfo
**
pDst
)
{
if
(
NULL
==
pSrc
)
{
if
(
NULL
==
pSrc
)
{
*
pDst
=
NULL
;
*
pDst
=
NULL
;
...
@@ -475,8 +488,7 @@ int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst) {
...
@@ -475,8 +488,7 @@ int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst) {
if
(
0
!=
taosHashPut
((
*
pDst
)
->
vgHash
,
vgId
,
sizeof
(
*
vgId
),
vgInfo
,
sizeof
(
*
vgInfo
)))
{
if
(
0
!=
taosHashPut
((
*
pDst
)
->
vgHash
,
vgId
,
sizeof
(
*
vgId
),
vgInfo
,
sizeof
(
*
vgInfo
)))
{
qError
(
"taosHashPut failed, vgId:%d"
,
vgInfo
->
vgId
);
qError
(
"taosHashPut failed, vgId:%d"
,
vgInfo
->
vgId
);
taosHashCancelIterate
(
pSrc
->
vgHash
,
pIter
);
taosHashCancelIterate
(
pSrc
->
vgHash
,
pIter
);
taosHashCleanup
((
*
pDst
)
->
vgHash
);
freeVgInfo
(
*
pDst
);
taosMemoryFreeClear
(
*
pDst
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录