Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
8d006205
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,发现更多精彩内容 >>
未验证
提交
8d006205
编写于
8月 17, 2022
作者:
Q
QiangShaowei
提交者:
GitHub
8月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IOTDB-4084] remove DataNode with exit code (#7031)
[IOTDB-4084] remove DataNode with exit code
上级
42b00d63
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
20 deletion
+21
-20
node-commons/src/main/java/org/apache/iotdb/commons/ServerCommandLine.java
...main/java/org/apache/iotdb/commons/ServerCommandLine.java
+1
-1
server/src/main/java/org/apache/iotdb/db/service/DataNodeServerCommandLine.java
...rg/apache/iotdb/db/service/DataNodeServerCommandLine.java
+20
-19
未找到文件。
node-commons/src/main/java/org/apache/iotdb/commons/ServerCommandLine.java
浏览文件 @
8d006205
...
...
@@ -37,7 +37,7 @@ public abstract class ServerCommandLine {
* @param args system args
* @return return 0 if exec success
*/
protected
abstract
int
run
(
String
[]
args
);
protected
abstract
int
run
(
String
[]
args
)
throws
Exception
;
protected
void
usage
(
String
message
)
{
if
(
message
!=
null
)
{
...
...
server/src/main/java/org/apache/iotdb/db/service/DataNodeServerCommandLine.java
浏览文件 @
8d006205
...
...
@@ -24,6 +24,7 @@ import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import
org.apache.iotdb.commons.ServerCommandLine
;
import
org.apache.iotdb.commons.exception.BadNodeUrlException
;
import
org.apache.iotdb.commons.exception.ConfigurationException
;
import
org.apache.iotdb.commons.exception.IoTDBException
;
import
org.apache.iotdb.commons.utils.NodeUrlUtils
;
import
org.apache.iotdb.confignode.rpc.thrift.TDataNodeConfigurationResp
;
import
org.apache.iotdb.confignode.rpc.thrift.TDataNodeRemoveReq
;
...
...
@@ -32,6 +33,7 @@ import org.apache.iotdb.db.client.ConfigNodeClient;
import
org.apache.iotdb.db.client.ConfigNodeInfo
;
import
org.apache.iotdb.db.conf.IoTDBDescriptor
;
import
org.apache.iotdb.db.conf.IoTDBStopCheck
;
import
org.apache.iotdb.rpc.TSStatusCode
;
import
org.apache.thrift.TException
;
import
org.slf4j.Logger
;
...
...
@@ -65,7 +67,7 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
}
@Override
protected
int
run
(
String
[]
args
)
{
protected
int
run
(
String
[]
args
)
throws
Exception
{
if
(
args
.
length
<
1
)
{
usage
(
null
);
return
-
1
;
...
...
@@ -104,17 +106,14 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
*
* @param args IPs for removed datanodes, split with ','
*/
private
void
doRemoveNode
(
String
[]
args
)
{
try
{
removePrepare
(
args
);
removeNodesFromCluster
(
args
);
removeTail
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"remove Data Nodes error"
,
e
);
}
private
void
doRemoveNode
(
String
[]
args
)
throws
Exception
{
// throw all exception to ServerCommandLine, it used System.exit
removePrepare
(
args
);
removeNodesFromCluster
(
args
);
removeTail
();
}
private
void
removePrepare
(
String
[]
args
)
throws
BadNodeUrlException
{
private
void
removePrepare
(
String
[]
args
)
throws
BadNodeUrlException
,
TException
{
ConfigNodeInfo
.
getInstance
()
.
updateConfigNodeList
(
IoTDBDescriptor
.
getInstance
().
getConfig
().
getTargetConfigNodeList
());
try
(
ConfigNodeClient
configNodeClient
=
new
ConfigNodeClient
())
{
...
...
@@ -137,18 +136,15 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
.
map
(
TEndPoint:
:
getIp
)
.
collect
(
Collectors
.
toList
());
IoTDBStopCheck
.
getInstance
().
checkIpInCluster
(
removedDataNodeIps
,
onlineDataNodeIps
);
}
catch
(
TException
e
)
{
logger
.
error
(
"remove Data Nodes check failed"
,
e
);
}
}
private
void
removeNodesFromCluster
(
String
[]
args
)
throws
BadNodeUrlException
{
private
void
removeNodesFromCluster
(
String
[]
args
)
throws
BadNodeUrlException
,
TException
,
IoTDBException
{
logger
.
info
(
"start to remove DataNode from cluster"
);
List
<
TDataNodeLocation
>
dataNodeLocations
=
buildDataNodeLocations
(
args
[
1
]);
if
(
dataNodeLocations
.
isEmpty
())
{
logger
.
error
(
"data nodes location is empty"
);
// throw Exception OR return?
return
;
throw
new
BadNodeUrlException
(
"build DataNode location is empty"
);
}
logger
.
info
(
"there has data nodes location will be removed. size is: {}, detail: {}"
,
...
...
@@ -158,8 +154,10 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
try
(
ConfigNodeClient
configNodeClient
=
new
ConfigNodeClient
())
{
TDataNodeRemoveResp
removeResp
=
configNodeClient
.
removeDataNode
(
removeReq
);
logger
.
info
(
"Remove result {} "
,
removeResp
.
toString
());
}
catch
(
TException
e
)
{
logger
.
error
(
"send remove Data Node request failed!"
,
e
);
if
(
removeResp
.
getStatus
().
getCode
()
!=
TSStatusCode
.
SUCCESS_STATUS
.
getStatusCode
())
{
throw
new
IoTDBException
(
removeResp
.
getStatus
().
toString
(),
removeResp
.
getStatus
().
getCode
());
}
}
}
...
...
@@ -191,7 +189,10 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
if
(
endPoints
.
size
()
!=
dataNodeLocations
.
size
())
{
logger
.
error
(
"build DataNode locations error, "
+
"because number of input ip NOT EQUALS the number of fetched DataNodeLocations, will return empty locations"
);
+
"because number of input DataNode({}) NOT EQUALS the number of fetched DataNodeLocations({}), will return empty locations"
,
endPoints
.
size
(),
dataNodeLocations
.
size
());
dataNodeLocations
.
clear
();
return
dataNodeLocations
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录