Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ff1f6f3b
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
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看板
提交
ff1f6f3b
编写于
6月 24, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix reset query cache issue
上级
be341e1d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
47 deletion
+40
-47
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+0
-8
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+5
-4
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+9
-30
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+4
-4
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+22
-1
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
ff1f6f3b
...
@@ -145,14 +145,6 @@ int32_t catalogInit(SCatalogCfg* cfg);
...
@@ -145,14 +145,6 @@ int32_t catalogInit(SCatalogCfg* cfg);
*/
*/
int32_t
catalogGetHandle
(
uint64_t
clusterId
,
SCatalog
**
catalogHandle
);
int32_t
catalogGetHandle
(
uint64_t
clusterId
,
SCatalog
**
catalogHandle
);
/**
* Free a cluster's all catalog info, usually it's not necessary, until the application is closing.
* no current or future usage should be guaranteed by application
* @param pCatalog (input, NO more usage)
* @return error code
*/
void
catalogFreeHandle
(
SCatalog
*
pCatalog
);
int32_t
catalogGetDBVgVersion
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
*
version
,
int64_t
*
dbId
,
int32_t
*
tableNum
);
int32_t
catalogGetDBVgVersion
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
*
version
,
int64_t
*
dbId
,
int32_t
*
tableNum
);
/**
/**
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
ff1f6f3b
...
@@ -383,7 +383,7 @@ typedef struct SCtgCacheOperation {
...
@@ -383,7 +383,7 @@ typedef struct SCtgCacheOperation {
void
*
data
;
void
*
data
;
bool
syncOp
;
bool
syncOp
;
tsem_t
rspSem
;
tsem_t
rspSem
;
bool
lockQ
;
bool
stopQueue
;
}
SCtgCacheOperation
;
}
SCtgCacheOperation
;
typedef
struct
SCtgQNode
{
typedef
struct
SCtgQNode
{
...
@@ -393,7 +393,7 @@ typedef struct SCtgQNode {
...
@@ -393,7 +393,7 @@ typedef struct SCtgQNode {
typedef
struct
SCtgQueue
{
typedef
struct
SCtgQueue
{
SRWLatch
qlock
;
SRWLatch
qlock
;
bool
lockQ
;
bool
stopQueue
;
SCtgQNode
*
head
;
SCtgQNode
*
head
;
SCtgQNode
*
tail
;
SCtgQNode
*
tail
;
tsem_t
reqSem
;
tsem_t
reqSem
;
...
@@ -559,7 +559,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy
...
@@ -559,7 +559,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy
int32_t
ctgUpdateUserEnqueue
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
,
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
ctgUpdateVgEpsetEnqueue
(
SCatalog
*
pCtg
,
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
pEpSet
);
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
STableIndex
**
pIndex
,
bool
syncOp
);
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
STableIndex
**
pIndex
,
bool
syncOp
);
int32_t
ctgClearCacheEnqueue
(
SCatalog
*
pCtg
,
bool
lockQ
,
bool
syncOp
);
int32_t
ctgClearCacheEnqueue
(
SCatalog
*
pCtg
,
bool
stopQueue
,
bool
syncOp
);
int32_t
ctgMetaRentInit
(
SCtgRentMgmt
*
mgmt
,
uint32_t
rentSec
,
int8_t
type
);
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
ctgMetaRentAdd
(
SCtgRentMgmt
*
mgmt
,
void
*
meta
,
int64_t
id
,
int32_t
size
);
int32_t
ctgMetaRentGet
(
SCtgRentMgmt
*
mgmt
,
void
**
res
,
uint32_t
*
num
,
int32_t
size
);
int32_t
ctgMetaRentGet
(
SCtgRentMgmt
*
mgmt
,
void
**
res
,
uint32_t
*
num
,
int32_t
size
);
...
@@ -598,12 +598,13 @@ int32_t ctgLaunchJob(SCtgJob *pJob);
...
@@ -598,12 +598,13 @@ int32_t ctgLaunchJob(SCtgJob *pJob);
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
);
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
);
int32_t
ctgLaunchSubTask
(
SCtgTask
*
pTask
,
CTG_TASK_TYPE
type
,
ctgSubTaskCbFp
fp
,
void
*
param
);
int32_t
ctgLaunchSubTask
(
SCtgTask
*
pTask
,
CTG_TASK_TYPE
type
,
ctgSubTaskCbFp
fp
,
void
*
param
);
int32_t
ctgGetTbCfgCb
(
SCtgTask
*
pTask
);
int32_t
ctgGetTbCfgCb
(
SCtgTask
*
pTask
);
void
ctgFreeHandle
(
SCatalog
*
pCatalog
);
int32_t
ctgCloneVgInfo
(
SDBVgInfo
*
src
,
SDBVgInfo
**
dst
);
int32_t
ctgCloneVgInfo
(
SDBVgInfo
*
src
,
SDBVgInfo
**
dst
);
int32_t
ctgCloneMetaOutput
(
STableMetaOutput
*
output
,
STableMetaOutput
**
pOutput
);
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
ctgFreeHandle
(
SCatalog
*
pCtg
);
void
ctgFreeHandle
Impl
(
SCatalog
*
pCtg
);
void
ctgFreeVgInfo
(
SDBVgInfo
*
vgInfo
);
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
);
void
ctgResetTbMetaTask
(
SCtgTask
*
pTask
);
void
ctgResetTbMetaTask
(
SCtgTask
*
pTask
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
ff1f6f3b
...
@@ -548,9 +548,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
...
@@ -548,9 +548,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
}
CTG_API_ENTER
();
if
(
NULL
==
gCtgMgmt
.
pCluster
)
{
if
(
NULL
==
gCtgMgmt
.
pCluster
)
{
qError
(
"catalog cluster cache are not ready, clusterId:0x%"
PRIx64
,
clusterId
);
qError
(
"catalog cluster cache are not ready, clusterId:0x%"
PRIx64
,
clusterId
);
CTG_
ERR_RET
(
TSDB_CODE_CTG_NOT_READY
);
CTG_
API_LEAVE
(
TSDB_CODE_CTG_NOT_READY
);
}
}
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -562,13 +564,13 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
...
@@ -562,13 +564,13 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
if
(
ctg
&&
(
*
ctg
))
{
if
(
ctg
&&
(
*
ctg
))
{
*
catalogHandle
=
*
ctg
;
*
catalogHandle
=
*
ctg
;
qDebug
(
"got catalog handle from cache, clusterId:0x%"
PRIx64
", CTG:%p"
,
clusterId
,
*
ctg
);
qDebug
(
"got catalog handle from cache, clusterId:0x%"
PRIx64
", CTG:%p"
,
clusterId
,
*
ctg
);
return
TSDB_CODE_SUCCESS
;
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
)
;
}
}
clusterCtg
=
taosMemoryCalloc
(
1
,
sizeof
(
SCatalog
));
clusterCtg
=
taosMemoryCalloc
(
1
,
sizeof
(
SCatalog
));
if
(
NULL
==
clusterCtg
)
{
if
(
NULL
==
clusterCtg
)
{
qError
(
"calloc %d failed"
,
(
int32_t
)
sizeof
(
SCatalog
));
qError
(
"calloc %d failed"
,
(
int32_t
)
sizeof
(
SCatalog
));
CTG_
ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
CTG_
API_LEAVE
(
TSDB_CODE_CTG_MEM_ERROR
);
}
}
clusterCtg
->
clusterId
=
clusterId
;
clusterCtg
->
clusterId
=
clusterId
;
...
@@ -586,7 +588,7 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
...
@@ -586,7 +588,7 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
code
=
taosHashPut
(
gCtgMgmt
.
pCluster
,
&
clusterId
,
sizeof
(
clusterId
),
&
clusterCtg
,
POINTER_BYTES
);
code
=
taosHashPut
(
gCtgMgmt
.
pCluster
,
&
clusterId
,
sizeof
(
clusterId
),
&
clusterCtg
,
POINTER_BYTES
);
if
(
code
)
{
if
(
code
)
{
if
(
HASH_NODE_EXIST
(
code
))
{
if
(
HASH_NODE_EXIST
(
code
))
{
ctgFreeHandle
(
clusterCtg
);
ctgFreeHandle
Impl
(
clusterCtg
);
continue
;
continue
;
}
}
...
@@ -603,32 +605,13 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
...
@@ -603,32 +605,13 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
CTG_CACHE_STAT_INC
(
clusterNum
,
1
);
CTG_CACHE_STAT_INC
(
clusterNum
,
1
);
return
TSDB_CODE_SUCCESS
;
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
)
;
_return:
_return:
ctgFreeHandle
(
clusterCtg
);
ctgFreeHandleImpl
(
clusterCtg
);
CTG_RET
(
code
);
}
void
catalogFreeHandle
(
SCatalog
*
pCtg
)
{
if
(
NULL
==
pCtg
)
{
return
;
}
if
(
taosHashRemove
(
gCtgMgmt
.
pCluster
,
&
pCtg
->
clusterId
,
sizeof
(
pCtg
->
clusterId
)))
{
CTG_API_LEAVE
(
code
);
ctgWarn
(
"taosHashRemove from cluster failed, may already be freed, clusterId:0x%"
PRIx64
,
pCtg
->
clusterId
);
return
;
}
CTG_CACHE_STAT_DEC
(
clusterNum
,
1
);
uint64_t
clusterId
=
pCtg
->
clusterId
;
ctgFreeHandle
(
pCtg
);
ctgInfo
(
"handle freed, culsterId:0x%"
PRIx64
,
clusterId
);
}
}
int32_t
catalogGetDBVgVersion
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
*
version
,
int64_t
*
dbId
,
int32_t
*
tableNum
)
{
int32_t
catalogGetDBVgVersion
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
*
version
,
int64_t
*
dbId
,
int32_t
*
tableNum
)
{
...
@@ -1285,10 +1268,6 @@ void catalogDestroy(void) {
...
@@ -1285,10 +1268,6 @@ void catalogDestroy(void) {
ctgClearCacheEnqueue
(
NULL
,
true
,
true
);
ctgClearCacheEnqueue
(
NULL
,
true
,
true
);
if
(
tsem_post
(
&
gCtgMgmt
.
queue
.
reqSem
))
{
qError
(
"tsem_post failed, error:%s"
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
}
taosHashCleanup
(
gCtgMgmt
.
pCluster
);
taosHashCleanup
(
gCtgMgmt
.
pCluster
);
gCtgMgmt
.
pCluster
=
NULL
;
gCtgMgmt
.
pCluster
=
NULL
;
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
ff1f6f3b
...
@@ -659,12 +659,12 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
...
@@ -659,12 +659,12 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
node
->
op
=
operation
;
node
->
op
=
operation
;
CTG_LOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
CTG_LOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
if
(
gCtgMgmt
.
queue
.
lockQ
)
{
if
(
gCtgMgmt
.
queue
.
stopQueue
)
{
ctgFreeQNode
(
node
);
ctgFreeQNode
(
node
);
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
CTG_RET
(
TSDB_CODE_CTG_EXIT
);
CTG_RET
(
TSDB_CODE_CTG_EXIT
);
}
}
gCtgMgmt
.
queue
.
lockQ
=
operation
->
lockQ
;
gCtgMgmt
.
queue
.
stopQueue
=
operation
->
stopQueue
;
gCtgMgmt
.
queue
.
tail
->
next
=
node
;
gCtgMgmt
.
queue
.
tail
->
next
=
node
;
gCtgMgmt
.
queue
.
tail
=
node
;
gCtgMgmt
.
queue
.
tail
=
node
;
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
...
@@ -1002,12 +1002,12 @@ _return:
...
@@ -1002,12 +1002,12 @@ _return:
}
}
int32_t
ctgClearCacheEnqueue
(
SCatalog
*
pCtg
,
bool
lockQ
,
bool
syncOp
)
{
int32_t
ctgClearCacheEnqueue
(
SCatalog
*
pCtg
,
bool
stopQueue
,
bool
syncOp
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SCtgCacheOperation
*
op
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgCacheOperation
));
SCtgCacheOperation
*
op
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgCacheOperation
));
op
->
opId
=
CTG_OP_CLEAR_CACHE
;
op
->
opId
=
CTG_OP_CLEAR_CACHE
;
op
->
syncOp
=
syncOp
;
op
->
syncOp
=
syncOp
;
op
->
lockQ
=
lockQ
;
op
->
stopQueue
=
stopQueue
;
SCtgClearCacheMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgClearCacheMsg
));
SCtgClearCacheMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgClearCacheMsg
));
if
(
NULL
==
msg
)
{
if
(
NULL
==
msg
)
{
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
ff1f6f3b
...
@@ -196,7 +196,7 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) {
...
@@ -196,7 +196,7 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) {
}
}
void
ctgFreeHandle
(
SCatalog
*
pCtg
)
{
void
ctgFreeHandle
Impl
(
SCatalog
*
pCtg
)
{
ctgFreeMetaRent
(
&
pCtg
->
dbRent
);
ctgFreeMetaRent
(
&
pCtg
->
dbRent
);
ctgFreeMetaRent
(
&
pCtg
->
stbRent
);
ctgFreeMetaRent
(
&
pCtg
->
stbRent
);
...
@@ -235,6 +235,27 @@ void ctgFreeHandle(SCatalog* pCtg) {
...
@@ -235,6 +235,27 @@ void ctgFreeHandle(SCatalog* pCtg) {
}
}
void
ctgFreeHandle
(
SCatalog
*
pCtg
)
{
if
(
NULL
==
pCtg
)
{
return
;
}
if
(
taosHashRemove
(
gCtgMgmt
.
pCluster
,
&
pCtg
->
clusterId
,
sizeof
(
pCtg
->
clusterId
)))
{
ctgWarn
(
"taosHashRemove from cluster failed, may already be freed, clusterId:0x%"
PRIx64
,
pCtg
->
clusterId
);
return
;
}
CTG_CACHE_STAT_DEC
(
clusterNum
,
1
);
uint64_t
clusterId
=
pCtg
->
clusterId
;
ctgFreeHandleImpl
(
pCtg
);
ctgInfo
(
"handle freed, culsterId:0x%"
PRIx64
,
clusterId
);
}
void
ctgFreeSUseDbOutput
(
SUseDbOutput
*
pOutput
)
{
void
ctgFreeSUseDbOutput
(
SUseDbOutput
*
pOutput
)
{
if
(
NULL
==
pOutput
)
{
if
(
NULL
==
pOutput
)
{
return
;
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录