Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f1a90648
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f1a90648
编写于
4月 01, 2020
作者:
S
slguan
提交者:
GitHub
4月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1489 from taosdata/refactor/cluster
[TD-17] fix error while alloc vnodes
上级
03d6af86
7330301f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
39 deletion
+46
-39
src/dnode/src/dnodeMClient.c
src/dnode/src/dnodeMClient.c
+3
-1
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+1
-1
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+1
-0
src/mnode/src/mgmtBalance.c
src/mnode/src/mgmtBalance.c
+27
-37
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+14
-0
未找到文件。
src/dnode/src/dnodeMClient.c
浏览文件 @
f1a90648
...
@@ -128,7 +128,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -128,7 +128,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
}
}
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsDnodeMClientRpc
,
&
tsDnodeMnodeIpList
,
rpcMsg
);
if
(
tsDnodeMClientRpc
)
{
rpcSendRequest
(
tsDnodeMClientRpc
,
&
tsDnodeMnodeIpList
,
rpcMsg
);
}
}
}
static
bool
dnodeReadMnodeIpList
()
{
static
bool
dnodeReadMnodeIpList
()
{
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
f1a90648
...
@@ -178,9 +178,9 @@ static void dnodeCleanUpSystem() {
...
@@ -178,9 +178,9 @@ static void dnodeCleanUpSystem() {
tclearModuleStatus
(
TSDB_MOD_MGMT
);
tclearModuleStatus
(
TSDB_MOD_MGMT
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_STOPPED
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_STOPPED
);
dnodeCleanupShell
();
dnodeCleanupShell
();
dnodeCleanupMClient
();
dnodeCleanupMnode
();
dnodeCleanupMnode
();
dnodeCleanupMgmt
();
dnodeCleanupMgmt
();
dnodeCleanupMClient
();
dnodeCleanupWrite
();
dnodeCleanupWrite
();
dnodeCleanupRead
();
dnodeCleanupRead
();
dnodeCleanUpModules
();
dnodeCleanUpModules
();
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
f1a90648
...
@@ -24,6 +24,7 @@ extern "C" {
...
@@ -24,6 +24,7 @@ extern "C" {
int32_t
mgmtInitDnodes
();
int32_t
mgmtInitDnodes
();
void
mgmtCleanUpDnodes
();
void
mgmtCleanUpDnodes
();
int32_t
mgmtGetDnodesNum
();
int32_t
mgmtGetDnodesNum
();
void
*
mgmtGetNextDnode
(
void
*
pNode
,
SDnodeObj
**
pDnode
);
SDnodeObj
*
mgmtGetDnode
(
int32_t
dnodeId
);
SDnodeObj
*
mgmtGetDnode
(
int32_t
dnodeId
);
SDnodeObj
*
mgmtGetDnodeByIp
(
uint32_t
ip
);
SDnodeObj
*
mgmtGetDnodeByIp
(
uint32_t
ip
);
...
...
src/mnode/src/mgmtBalance.c
浏览文件 @
f1a90648
...
@@ -18,47 +18,37 @@
...
@@ -18,47 +18,37 @@
#include "mgmtBalance.h"
#include "mgmtBalance.h"
#include "mgmtDnode.h"
#include "mgmtDnode.h"
int32_t
(
*
mgmtInitBalanceFp
)()
=
NULL
;
int32_t
mgmtInitBalance
()
{
return
0
;
}
void
(
*
mgmtCleanupBalanceFp
)()
=
NULL
;
void
mgmtCleanupBalance
()
{}
void
(
*
mgmtStartBalanceTimerFp
)(
int32_t
afterMs
)
=
NULL
;
void
mgmtStartBalanceTimer
(
int32_t
afterMs
)
{}
int32_t
(
*
mgmtAllocVnodesFp
)(
SVgObj
*
pVgroup
)
=
NULL
;
int32_t
mgmtInitBalance
()
{
if
(
mgmtInitBalanceFp
)
{
return
(
*
mgmtInitBalanceFp
)();
}
else
{
return
0
;
}
}
void
mgmtCleanupBalance
()
{
if
(
mgmtCleanupBalanceFp
)
{
(
*
mgmtCleanupBalanceFp
)();
}
}
void
mgmtStartBalanceTimer
(
int32_t
afterMs
)
{
if
(
mgmtStartBalanceTimerFp
)
{
(
*
mgmtStartBalanceTimerFp
)(
afterMs
);
}
}
int32_t
mgmtAllocVnodes
(
SVgObj
*
pVgroup
)
{
int32_t
mgmtAllocVnodes
(
SVgObj
*
pVgroup
)
{
if
(
mgmtAllocVnodesFp
)
{
void
*
pNode
=
NULL
;
return
(
*
mgmtAllocVnodesFp
)(
pVgroup
);
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pSelDnode
=
NULL
;
float
vnodeUsage
=
1
.
0
;
while
(
1
)
{
pNode
=
mgmtGetNextDnode
(
pNode
,
&
pDnode
);
if
(
pDnode
==
NULL
)
break
;
if
(
pDnode
->
numOfTotalVnodes
<=
0
)
continue
;
if
(
pDnode
->
openVnodes
==
pDnode
->
numOfTotalVnodes
)
continue
;
float
usage
=
(
float
)
pDnode
->
openVnodes
/
pDnode
->
numOfTotalVnodes
;
if
(
usage
<=
vnodeUsage
)
{
pSelDnode
=
pDnode
;
vnodeUsage
=
usage
;
}
}
}
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
1
);
if
(
pSelDnode
==
NULL
)
{
if
(
pDnode
==
NULL
)
return
TSDB_CODE_OTHERS
;
mError
(
"failed to alloc vnode to vgroup"
,
pDnode
->
dnodeId
);
if
(
pDnode
->
openVnodes
<
pDnode
->
numOfTotalVnodes
)
{
pVgroup
->
vnodeGid
[
0
].
dnodeId
=
pDnode
->
dnodeId
;
pVgroup
->
vnodeGid
[
0
].
privateIp
=
pDnode
->
privateIp
;
pVgroup
->
vnodeGid
[
0
].
publicIp
=
pDnode
->
publicIp
;
mTrace
(
"dnode:%d, alloc one vnode to vgroup"
,
pDnode
->
dnodeId
);
return
TSDB_CODE_SUCCESS
;
}
else
{
mError
(
"dnode:%d, failed to alloc vnode to vgroup"
,
pDnode
->
dnodeId
);
return
TSDB_CODE_NO_ENOUGH_DNODES
;
return
TSDB_CODE_NO_ENOUGH_DNODES
;
}
}
pVgroup
->
vnodeGid
[
0
].
dnodeId
=
pSelDnode
->
dnodeId
;
pVgroup
->
vnodeGid
[
0
].
privateIp
=
pSelDnode
->
privateIp
;
pVgroup
->
vnodeGid
[
0
].
publicIp
=
pSelDnode
->
publicIp
;
mTrace
(
"dnode:%d, alloc one vnode to vgroup"
,
pSelDnode
->
dnodeId
);
return
TSDB_CODE_SUCCESS
;
}
}
src/mnode/src/mgmtDnode.c
浏览文件 @
f1a90648
...
@@ -32,6 +32,7 @@ static void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg);
...
@@ -32,6 +32,7 @@ static void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg);
extern
int32_t
clusterInit
();
extern
int32_t
clusterInit
();
extern
void
clusterCleanUp
();
extern
void
clusterCleanUp
();
extern
int32_t
clusterGetDnodesNum
();
extern
int32_t
clusterGetDnodesNum
();
extern
void
*
clusterGetNextDnode
(
void
*
pNode
,
SDnodeObj
**
pDnode
);
extern
SDnodeObj
*
clusterGetDnode
(
int32_t
dnodeId
);
extern
SDnodeObj
*
clusterGetDnode
(
int32_t
dnodeId
);
extern
SDnodeObj
*
clusterGetDnodeByIp
(
uint32_t
ip
);
extern
SDnodeObj
*
clusterGetDnodeByIp
(
uint32_t
ip
);
static
SDnodeObj
tsDnodeObj
=
{
0
};
static
SDnodeObj
tsDnodeObj
=
{
0
};
...
@@ -98,6 +99,19 @@ int32_t mgmtGetDnodesNum() {
...
@@ -98,6 +99,19 @@ int32_t mgmtGetDnodesNum() {
#endif
#endif
}
}
void
*
mgmtGetNextDnode
(
void
*
pNode
,
SDnodeObj
**
pDnode
)
{
#ifdef _CLUSTER
return
(
*
clusterGetNextDnode
)(
pNode
,
pDnode
);
#else
if
(
*
pDnode
==
NULL
)
{
*
pDnode
=
&
tsDnodeObj
;
}
else
{
*
pDnode
=
NULL
;
}
return
*
pDnode
;
#endif
}
void
mgmtProcessCfgDnodeMsg
(
SQueuedMsg
*
pMsg
)
{
void
mgmtProcessCfgDnodeMsg
(
SQueuedMsg
*
pMsg
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
thandle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
0
,
.
msgType
=
0
};
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
thandle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
0
,
.
msgType
=
0
};
if
(
mgmtCheckRedirect
(
pMsg
->
thandle
))
return
;
if
(
mgmtCheckRedirect
(
pMsg
->
thandle
))
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录