Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
8addee0b
I
Iotdb
项目概览
apache
/
Iotdb
11 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8addee0b
编写于
8月 12, 2022
作者:
I
Itami Sho
提交者:
GitHub
8月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IOTDB-4102] Refactor config node removal process (#6977)
上级
33952b83
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
26 deletion
+37
-26
confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
...va/org/apache/iotdb/confignode/manager/ConfigManager.java
+1
-1
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java
...java/org/apache/iotdb/confignode/manager/NodeManager.java
+6
-22
confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
...otdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
+30
-3
未找到文件。
confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
浏览文件 @
8addee0b
...
...
@@ -781,7 +781,7 @@ public class ConfigManager implements IManager {
TSStatus
status
=
confirmLeader
();
if
(
status
.
getCode
()
==
TSStatusCode
.
SUCCESS_STATUS
.
getStatusCode
())
{
status
=
nodeManager
.
checkConfigNode
(
removeConfigNodePlan
);
status
=
nodeManager
.
checkConfigNode
BeforeRemove
(
removeConfigNodePlan
);
if
(
status
.
getCode
()
==
TSStatusCode
.
SUCCESS_STATUS
.
getStatusCode
())
{
procedureManager
.
removeConfigNode
(
removeConfigNodePlan
);
}
...
...
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java
浏览文件 @
8addee0b
...
...
@@ -284,28 +284,12 @@ public class NodeManager {
nodeInfo
.
addMetrics
();
}
public
TSStatus
removeConfigNodePeer
(
TConfigNodeLocation
tConfigNodeLocation
)
{
removeConfigNodeLock
.
tryLock
();
try
{
// Execute removePeer
if
(
getConsensusManager
().
removeConfigNodePeer
(
tConfigNodeLocation
))
{
configManager
.
getLoadManager
()
.
removeNodeHeartbeatHandCache
(
tConfigNodeLocation
.
getConfigNodeId
());
return
getConsensusManager
()
.
write
(
new
RemoveConfigNodePlan
(
tConfigNodeLocation
))
.
getStatus
();
}
else
{
return
new
TSStatus
(
TSStatusCode
.
REMOVE_CONFIGNODE_FAILED
.
getStatusCode
())
.
setMessage
(
"Remove ConfigNode failed because update ConsensusGroup peer information failed."
);
}
}
finally
{
removeConfigNodeLock
.
unlock
();
}
}
public
TSStatus
checkConfigNode
(
RemoveConfigNodePlan
removeConfigNodePlan
)
{
/**
* Only leader use this interface, check the ConfigNode before remove it
*
* @param removeConfigNodePlan RemoveConfigNodePlan
*/
public
TSStatus
checkConfigNodeBeforeRemove
(
RemoveConfigNodePlan
removeConfigNodePlan
)
{
removeConfigNodeLock
.
tryLock
();
try
{
// Check OnlineConfigNodes number
...
...
confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
浏览文件 @
8addee0b
...
...
@@ -29,9 +29,11 @@ import org.apache.iotdb.confignode.client.sync.confignode.SyncConfigNodeClientPo
import
org.apache.iotdb.confignode.client.sync.datanode.SyncDataNodeClientPool
;
import
org.apache.iotdb.confignode.consensus.request.write.DeleteStorageGroupPlan
;
import
org.apache.iotdb.confignode.consensus.request.write.PreDeleteStorageGroupPlan
;
import
org.apache.iotdb.confignode.consensus.request.write.RemoveConfigNodePlan
;
import
org.apache.iotdb.confignode.exception.AddConsensusGroupException
;
import
org.apache.iotdb.confignode.exception.AddPeerException
;
import
org.apache.iotdb.confignode.manager.ConfigManager
;
import
org.apache.iotdb.confignode.manager.ConsensusManager
;
import
org.apache.iotdb.confignode.procedure.exception.ProcedureException
;
import
org.apache.iotdb.confignode.procedure.scheduler.LockQueue
;
import
org.apache.iotdb.confignode.procedure.scheduler.ProcedureScheduler
;
...
...
@@ -68,6 +70,8 @@ public class ConfigNodeProcedureEnv {
private
static
boolean
invalidCacheResult
=
true
;
private
final
ReentrantLock
removeConfigNodeLock
;
public
static
void
setSkipForTest
(
boolean
skipForTest
)
{
ConfigNodeProcedureEnv
.
skipForTest
=
skipForTest
;
}
...
...
@@ -80,6 +84,7 @@ public class ConfigNodeProcedureEnv {
this
.
configManager
=
configManager
;
this
.
scheduler
=
scheduler
;
this
.
dataNodeRemoveHandler
=
new
DataNodeRemoveHandler
(
configManager
);
this
.
removeConfigNodeLock
=
new
ReentrantLock
();
}
public
ConfigManager
getConfigManager
()
{
...
...
@@ -193,9 +198,27 @@ public class ConfigNodeProcedureEnv {
*/
public
void
removeConfigNodePeer
(
TConfigNodeLocation
tConfigNodeLocation
)
throws
ProcedureException
{
TSStatus
tsStatus
=
configManager
.
getNodeManager
().
removeConfigNodePeer
(
tConfigNodeLocation
);
if
(
tsStatus
.
getCode
()
!=
TSStatusCode
.
SUCCESS_STATUS
.
getStatusCode
())
{
throw
new
ProcedureException
(
tsStatus
.
getMessage
());
removeConfigNodeLock
.
tryLock
();
TSStatus
tsStatus
;
try
{
// Execute removePeer
if
(
getConsensusManager
().
removeConfigNodePeer
(
tConfigNodeLocation
))
{
configManager
.
getLoadManager
()
.
removeNodeHeartbeatHandCache
(
tConfigNodeLocation
.
getConfigNodeId
());
tsStatus
=
getConsensusManager
().
write
(
new
RemoveConfigNodePlan
(
tConfigNodeLocation
)).
getStatus
();
}
else
{
tsStatus
=
new
TSStatus
(
TSStatusCode
.
REMOVE_CONFIGNODE_FAILED
.
getStatusCode
())
.
setMessage
(
"Remove ConfigNode failed because update ConsensusGroup peer information failed."
);
}
if
(
tsStatus
.
getCode
()
!=
TSStatusCode
.
SUCCESS_STATUS
.
getStatusCode
())
{
throw
new
ProcedureException
(
tsStatus
.
getMessage
());
}
}
finally
{
removeConfigNodeLock
.
unlock
();
}
}
...
...
@@ -287,4 +310,8 @@ public class ConfigNodeProcedureEnv {
public
DataNodeRemoveHandler
getDataNodeRemoveHandler
()
{
return
dataNodeRemoveHandler
;
}
private
ConsensusManager
getConsensusManager
()
{
return
configManager
.
getConsensusManager
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录