Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
31f3bed3
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看板
提交
31f3bed3
编写于
6月 11, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support index cache
上级
041002a5
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
642 addition
and
407 deletion
+642
-407
include/common/tmsg.h
include/common/tmsg.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+43
-17
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+29
-9
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+30
-14
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+456
-326
source/libs/catalog/src/ctgDbg.c
source/libs/catalog/src/ctgDbg.c
+4
-4
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+1
-4
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+59
-27
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+2
-2
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+7
-3
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+0
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+5
-0
source/util/src/tarray.c
source/util/src/tarray.c
+3
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
31f3bed3
...
...
@@ -2513,6 +2513,7 @@ typedef struct {
}
STableIndexInfo
;
typedef
struct
{
int32_t
version
;
SArray
*
pIndex
;
}
STableIndexRsp
;
...
...
source/common/src/tmsg.c
浏览文件 @
31f3bed3
...
...
@@ -2437,6 +2437,7 @@ int32_t tSerializeSTableIndexRsp(void *buf, int32_t bufLen, const STableIndexRsp
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
version
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
pIndex
);
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
if
(
num
>
0
)
{
...
...
@@ -2471,6 +2472,7 @@ int32_t tDeserializeSTableIndexRsp(void *buf, int32_t bufLen, STableIndexRsp *pR
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
version
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
if
(
num
>
0
)
{
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
31f3bed3
...
...
@@ -57,6 +57,8 @@ enum {
CTG_OP_DROP_TB_META
,
CTG_OP_UPDATE_USER
,
CTG_OP_UPDATE_VG_EPSET
,
CTG_OP_UPDATE_TB_INDEX
,
CTG_OP_DROP_TB_INDEX
,
CTG_OP_MAX
};
...
...
@@ -128,19 +130,27 @@ typedef struct SCtgUserCtx {
SUserAuthInfo
user
;
}
SCtgUserCtx
;
typedef
struct
SCtgTbMetaCache
{
SRWLatch
stbLock
;
SRWLatch
metaLock
;
// RC between cache destroy and all other operations
SHashObj
*
metaCache
;
//key:tbname, value:STableMeta
SHashObj
*
stbCache
;
//key:suid, value:STableMeta*
}
SCtgTbMetaCache
;
typedef
STableIndexRsp
STableIndex
;
typedef
struct
SCtgDBCache
{
typedef
struct
SCtgTbCache
{
SRWLatch
metaLock
;
STableMeta
*
pMeta
;
SRWLatch
indexLock
;
STableIndex
*
pIndex
;
}
SCtgTbCache
;
typedef
struct
SCtgVgCache
{
SRWLatch
vgLock
;
SDBVgInfo
*
vgInfo
;
}
SCtgVgCache
;
typedef
struct
SCtgDBCache
{
SRWLatch
dbLock
;
// RC between destroy tbCache/stbCache and all reads
uint64_t
dbId
;
int8_t
deleted
;
SDBVgInfo
*
vgInfo
;
SCtgTbMetaCache
tbCache
;
SCtgVgCache
vgCache
;
SHashObj
*
tbCache
;
// key:tbname, value:SCtgTbCache
SHashObj
*
stbCache
;
// key:suid, value:STableMeta*
}
SCtgDBCache
;
typedef
struct
SCtgRentSlot
{
...
...
@@ -245,8 +255,10 @@ typedef struct SCtgCacheStat {
uint64_t
userNum
;
uint64_t
vgHitNum
;
uint64_t
vgMissNum
;
uint64_t
tblHitNum
;
uint64_t
tblMissNum
;
uint64_t
tbMetaHitNum
;
uint64_t
tbMetaMissNum
;
uint64_t
tbIndexHitNum
;
uint64_t
tbIndexMissNum
;
uint64_t
userHitNum
;
uint64_t
userMissNum
;
}
SCtgCacheStat
;
...
...
@@ -268,10 +280,10 @@ typedef struct SCtgUpdateVgMsg {
SDBVgInfo
*
dbInfo
;
}
SCtgUpdateVgMsg
;
typedef
struct
SCtgUpdateTb
l
Msg
{
SCatalog
*
pCtg
;
STableMetaOutput
*
output
;
}
SCtgUpdateTb
l
Msg
;
typedef
struct
SCtgUpdateTb
Meta
Msg
{
SCatalog
*
pCtg
;
STableMetaOutput
*
pMeta
;
}
SCtgUpdateTb
Meta
Msg
;
typedef
struct
SCtgDropDBMsg
{
SCatalog
*
pCtg
;
...
...
@@ -305,6 +317,19 @@ typedef struct SCtgUpdateUserMsg {
SGetUserAuthRsp
userAuth
;
}
SCtgUpdateUserMsg
;
typedef
struct
SCtgUpdateTbIndexMsg
{
SCatalog
*
pCtg
;
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
tbName
[
TSDB_TABLE_NAME_LEN
];
STableIndex
*
pIndex
;
}
SCtgUpdateTbIndexMsg
;
typedef
struct
SCtgDropTbIndexMsg
{
SCatalog
*
pCtg
;
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
tbName
[
TSDB_TABLE_NAME_LEN
];
}
SCtgDropTbIndexMsg
;
typedef
struct
SCtgUpdateEpsetMsg
{
SCatalog
*
pCtg
;
char
dbFName
[
TSDB_DB_FNAME_LEN
];
...
...
@@ -465,8 +490,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *action);
int32_t
ctgOpUpdateEpset
(
SCtgCacheOperation
*
operation
);
int32_t
ctgAcquireVgInfoFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
);
void
ctgReleaseDBCache
(
SCatalog
*
pCtg
,
SCtgDBCache
*
dbCache
);
void
ctgReleaseVgInfo
(
SCtgDBCache
*
dbCache
);
int32_t
ctgAcquireVgInfoFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
);
void
ctgRUnlockVgInfo
(
SCtgDBCache
*
dbCache
);
int32_t
ctgTbMetaExistInCache
(
SCatalog
*
pCtg
,
char
*
dbFName
,
char
*
tbName
,
int32_t
*
exist
);
int32_t
ctgReadTbMetaFromCache
(
SCatalog
*
pCtg
,
SCtgTbMetaCtx
*
ctx
,
STableMeta
**
pTableMeta
);
int32_t
ctgReadTbVerFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
,
int32_t
*
tver
,
int32_t
*
tbType
,
uint64_t
*
suid
,
char
*
stbName
);
...
...
@@ -479,6 +503,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId
int32_t
ctgUpdateTbMetaEnqueue
(
SCatalog
*
pCtg
,
STableMetaOutput
*
output
,
bool
syncReq
);
int32_t
ctgUpdateUserEnqueue
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
,
bool
syncReq
);
int32_t
ctgUpdateVgEpsetEnqueue
(
SCatalog
*
pCtg
,
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
pEpSet
);
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
SName
*
pName
,
STableIndex
*
pIndex
,
bool
syncOp
);
int32_t
ctgMetaRentInit
(
SCtgRentMgmt
*
mgmt
,
uint32_t
rentSec
,
int8_t
type
);
int32_t
ctgMetaRentAdd
(
SCtgRentMgmt
*
mgmt
,
void
*
meta
,
int64_t
id
,
int32_t
size
);
int32_t
ctgMetaRentGet
(
SCtgRentMgmt
*
mgmt
,
void
**
res
,
uint32_t
*
num
,
int32_t
size
);
...
...
@@ -521,6 +546,7 @@ void ctgFreeSTableMetaOutput(STableMetaOutput* pOutput);
int32_t
ctgUpdateMsgCtx
(
SCtgMsgCtx
*
pCtx
,
int32_t
reqType
,
void
*
out
,
char
*
target
);
char
*
ctgTaskTypeStr
(
CTG_TASK_TYPE
type
);
int32_t
ctgUpdateSendTargetInfo
(
SMsgSendInfo
*
pMsgSendInfo
,
int32_t
msgType
,
SCtgTask
*
pTask
);
int32_t
ctgCloneTableIndex
(
SArray
*
pIndex
,
SArray
**
pRes
);
extern
SCatalogMgmt
gCtgMgmt
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
31f3bed3
...
...
@@ -97,8 +97,7 @@ int32_t ctgRefreshDBVgInfo(SCatalog* pCtg, SRequestConnInfo *pConn, const char*
if
(
NULL
!=
dbCache
)
{
input
.
dbId
=
dbCache
->
dbId
;
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
}
input
.
vgVersion
=
CTG_DEFAULT_INVALID_VERSION
;
...
...
@@ -383,6 +382,18 @@ _return:
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetTbIndex
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SArray
**
pRes
)
{
CTG_ERR_RET
(
ctgReadTbIndexFromCache
(
pCtg
,
pTableName
,
pRes
));
if
(
*
pRes
)
{
return
TSDB_CODE_SUCCESS
;
}
CTG_ERR_RET
(
ctgGetTbIndexFromMnode
(
pCtg
,
pConn
,
(
SName
*
)
pTableName
,
pRes
,
NULL
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetTbDistVgInfo
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SName
*
pTableName
,
SArray
**
pVgList
)
{
STableMeta
*
tbMeta
=
NULL
;
int32_t
code
=
0
;
...
...
@@ -443,7 +454,7 @@ int32_t ctgGetTbDistVgInfo(SCatalog* pCtg, SRequestConnInfo *pConn, SName* pTabl
_return:
if
(
dbCache
)
{
ctgR
elease
VgInfo
(
dbCache
);
ctgR
Unlock
VgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
...
...
@@ -633,8 +644,7 @@ int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* vers
*
dbId
=
dbCache
->
dbId
;
*
tableNum
=
dbCache
->
vgInfo
->
numOfTable
;
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got db vgVersion from cache, dbFName:%s, vgVersion:%d"
,
dbFName
,
*
version
);
...
...
@@ -659,7 +669,7 @@ int32_t catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo *pConn, const char*
SDBVgInfo
*
vgInfo
=
NULL
;
CTG_ERR_JRET
(
ctgGetDBVgInfo
(
pCtg
,
pConn
,
dbFName
,
&
dbCache
,
&
vgInfo
));
if
(
dbCache
)
{
vgHash
=
dbCache
->
vgInfo
->
vgHash
;
vgHash
=
dbCache
->
vg
Cache
.
vg
Info
->
vgHash
;
}
else
{
vgHash
=
vgInfo
->
vgHash
;
}
...
...
@@ -672,7 +682,7 @@ int32_t catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo *pConn, const char*
_return:
if
(
dbCache
)
{
ctgR
elease
VgInfo
(
dbCache
);
ctgR
Unlock
VgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
...
...
@@ -940,7 +950,7 @@ int32_t catalogGetTableHashVgroup(SCatalog *pCtg, SRequestConnInfo *pConn, const
_return:
if
(
dbCache
)
{
ctgR
elease
VgInfo
(
dbCache
);
ctgR
Unlock
VgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
...
...
@@ -1143,7 +1153,17 @@ int32_t catalogGetTableIndex(SCatalog* pCtg, SRequestConnInfo *pConn, const SNam
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
CTG_API_LEAVE
(
ctgGetTbIndexFromMnode
(
pCtg
,
pConn
,
(
SName
*
)
pTableName
,
pRes
,
NULL
));
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgGetTbIndexFromMnode
(
pCtg
,
pConn
,
(
SName
*
)
pTableName
,
pRes
,
NULL
));
SArray
*
pInfo
=
NULL
;
CTG_ERR_JRET
(
ctgCloneTableIndex
(
*
pRes
,
&
pInfo
));
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pCtg
,
pTableName
,
pInfo
,
false
));
_return:
CTG_API_LEAVE
(
code
);
}
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
31f3bed3
...
...
@@ -344,6 +344,11 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, SCtgJob *pJob, const SCatalogReq* p
}
}
for
(
int32_t
i
=
0
;
i
<
pJob
->
tbIndexNum
;
++
i
)
{
SName
*
name
=
taosArrayGet
(
pReq
->
pTableIndex
,
i
);
ctgDropTbIndexEnqueue
(
pCtg
,
name
,
true
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -524,7 +529,7 @@ int32_t ctgDumpTbIndexRes(SCtgTask* pTask) {
}
SMetaRes
res
=
{.
code
=
pTask
->
code
,
.
pRes
=
pTask
->
res
};
taosArrayPush
(
pJob
->
jobRes
.
pTable
Hash
,
&
res
);
taosArrayPush
(
pJob
->
jobRes
.
pTable
Index
,
&
res
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -687,8 +692,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf *
ctx
->
vgId
=
vgInfo
.
vgId
;
CTG_ERR_JRET
(
ctgGetTbMetaFromVnode
(
pCtg
,
pConn
,
ctx
->
pName
,
&
vgInfo
,
NULL
,
pTask
));
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
}
else
{
SBuildUseDBInput
input
=
{
0
};
...
...
@@ -786,7 +790,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf *
_return:
if
(
dbCache
)
{
ctgR
elease
VgInfo
(
dbCache
);
ctgR
Unlock
VgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
...
...
@@ -866,9 +870,16 @@ _return:
int32_t
ctgHandleGetTbIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
CTG_ERR_JRET
(
ctgProcessRspMsg
(
&
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
TSWAP
(
pTask
->
res
,
pTask
->
msgCtx
.
out
);
STableIndex
*
pOut
=
(
STableIndex
*
)
pTask
->
msgCtx
.
out
;
SArray
*
pInfo
=
NULL
;
CTG_ERR_JRET
(
ctgCloneTableIndex
(
pOut
->
pIndex
,
&
pInfo
));
pTask
->
res
=
pInfo
;
pTask
->
msgCtx
.
out
=
NULL
;
SCtgTbIndexCtx
*
ctx
=
pTask
->
taskCtx
;
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pTask
->
pJob
->
pCtg
,
ctx
->
pName
,
pOut
,
false
));
_return:
...
...
@@ -1024,8 +1035,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTask *pTask) {
_return:
if
(
dbCache
)
{
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
}
CTG_RET
(
code
);
...
...
@@ -1070,8 +1080,7 @@ int32_t ctgLaunchGetDbVgTask(SCtgTask *pTask) {
_return:
if
(
dbCache
)
{
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
}
CTG_RET
(
code
);
...
...
@@ -1105,8 +1114,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
_return:
if
(
dbCache
)
{
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
}
CTG_RET
(
code
);
...
...
@@ -1117,6 +1125,15 @@ int32_t ctgLaunchGetTbIndexTask(SCtgTask *pTask) {
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SCtgTbIndexCtx
*
pCtx
=
(
SCtgTbIndexCtx
*
)
pTask
->
taskCtx
;
SArray
*
pRes
=
NULL
;
CTG_ERR_RET
(
ctgReadTbIndexFromCache
(
pCtg
,
pCtx
->
pName
,
&
pRes
));
if
(
pRes
)
{
pTask
->
res
=
pRes
;
CTG_ERR_RET
(
ctgHandleTaskEnd
(
pTask
,
0
));
return
TSDB_CODE_SUCCESS
;
}
CTG_ERR_RET
(
ctgGetTbIndexFromMnode
(
pCtg
,
pConn
,
pCtx
->
pName
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1167,8 +1184,7 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask *pTask) {
_return:
if
(
dbCache
)
{
ctgReleaseVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
}
CTG_RET
(
code
);
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
31f3bed3
此差异已折叠。
点击以展开。
source/libs/catalog/src/ctgDbg.c
浏览文件 @
31f3bed3
...
...
@@ -266,11 +266,11 @@ int32_t ctgdGetStatNum(char *option, void *res) {
}
int32_t
ctgdGetTbMetaNum
(
SCtgDBCache
*
dbCache
)
{
return
dbCache
->
t
bCache
.
metaCache
?
(
int32_t
)
taosHashGetSize
(
dbCache
->
tbCache
.
meta
Cache
)
:
0
;
return
dbCache
->
t
able
.
tbCache
?
(
int32_t
)
taosHashGetSize
(
dbCache
->
table
.
tb
Cache
)
:
0
;
}
int32_t
ctgdGetStbNum
(
SCtgDBCache
*
dbCache
)
{
return
dbCache
->
t
bCache
.
stbCache
?
(
int32_t
)
taosHashGetSize
(
dbCache
->
tbCach
e
.
stbCache
)
:
0
;
return
dbCache
->
t
able
.
stbCache
?
(
int32_t
)
taosHashGetSize
(
dbCache
->
tabl
e
.
stbCache
)
:
0
;
}
int32_t
ctgdGetRentNum
(
SCtgRentMgmt
*
rent
)
{
...
...
@@ -363,8 +363,8 @@ void ctgdShowDBCache(SCatalog* pCtg, SHashObj *dbHash) {
dbFName
=
taosHashGetKey
(
pIter
,
&
len
);
int32_t
metaNum
=
dbCache
->
t
bCache
.
metaCache
?
taosHashGetSize
(
dbCache
->
tbCache
.
meta
Cache
)
:
0
;
int32_t
stbNum
=
dbCache
->
t
bCache
.
stbCache
?
taosHashGetSize
(
dbCache
->
tbCach
e
.
stbCache
)
:
0
;
int32_t
metaNum
=
dbCache
->
t
able
.
tbCache
?
taosHashGetSize
(
dbCache
->
table
.
tb
Cache
)
:
0
;
int32_t
stbNum
=
dbCache
->
t
able
.
stbCache
?
taosHashGetSize
(
dbCache
->
tabl
e
.
stbCache
)
:
0
;
int32_t
vgVersion
=
CTG_DEFAULT_INVALID_VERSION
;
int32_t
hashMethod
=
-
1
;
int32_t
vgNum
=
0
;
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
31f3bed3
...
...
@@ -448,10 +448,7 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SName *n
}
if
(
pTask
)
{
void
*
pOut
=
taosMemoryCalloc
(
1
,
POINTER_BYTES
);
if
(
NULL
==
pOut
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
void
*
pOut
=
NULL
;
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
pOut
,
(
char
*
)
tbFName
));
CTG_RET
(
ctgAsyncSendMsg
(
pCtg
,
pConn
,
pTask
,
reqType
,
msg
,
msgLen
));
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
31f3bed3
...
...
@@ -110,25 +110,39 @@ void ctgFreeMetaRent(SCtgRentMgmt *mgmt) {
taosMemoryFreeClear
(
mgmt
->
slots
);
}
void
ctgFreeStbMetaCache
(
SCtgDBCache
*
dbCache
)
{
if
(
NULL
==
dbCache
->
stbCache
)
{
return
;
}
int32_t
stblNum
=
taosHashGetSize
(
dbCache
->
stbCache
);
taosHashCleanup
(
dbCache
->
stbCache
);
dbCache
->
stbCache
=
NULL
;
CTG_CACHE_STAT_DEC
(
stblNum
,
stblNum
);
}
void
ctgFreeTbCacheImpl
(
SCtgTbCache
*
pCache
)
{
taosMemoryFreeClear
(
pCache
->
pMeta
);
if
(
pCache
->
pIndex
)
{
taosArrayDestroyEx
(
pCache
->
pIndex
->
pIndex
,
tFreeSTableIndexInfo
);
taosMemoryFreeClear
(
pCache
->
pIndex
);
}
}
void
ctgFreeTbMetaCache
(
SCtgTbMetaCache
*
cache
)
{
CTG_LOCK
(
CTG_WRITE
,
&
cache
->
stbLock
);
if
(
cache
->
stbCache
)
{
int32_t
stblNum
=
taosHashGetSize
(
cache
->
stbCache
);
taosHashCleanup
(
cache
->
stbCache
);
cache
->
stbCache
=
NULL
;
CTG_CACHE_STAT_DEC
(
stblNum
,
stblNum
);
void
ctgFreeTbCache
(
SCtgDBCache
*
dbCache
)
{
if
(
NULL
==
dbCache
->
tbCache
)
{
return
;
}
CTG_UNLOCK
(
CTG_WRITE
,
&
cache
->
stbLock
);
CTG_LOCK
(
CTG_WRITE
,
&
cache
->
metaLock
);
if
(
cache
->
metaCache
)
{
int32_t
tblNum
=
taosHashGetSize
(
cache
->
metaCache
);
taosHashCleanup
(
cache
->
metaCache
);
cache
->
metaCache
=
NULL
;
CTG_CACHE_STAT_DEC
(
tblNum
,
tblNum
);
int32_t
tblNum
=
taosHashGetSize
(
dbCache
->
tbCache
);
SCtgTbCache
*
pCache
=
taosHashIterate
(
dbCache
->
tbCache
,
NULL
);
while
(
NULL
!=
pCache
)
{
ctgFreeTbCacheImpl
(
pCache
);
pCache
=
taosHashIterate
(
dbCache
->
tbCache
,
pCache
);
}
CTG_UNLOCK
(
CTG_WRITE
,
&
cache
->
metaLock
);
taosHashCleanup
(
dbCache
->
tbCache
);
dbCache
->
tbCache
=
NULL
;
CTG_CACHE_STAT_DEC
(
tblNum
,
tblNum
);
}
void
ctgFreeVgInfo
(
SDBVgInfo
*
vgInfo
)
{
...
...
@@ -144,16 +158,18 @@ void ctgFreeVgInfo(SDBVgInfo *vgInfo) {
taosMemoryFreeClear
(
vgInfo
);
}
void
ctgFreeVgInfoCache
(
SCtgDBCache
*
dbCache
)
{
ctgFreeVgInfo
(
dbCache
->
vgCache
.
vgInfo
);
}
void
ctgFreeDbCache
(
SCtgDBCache
*
dbCache
)
{
if
(
NULL
==
dbCache
)
{
return
;
}
CTG_LOCK
(
CTG_WRITE
,
&
dbCache
->
vgLock
);
ctgFreeVgInfo
(
dbCache
->
vgInfo
);
CTG_UNLOCK
(
CTG_WRITE
,
&
dbCache
->
vgLock
);
ctgFreeTbMetaCache
(
&
dbCache
->
tbCache
);
ctgFreeVgInfoCache
(
dbCache
);
ctgFreeStbMetaCache
(
dbCache
);
ctgFreeTbCache
(
dbCache
);
}
...
...
@@ -167,16 +183,13 @@ void ctgFreeHandle(SCatalog* pCtg) {
void
*
pIter
=
taosHashIterate
(
pCtg
->
dbCache
,
NULL
);
while
(
pIter
)
{
SCtgDBCache
*
dbCache
=
pIter
;
atomic_store_8
(
&
dbCache
->
deleted
,
1
);
ctgFreeDbCache
(
dbCache
);
pIter
=
taosHashIterate
(
pCtg
->
dbCache
,
pIter
);
}
taosHashCleanup
(
pCtg
->
dbCache
);
CTG_CACHE_STAT_DEC
(
dbNum
,
dbNum
);
}
...
...
@@ -186,14 +199,12 @@ void ctgFreeHandle(SCatalog* pCtg) {
void
*
pIter
=
taosHashIterate
(
pCtg
->
userCache
,
NULL
);
while
(
pIter
)
{
SCtgUserAuth
*
userCache
=
pIter
;
ctgFreeSCtgUserAuth
(
userCache
);
pIter
=
taosHashIterate
(
pCtg
->
userCache
,
pIter
);
}
taosHashCleanup
(
pCtg
->
userCache
);
CTG_CACHE_STAT_DEC
(
userNum
,
userNum
);
}
...
...
@@ -252,9 +263,9 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) {
break
;
}
case
TDMT_MND_GET_TABLE_INDEX
:
{
S
Array
**
pOut
=
(
SArray
*
*
)
pCtx
->
out
;
S
TableIndex
*
pOut
=
(
STableIndex
*
)
pCtx
->
out
;
if
(
pOut
)
{
taosArrayDestroyEx
(
*
pOut
,
tFreeSTableIndexInfo
);
taosArrayDestroyEx
(
pOut
->
pIndex
,
tFreeSTableIndexInfo
);
taosMemoryFreeClear
(
pCtx
->
out
);
}
break
;
...
...
@@ -640,6 +651,27 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput)
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgCloneTableIndex
(
SArray
*
pIndex
,
SArray
**
pRes
)
{
if
(
NULL
==
pIndex
)
{
*
pRes
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
num
=
taosArrayGetSize
(
pIndex
);
*
pRes
=
taosArrayInit
(
num
,
sizeof
(
STableIndexInfo
));
if
(
NULL
==
*
pRes
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
STableIndexInfo
*
pInfo
=
taosArrayGet
(
pIndex
,
i
);
taosArrayPush
(
*
pRes
,
pInfo
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgUpdateSendTargetInfo
(
SMsgSendInfo
*
pMsgSendInfo
,
int32_t
msgType
,
SCtgTask
*
pTask
)
{
if
(
msgType
==
TDMT_VND_TABLE_META
)
{
SCtgTbMetaCtx
*
ctx
=
(
SCtgTbMetaCtx
*
)
pTask
->
taskCtx
;
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
31f3bed3
...
...
@@ -895,9 +895,9 @@ void *ctgTestSetCtableMetaThread(void *param) {
output
=
(
STableMetaOutput
*
)
taosMemoryMalloc
(
sizeof
(
STableMetaOutput
));
ctgTestBuildCTableMetaOutput
(
output
);
SCtgUpdateTb
lMsg
*
msg
=
(
SCtgUpdateTblMsg
*
)
taosMemoryMalloc
(
sizeof
(
SCtgUpdateTbl
Msg
));
SCtgUpdateTb
MetaMsg
*
msg
=
(
SCtgUpdateTbMetaMsg
*
)
taosMemoryMalloc
(
sizeof
(
SCtgUpdateTbMeta
Msg
));
msg
->
pCtg
=
pCtg
;
msg
->
output
=
output
;
msg
->
pMeta
=
output
;
operation
.
data
=
msg
;
code
=
ctgOpUpdateTbMeta
(
&
operation
);
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
31f3bed3
...
...
@@ -484,13 +484,17 @@ int32_t queryProcessGetTbIndexRsp(void *output, char *msg, int32_t msgSize) {
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
STableIndexRsp
out
=
{
0
};
if
(
tDeserializeSTableIndexRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
STableIndexRsp
*
out
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIndexRsp
));
if
(
NULL
==
out
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
tDeserializeSTableIndexRsp
(
msg
,
msgSize
,
out
)
!=
0
)
{
qError
(
"tDeserializeSTableIndexRsp failed, msgSize:%d"
,
msgSize
);
return
TSDB_CODE_INVALID_MSG
;
}
*
(
void
**
)
output
=
out
.
pIndex
;
*
(
void
**
)
output
=
out
;
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
31f3bed3
...
...
@@ -837,7 +837,6 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) {
SQWorker
*
mgmt
=
qwAcquire
(
refId
);
if
(
NULL
==
mgmt
)
{
QW_DLOG
(
"qwAcquire %"
PRIx64
"failed"
,
refId
);
taosMemoryFree
(
param
);
return
;
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
31f3bed3
...
...
@@ -1476,6 +1476,11 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options)
for
(
uint32_t
i
=
0
;
i
<
info
->
fields
[
FLD_TYPE_VALUE
].
num
;
++
i
)
{
SFilterField
*
field
=
&
info
->
fields
[
FLD_TYPE_VALUE
].
fields
[
i
];
if
(
field
->
desc
)
{
if
(
QUERY_NODE_VALUE
!=
nodeType
(
field
->
desc
))
{
qDebug
(
"VAL%d => [type:not value node][val:NIL]"
,
i
);
//TODO
continue
;
}
SValueNode
*
var
=
(
SValueNode
*
)
field
->
desc
;
SDataType
*
dType
=
&
var
->
node
.
resType
;
if
(
dType
->
type
==
TSDB_DATA_TYPE_VALUE_ARRAY
)
{
...
...
source/util/src/tarray.c
浏览文件 @
31f3bed3
...
...
@@ -458,6 +458,9 @@ static void taosArrayInsertSort(SArray* pArray, __ext_compar_fn_t fn, const void
}
SArray
*
taosArrayDeepCopy
(
const
SArray
*
pSrc
,
FCopy
deepCopy
)
{
if
(
NULL
==
pSrc
)
{
return
NULL
;
}
ASSERT
(
pSrc
->
elemSize
==
sizeof
(
void
*
));
SArray
*
pArray
=
taosArrayInit
(
pSrc
->
size
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
pSrc
->
size
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录