Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9668016f
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看板
提交
9668016f
编写于
5月 23, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compile issue
上级
9d6475fa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
18 deletion
+25
-18
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
+1
-1
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+23
-16
未找到文件。
source/libs/catalog/inc/catalogInt.h
浏览文件 @
9668016f
...
@@ -447,7 +447,7 @@ void ctgReleaseVgInfo(SCtgDBCache *dbCache);
...
@@ -447,7 +447,7 @@ void ctgReleaseVgInfo(SCtgDBCache *dbCache);
int32_t
ctgAcquireVgInfoFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
);
int32_t
ctgAcquireVgInfoFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
);
int32_t
ctgTbMetaExistInCache
(
SCatalog
*
pCtg
,
char
*
dbFName
,
char
*
tbName
,
int32_t
*
exist
);
int32_t
ctgTbMetaExistInCache
(
SCatalog
*
pCtg
,
char
*
dbFName
,
char
*
tbName
,
int32_t
*
exist
);
int32_t
ctgReadTbMetaFromCache
(
SCatalog
*
pCtg
,
SCtgTbMetaCtx
*
ctx
,
STableMeta
**
pTableMeta
);
int32_t
ctgReadTbMetaFromCache
(
SCatalog
*
pCtg
,
SCtgTbMetaCtx
*
ctx
,
STableMeta
**
pTableMeta
);
int32_t
ctgReadTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
);
int32_t
ctgReadTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
,
int32_t
*
tbType
,
uint64_t
*
suid
,
char
*
stbName
);
int32_t
ctgChkAuthFromCache
(
SCatalog
*
pCtg
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
bool
*
inCache
,
bool
*
pass
);
int32_t
ctgChkAuthFromCache
(
SCatalog
*
pCtg
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
bool
*
inCache
,
bool
*
pass
);
int32_t
ctgPutRmDBToQueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
);
int32_t
ctgPutRmDBToQueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
);
int32_t
ctgPutRmStbToQueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
const
char
*
stbName
,
uint64_t
suid
,
bool
syncReq
);
int32_t
ctgPutRmStbToQueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
const
char
*
stbName
,
uint64_t
suid
,
bool
syncReq
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
9668016f
...
@@ -834,7 +834,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm
...
@@ -834,7 +834,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm
int32_t
tbType
=
0
;
int32_t
tbType
=
0
;
uint64_t
suid
=
0
;
uint64_t
suid
=
0
;
char
stbName
[
TSDB_TABLE_FNAME_LEN
];
char
stbName
[
TSDB_TABLE_FNAME_LEN
];
ctg
Get
TbSverFromCache
(
pCtg
,
&
name
,
&
sver
,
&
tbType
,
&
suid
,
stbName
);
ctg
Read
TbSverFromCache
(
pCtg
,
&
name
,
&
sver
,
&
tbType
,
&
suid
,
stbName
);
if
(
sver
>=
0
&&
sver
<
pTb
->
sver
)
{
if
(
sver
>=
0
&&
sver
<
pTb
->
sver
)
{
switch
(
tbType
)
{
switch
(
tbType
)
{
case
TSDB_CHILD_TABLE
:
{
case
TSDB_CHILD_TABLE
:
{
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
9668016f
...
@@ -322,7 +322,8 @@ _return:
...
@@ -322,7 +322,8 @@ _return:
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgReadTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
)
{
int32_t
ctgReadTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
,
int32_t
*
tbType
,
uint64_t
*
suid
,
char
*
stbName
)
{
*
sver
=
-
1
;
*
sver
=
-
1
;
if
(
NULL
==
pCtg
->
dbCache
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
...
@@ -331,7 +332,7 @@ int32_t ctgReadTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
...
@@ -331,7 +332,7 @@ int32_t ctgReadTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
}
}
SCtgDBCache
*
dbCache
=
NULL
;
SCtgDBCache
*
dbCache
=
NULL
;
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
dbFName
);
tNameGetFullDbName
(
pTableName
,
dbFName
);
ctgAcquireDBCache
(
pCtg
,
dbFName
,
&
dbCache
);
ctgAcquireDBCache
(
pCtg
,
dbFName
,
&
dbCache
);
...
@@ -340,14 +341,12 @@ int32_t ctgReadTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
...
@@ -340,14 +341,12 @@ int32_t ctgReadTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
tbType
=
0
;
uint64_t
suid
=
0
;
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
STableMeta
*
tbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
metaCache
,
pTableName
->
tname
,
strlen
(
pTableName
->
tname
));
STableMeta
*
tbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
metaCache
,
pTableName
->
tname
,
strlen
(
pTableName
->
tname
));
if
(
tbMeta
)
{
if
(
tbMeta
)
{
tbType
=
tbMeta
->
tableType
;
*
tbType
=
tbMeta
->
tableType
;
suid
=
tbMeta
->
suid
;
*
suid
=
tbMeta
->
suid
;
if
(
tbType
!=
TSDB_CHILD_TABLE
)
{
if
(
*
tbType
!=
TSDB_CHILD_TABLE
)
{
*
sver
=
tbMeta
->
sversion
;
*
sver
=
tbMeta
->
sversion
;
}
}
}
}
...
@@ -358,43 +357,51 @@ int32_t ctgReadTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
...
@@ -358,43 +357,51 @@ int32_t ctgReadTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
tbType
!=
TSDB_CHILD_TABLE
)
{
if
(
*
tbType
!=
TSDB_CHILD_TABLE
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
tbType
,
dbFName
,
pTableName
->
tname
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
*
tbType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
ctgDebug
(
"Got subtable meta from cache, dbFName:%s, tbName:%s, suid:%"
PRIx64
,
dbFName
,
pTableName
->
tname
,
suid
);
ctgDebug
(
"Got subtable meta from cache, dbFName:%s, tbName:%s, suid:%"
PRIx64
,
dbFName
,
pTableName
->
tname
,
*
suid
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
&
suid
,
sizeof
(
suid
));
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
suid
,
sizeof
(
*
suid
));
if
(
NULL
==
stbMeta
||
NULL
==
*
stbMeta
)
{
if
(
NULL
==
stbMeta
||
NULL
==
*
stbMeta
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"stb not in stbCache, suid:%"
PRIx64
,
suid
);
ctgDebug
(
"stb not in stbCache, suid:%"
PRIx64
,
*
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
((
*
stbMeta
)
->
suid
!=
suid
)
{
if
((
*
stbMeta
)
->
suid
!=
*
suid
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgError
(
"stable suid in stbCache mis-match, expected suid:%"
PRIx64
",actual suid:%"
PRIx64
,
suid
,
(
*
stbMeta
)
->
suid
);
ctgError
(
"stable suid in stbCache mis-match, expected suid:%"
PRIx64
",actual suid:%"
PRIx64
,
*
suid
,
(
*
stbMeta
)
->
suid
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
}
size_t
nameLen
=
0
;
char
*
name
=
taosHashGetKey
(
*
stbMeta
,
&
nameLen
);
strncpy
(
stbName
,
name
,
nameLen
);
stbName
[
nameLen
]
=
0
;
*
sver
=
(
*
stbMeta
)
->
sversion
;
*
sver
=
(
*
stbMeta
)
->
sversion
;
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
tbType
,
dbFName
,
pTableName
->
tname
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
*
tbType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgGetTbTypeFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
const
char
*
tableName
,
int32_t
*
tbType
)
{
int32_t
ctgGetTbTypeFromCache
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
const
char
*
tableName
,
int32_t
*
tbType
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
ctgWarn
(
"empty db cache, dbFName:%s, tbName:%s"
,
dbFName
,
tableName
);
ctgWarn
(
"empty db cache, dbFName:%s, tbName:%s"
,
dbFName
,
tableName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录