Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
965cc65b
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看板
提交
965cc65b
编写于
7月 30, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix catalog deaklock issue
上级
2a09e003
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
65 addition
and
50 deletion
+65
-50
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+2
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+62
-49
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+1
-1
未找到文件。
source/libs/catalog/inc/catalogInt.h
浏览文件 @
965cc65b
...
...
@@ -679,6 +679,8 @@ void ctgClearSubTaskRes(SCtgSubRes *pRes);
void
ctgFreeQNode
(
SCtgQNode
*
node
);
void
ctgClearHandle
(
SCatalog
*
pCtg
);
void
ctgFreeTbCacheImpl
(
SCtgTbCache
*
pCache
);
int32_t
ctgRemoveTbMeta
(
SCatalog
*
pCtg
,
SName
*
pTableName
);
int32_t
ctgGetTbHashVgroup
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
extern
SCatalogMgmt
gCtgMgmt
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
965cc65b
...
...
@@ -92,7 +92,7 @@ int32_t ctgRefreshTbMeta(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMetaCtx*
int32_t
code
=
0
;
if
(
!
CTG_FLAG_IS_SYS_DB
(
ctx
->
flag
))
{
CTG_ERR_RET
(
c
atalogGetTable
HashVgroup
(
pCtg
,
pConn
,
ctx
->
pName
,
&
vgroupInfo
));
CTG_ERR_RET
(
c
tgGetTb
HashVgroup
(
pCtg
,
pConn
,
ctx
->
pName
,
&
vgroupInfo
));
}
STableMetaOutput
moutput
=
{
0
};
...
...
@@ -337,7 +337,10 @@ int32_t ctgGetTbType(SCatalog* pCtg, SRequestConnInfo *pConn, SName* pTableName,
}
STableMeta
*
pMeta
=
NULL
;
CTG_ERR_RET
(
catalogGetTableMeta
(
pCtg
,
pConn
,
pTableName
,
&
pMeta
));
SCtgTbMetaCtx
ctx
=
{
0
};
ctx
.
pName
=
(
SName
*
)
pTableName
;
ctx
.
flag
=
CTG_FLAG_UNKNOWN_STB
;
CTG_ERR_RET
(
ctgGetTbMeta
(
pCtg
,
pConn
,
&
ctx
,
&
pMeta
));
*
tbType
=
pMeta
->
tableType
;
taosMemoryFree
(
pMeta
);
...
...
@@ -391,7 +394,7 @@ int32_t ctgGetTbCfg(SCatalog* pCtg, SRequestConnInfo *pConn, SName* pTableName,
CTG_ERR_RET
(
ctgGetTableCfgFromMnode
(
pCtg
,
pConn
,
pTableName
,
pCfg
,
NULL
));
}
else
{
SVgroupInfo
vgroupInfo
=
{
0
};
CTG_ERR_RET
(
c
atalogGetTable
HashVgroup
(
pCtg
,
pConn
,
pTableName
,
&
vgroupInfo
));
CTG_ERR_RET
(
c
tgGetTb
HashVgroup
(
pCtg
,
pConn
,
pTableName
,
&
vgroupInfo
));
CTG_ERR_RET
(
ctgGetTableCfgFromVnode
(
pCtg
,
pConn
,
pTableName
,
&
vgroupInfo
,
pCfg
,
NULL
));
}
...
...
@@ -477,6 +480,57 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgGetTbHashVgroup
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
)
{
if
(
IS_SYS_DBNAME
(
pTableName
->
dbname
))
{
ctgError
(
"no valid vgInfo for db, dbname:%s"
,
pTableName
->
dbname
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
SCtgDBCache
*
dbCache
=
NULL
;
int32_t
code
=
0
;
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
db
);
SDBVgInfo
*
vgInfo
=
NULL
;
CTG_ERR_JRET
(
ctgGetDBVgInfo
(
pCtg
,
pConn
,
db
,
&
dbCache
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
vgInfo
?
vgInfo
:
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
_return:
if
(
dbCache
)
{
ctgRUnlockVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
if
(
vgInfo
)
{
taosHashCleanup
(
vgInfo
->
vgHash
);
taosMemoryFreeClear
(
vgInfo
);
}
CTG_RET
(
code
);
}
int32_t
ctgRemoveTbMeta
(
SCatalog
*
pCtg
,
SName
*
pTableName
)
{
int32_t
code
=
0
;
if
(
NULL
==
pCtg
||
NULL
==
pTableName
)
{
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
if
(
NULL
==
pCtg
->
dbCache
)
{
return
TSDB_CODE_SUCCESS
;
}
CTG_ERR_JRET
(
ctgRemoveTbMetaFromCache
(
pCtg
,
pTableName
,
true
));
_return:
CTG_RET
(
code
);
}
int32_t
catalogInit
(
SCatalogCfg
*
cfg
)
{
if
(
gCtgMgmt
.
pCluster
)
{
qError
(
"catalog already initialized"
);
...
...
@@ -772,21 +826,7 @@ _return:
int32_t
catalogRemoveTableMeta
(
SCatalog
*
pCtg
,
SName
*
pTableName
)
{
CTG_API_ENTER
();
int32_t
code
=
0
;
if
(
NULL
==
pCtg
||
NULL
==
pTableName
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
if
(
NULL
==
pCtg
->
dbCache
)
{
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
);
}
CTG_ERR_JRET
(
ctgRemoveTbMetaFromCache
(
pCtg
,
pTableName
,
true
));
_return:
CTG_API_LEAVE
(
code
);
CTG_API_LEAVE
(
ctgRemoveTbMeta
(
pCtg
,
pTableName
));
}
int32_t
catalogRemoveStbMeta
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
uint64_t
dbId
,
const
char
*
stbName
,
uint64_t
suid
)
{
...
...
@@ -878,12 +918,12 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, SRequestConnInfo *pConn, SArray*
case
TSDB_CHILD_TABLE
:
{
SName
stb
=
name
;
strcpy
(
stb
.
tname
,
stbName
);
c
atalogRemoveTable
Meta
(
pCtg
,
&
stb
);
c
tgRemoveTb
Meta
(
pCtg
,
&
stb
);
break
;
}
case
TSDB_SUPER_TABLE
:
case
TSDB_NORMAL_TABLE
:
c
atalogRemoveTable
Meta
(
pCtg
,
&
name
);
c
tgRemoveTb
Meta
(
pCtg
,
&
name
);
break
;
default:
ctgError
(
"ignore table type %d"
,
tbType
);
...
...
@@ -947,34 +987,7 @@ int32_t catalogGetTableDistVgInfo(SCatalog* pCtg, SRequestConnInfo *pConn, const
int32_t
catalogGetTableHashVgroup
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
)
{
CTG_API_ENTER
();
if
(
IS_SYS_DBNAME
(
pTableName
->
dbname
))
{
ctgError
(
"no valid vgInfo for db, dbname:%s"
,
pTableName
->
dbname
);
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
SCtgDBCache
*
dbCache
=
NULL
;
int32_t
code
=
0
;
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
db
);
SDBVgInfo
*
vgInfo
=
NULL
;
CTG_ERR_JRET
(
ctgGetDBVgInfo
(
pCtg
,
pConn
,
db
,
&
dbCache
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
vgInfo
?
vgInfo
:
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
_return:
if
(
dbCache
)
{
ctgRUnlockVgInfo
(
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
if
(
vgInfo
)
{
taosHashCleanup
(
vgInfo
->
vgHash
);
taosMemoryFreeClear
(
vgInfo
);
}
CTG_API_LEAVE
(
code
);
CTG_API_LEAVE
(
ctgGetTbHashVgroup
(
pCtg
,
pConn
,
pTableName
,
pVgroup
));
}
int32_t
catalogGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
)
{
...
...
@@ -1200,7 +1213,7 @@ int32_t catalogRefreshGetTableCfg(SCatalog* pCtg, SRequestConnInfo *pConn, const
}
int32_t
code
=
0
;
CTG_ERR_JRET
(
c
atalogRemoveTable
Meta
(
pCtg
,
(
SName
*
)
pTableName
));
CTG_ERR_JRET
(
c
tgRemoveTb
Meta
(
pCtg
,
(
SName
*
)
pTableName
));
CTG_ERR_JRET
(
ctgGetTbCfg
(
pCtg
,
pConn
,
(
SName
*
)
pTableName
,
pCfg
));
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
965cc65b
...
...
@@ -398,7 +398,7 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob *pJob, con
SName
*
name
=
taosHashIterate
(
pTb
,
NULL
);
while
(
name
)
{
c
atalogRemoveTable
Meta
(
pCtg
,
name
);
c
tgRemoveTb
Meta
(
pCtg
,
name
);
name
=
taosHashIterate
(
pTb
,
name
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录