Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b44baf3c
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看板
提交
b44baf3c
编写于
2月 12, 2022
作者:
D
dapan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
5f2dc140
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
45 deletion
+52
-45
include/common/tmsg.h
include/common/tmsg.h
+1
-2
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+1
-2
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+45
-38
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+5
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
b44baf3c
无法预览此类型文件
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
b44baf3c
无法预览此类型文件
source/libs/catalog/src/catalog.c
浏览文件 @
b44baf3c
...
...
@@ -18,6 +18,12 @@
#include "tname.h"
#include "catalogInt.h"
int32_t
ctgActUpdateVg
(
SCtgMetaAction
*
action
);
int32_t
ctgActUpdateTbl
(
SCtgMetaAction
*
action
);
int32_t
ctgActRemoveDB
(
SCtgMetaAction
*
action
);
int32_t
ctgActRemoveStb
(
SCtgMetaAction
*
action
);
int32_t
ctgActRemoveTbl
(
SCtgMetaAction
*
action
);
SCatalogMgmt
ctgMgmt
=
{
0
};
SCtgDebug
gCTGDebug
=
{
0
};
...
...
@@ -242,6 +248,44 @@ void ctgWReleaseVgInfo(SCtgDBCache *dbCache) {
}
int32_t
ctgAcquireDBCacheImpl
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
,
bool
acquire
)
{
SCtgDBCache
*
dbCache
=
NULL
;
if
(
acquire
)
{
dbCache
=
(
SCtgDBCache
*
)
taosHashAcquire
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
else
{
dbCache
=
(
SCtgDBCache
*
)
taosHashGet
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
if
(
NULL
==
dbCache
)
{
*
pCache
=
NULL
;
ctgDebug
(
"db not in cache, dbFName:%s"
,
dbFName
);
return
TSDB_CODE_SUCCESS
;
}
if
(
dbCache
->
deleted
)
{
if
(
acquire
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
*
pCache
=
NULL
;
ctgDebug
(
"db is removing from cache, dbFName:%s"
,
dbFName
);
return
TSDB_CODE_SUCCESS
;
}
*
pCache
=
dbCache
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgAcquireDBCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
)
{
CTG_RET
(
ctgAcquireDBCacheImpl
(
pCtg
,
dbFName
,
pCache
,
true
));
}
int32_t
ctgGetDBCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
)
{
CTG_RET
(
ctgAcquireDBCacheImpl
(
pCtg
,
dbFName
,
pCache
,
false
));
}
int32_t
ctgAcquireVgInfoFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
,
bool
*
inCache
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
*
pCache
=
NULL
;
...
...
@@ -978,43 +1022,6 @@ int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgAcquireDBCacheImpl
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
,
bool
acquire
)
{
SCtgDBCache
*
dbCache
=
NULL
;
if
(
acquire
)
{
dbCache
=
(
SCtgDBCache
*
)
taosHashAcquire
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
else
{
dbCache
=
(
SCtgDBCache
*
)
taosHashGet
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
if
(
NULL
==
dbCache
)
{
*
pCache
=
NULL
;
ctgDebug
(
"db not in cache, dbFName:%s"
,
dbFName
);
return
TSDB_CODE_SUCCESS
;
}
if
(
dbCache
->
deleted
)
{
if
(
acquire
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
*
pCache
=
NULL
;
ctgDebug
(
"db is removing from cache, dbFName:%s"
,
dbFName
);
return
TSDB_CODE_SUCCESS
;
}
*
pCache
=
dbCache
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgAcquireDBCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
)
{
CTG_RET
(
ctgAcquireDBCacheImpl
(
pCtg
,
dbFName
,
pCache
,
true
));
}
int32_t
ctgGetDBCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
)
{
CTG_RET
(
ctgAcquireDBCacheImpl
(
pCtg
,
dbFName
,
pCache
,
false
));
}
int32_t
ctgGetAddDBCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
uint64_t
dbId
,
SCtgDBCache
**
pCache
)
{
int32_t
code
=
0
;
...
...
@@ -1235,7 +1242,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput)
int32_t
metaSize
=
CTG_META_SIZE
(
output
->
tbMeta
);
(
*
pOutput
)
->
tbMeta
=
malloc
(
metaSize
);
if
(
NULL
==
(
*
pOutput
)
->
tbMeta
)
{
qError
(
"malloc %d failed"
,
sizeof
(
STableMetaOutput
));
qError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
STableMetaOutput
));
tfree
(
*
pOutput
);
CTG_ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
}
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
b44baf3c
...
...
@@ -33,12 +33,14 @@
#include "tep.h"
#include "trpc.h"
#include "tvariant.h"
#include "catalogInt.h"
namespace
{
extern
"C"
int32_t
ctgGetTableMetaFromCache
(
struct
SCatalog
*
pCatalog
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
*
exist
);
extern
"C"
int32_t
ctgDbgGetClusterCacheNum
(
struct
SCatalog
*
pCatalog
,
int32_t
type
);
extern
"C"
int32_t
ctgActUpdateTbl
(
SCtgMetaAction
*
action
);
void
ctgTestSetPrepareTableMeta
();
void
ctgTestSetPrepareCTableMeta
();
...
...
@@ -725,9 +727,9 @@ void *ctgTestSetCtableMetaThread(void *param) {
action
.
act
=
CTG_ACT_UPDATE_TBL
;
while
(
!
ctgTestStop
)
{
SCtgUpdateTblMsg
*
msg
=
malloc
(
sizeof
(
SCtgUpdateTblMsg
));
SCtgUpdateTblMsg
*
msg
=
(
SCtgUpdateTblMsg
*
)
malloc
(
sizeof
(
SCtgUpdateTblMsg
));
msg
->
pCtg
=
pCtg
;
msg
->
output
=
output
;
msg
->
output
=
&
output
;
action
.
data
=
msg
;
code
=
ctgActUpdateTbl
(
&
action
);
...
...
@@ -1077,7 +1079,7 @@ TEST(tableMeta, rmStbMeta) {
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
rowSize
,
12
);
code
=
catalogRemoveS
TableMeta
(
pCtg
,
"1.db1"
,
ctgTestSTablename
,
ctgTestSuid
);
code
=
catalogRemoveS
tbMeta
(
pCtg
,
"1.db1"
,
ctgTestDbId
,
ctgTestSTablename
,
ctgTestSuid
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_DB_NUM
),
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录