This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 349f47d8a3 HDDS-6877. Keep replication port unchanged when restarting
datanode in MiniOzoneCluster (#3510)
349f47d8a3 is described below
commit 349f47d8a382f648b2fd947519ab7bdbb989edcf
Author: Kaijie Chen <[email protected]>
AuthorDate: Wed Jun 22 01:29:26 2022 +0800
HDDS-6877. Keep replication port unchanged when restarting datanode in
MiniOzoneCluster (#3510)
---
.../org/apache/hadoop/ozone/MiniOzoneClusterImpl.java | 3 +++
.../org/apache/hadoop/ozone/TestMiniOzoneCluster.java | 17 +++++++++++++++++
2 files changed, 20 insertions(+)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
index bf574e3a90..8e8de6df6a 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
@@ -80,6 +80,7 @@ import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_HEARTBEAT_INTERVAL;
import static org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.RATIS;
import static
org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.RATIS_ADMIN;
import static
org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.RATIS_SERVER;
+import static
org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.REPLICATION;
import static
org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.STANDALONE;
import static
org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState.HEALTHY;
import static
org.apache.hadoop.hdds.recon.ReconConfigKeys.OZONE_RECON_ADDRESS_KEY;
@@ -415,6 +416,8 @@ public class MiniOzoneClusterImpl implements
MiniOzoneCluster {
dn.getPort(RATIS_ADMIN).getValue());
config.setInt(DFS_CONTAINER_RATIS_SERVER_PORT,
dn.getPort(RATIS_SERVER).getValue());
+ config.setFromObject(conf.getObject(ReplicationConfig.class)
+ .setPort(dn.getPort(REPLICATION).getValue()));
hddsDatanodes.remove(i);
if (waitForDatanode) {
// wait for node to be removed from SCM healthy node list.
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
index 2f4df638e0..09fb5e9ef7 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
@@ -89,6 +89,7 @@ public class TestMiniOzoneCluster {
conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, TEST_ROOT.toString());
conf.setInt(ScmConfigKeys.OZONE_DATANODE_PIPELINE_LIMIT, 1);
conf.setBoolean(DFS_CONTAINER_RATIS_IPC_RANDOM_PORT, true);
+ conf.set(ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL, "1s");
WRITE_TMP.mkdirs();
READ_TMP.mkdirs();
}
@@ -281,6 +282,22 @@ public class TestMiniOzoneCluster {
}
}
+ @Test
+ public void testKeepPortsWhenRestartDN() throws Exception {
+ cluster = MiniOzoneCluster.newBuilder(conf)
+ .setNumDatanodes(1)
+ .build();
+ cluster.waitForClusterToBeReady();
+ DatanodeDetails before =
+ cluster.getHddsDatanodes().get(0).getDatanodeDetails();
+ cluster.restartHddsDatanode(0, true);
+ DatanodeDetails after =
+ cluster.getHddsDatanodes().get(0).getDatanodeDetails();
+ for (Port.Name name : Port.Name.ALL_PORTS) {
+ assertEquals(before.getPort(name), after.getPort(name));
+ }
+ }
+
private void createMalformedIDFile(File malformedFile)
throws IOException {
malformedFile.delete();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]