Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c35e6aa3
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看板
未验证
提交
c35e6aa3
编写于
4月 12, 2023
作者:
X
Xiaoyu Wang
提交者:
GitHub
4月 12, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20842 from taosdata/fix/hash-ref-count-high
add cancel in fetch cluster
上级
d551075b
adf25d33
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
10 deletion
+17
-10
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+17
-10
未找到文件。
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
c35e6aa3
...
@@ -67,7 +67,7 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) {
...
@@ -67,7 +67,7 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) {
return
0
;
return
0
;
}
}
static
SClusterObj
*
mndAcquireCluster
(
SMnode
*
pMnode
)
{
static
SClusterObj
*
mndAcquireCluster
(
SMnode
*
pMnode
,
void
**
ppIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
...
@@ -76,23 +76,27 @@ static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
...
@@ -76,23 +76,27 @@ static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
pIter
=
sdbFetch
(
pSdb
,
SDB_CLUSTER
,
pIter
,
(
void
**
)
&
pCluster
);
pIter
=
sdbFetch
(
pSdb
,
SDB_CLUSTER
,
pIter
,
(
void
**
)
&
pCluster
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
*
ppIter
=
pIter
;
return
pCluster
;
return
pCluster
;
}
}
return
NULL
;
return
NULL
;
}
}
static
void
mndReleaseCluster
(
SMnode
*
pMnode
,
SClusterObj
*
pCluster
)
{
static
void
mndReleaseCluster
(
SMnode
*
pMnode
,
SClusterObj
*
pCluster
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pCluster
);
sdbRelease
(
pSdb
,
pCluster
);
}
}
int64_t
mndGetClusterId
(
SMnode
*
pMnode
)
{
int64_t
mndGetClusterId
(
SMnode
*
pMnode
)
{
int64_t
clusterId
=
0
;
int64_t
clusterId
=
0
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
);
void
*
pIter
=
NULL
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
,
&
pIter
);
if
(
pCluster
!=
NULL
)
{
if
(
pCluster
!=
NULL
)
{
clusterId
=
pCluster
->
id
;
clusterId
=
pCluster
->
id
;
mndReleaseCluster
(
pMnode
,
pCluster
);
mndReleaseCluster
(
pMnode
,
pCluster
,
pIter
);
}
}
return
clusterId
;
return
clusterId
;
...
@@ -100,10 +104,11 @@ int64_t mndGetClusterId(SMnode *pMnode) {
...
@@ -100,10 +104,11 @@ int64_t mndGetClusterId(SMnode *pMnode) {
int64_t
mndGetClusterCreateTime
(
SMnode
*
pMnode
)
{
int64_t
mndGetClusterCreateTime
(
SMnode
*
pMnode
)
{
int64_t
createTime
=
0
;
int64_t
createTime
=
0
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
);
void
*
pIter
=
NULL
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
,
&
pIter
);
if
(
pCluster
!=
NULL
)
{
if
(
pCluster
!=
NULL
)
{
createTime
=
pCluster
->
createdTime
;
createTime
=
pCluster
->
createdTime
;
mndReleaseCluster
(
pMnode
,
pCluster
);
mndReleaseCluster
(
pMnode
,
pCluster
,
pIter
);
}
}
return
createTime
;
return
createTime
;
...
@@ -121,10 +126,11 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
...
@@ -121,10 +126,11 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
float
mndGetClusterUpTime
(
SMnode
*
pMnode
)
{
float
mndGetClusterUpTime
(
SMnode
*
pMnode
)
{
int64_t
upTime
=
0
;
int64_t
upTime
=
0
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
);
void
*
pIter
=
NULL
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
,
&
pIter
);
if
(
pCluster
!=
NULL
)
{
if
(
pCluster
!=
NULL
)
{
upTime
=
mndGetClusterUpTimeImp
(
pCluster
);
upTime
=
mndGetClusterUpTimeImp
(
pCluster
);
mndReleaseCluster
(
pMnode
,
pCluster
);
mndReleaseCluster
(
pMnode
,
pCluster
,
pIter
);
}
}
return
upTime
/
86400
.
0
f
;
return
upTime
/
86400
.
0
f
;
...
@@ -321,11 +327,12 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter) {
...
@@ -321,11 +327,12 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter) {
static
int32_t
mndProcessUptimeTimer
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessUptimeTimer
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SClusterObj
clusterObj
=
{
0
};
SClusterObj
clusterObj
=
{
0
};
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
);
void
*
pIter
=
NULL
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
,
&
pIter
);
if
(
pCluster
!=
NULL
)
{
if
(
pCluster
!=
NULL
)
{
memcpy
(
&
clusterObj
,
pCluster
,
sizeof
(
SClusterObj
));
memcpy
(
&
clusterObj
,
pCluster
,
sizeof
(
SClusterObj
));
clusterObj
.
upTime
+=
tsUptimeInterval
;
clusterObj
.
upTime
+=
tsUptimeInterval
;
mndReleaseCluster
(
pMnode
,
pCluster
);
mndReleaseCluster
(
pMnode
,
pCluster
,
pIter
);
}
}
if
(
clusterObj
.
id
<=
0
)
{
if
(
clusterObj
.
id
<=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录