This is an automated email from the ASF dual-hosted git repository.
Hexiaoqiao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new b3cf28ffea5 HDFS-17877. Fix DatanodeID.updateRegInfo() does not update
hostNameBytes causing stale hostname on client (#8494). Contributed by YUBI LEE.
b3cf28ffea5 is described below
commit b3cf28ffea56bdf53f7c4bd0970deb47e93c7ca2
Author: Yubi Lee <[email protected]>
AuthorDate: Fri May 15 13:26:42 2026 +0900
HDFS-17877. Fix DatanodeID.updateRegInfo() does not update hostNameBytes
causing stale hostname on client (#8494). Contributed by YUBI LEE.
Signed-off-by: He Xiaoqiao <[email protected]>
---
.../apache/hadoop/hdfs/protocol/DatanodeID.java | 1 +
.../hadoop/hdfs/protocol/TestDatanodeID.java | 39 ++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java
index f1623482440..cd95373e746 100644
---
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java
+++
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java
@@ -302,6 +302,7 @@ public void updateRegInfo(DatanodeID nodeReg) {
setIpAndXferPort(nodeReg.getIpAddr(), nodeReg.getIpAddrBytes(),
nodeReg.getXferPort());
hostName = nodeReg.getHostName();
+ hostNameBytes = nodeReg.getHostNameBytes();
peerHostName = nodeReg.getPeerHostName();
infoPort = nodeReg.getInfoPort();
infoSecurePort = nodeReg.getInfoSecurePort();
diff --git
a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestDatanodeID.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestDatanodeID.java
new file mode 100644
index 00000000000..f4022339878
--- /dev/null
+++
b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestDatanodeID.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdfs.protocol;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
+
+public class TestDatanodeID {
+
+ @Test
+ public void testUpdateRegInfoUpdatesHostNameBytes() {
+ DatanodeID original = new DatanodeID("1.2.3.4", "host1-dc2",
+ "uuid-1", 9866, 9864, 9865, 9867);
+
+ DatanodeID updated = new DatanodeID("1.2.3.4", "host1-dc2.example.com",
+ "uuid-1", 9866, 9864, 9865, 9867);
+
+ original.updateRegInfo(updated);
+ assertEquals("host1-dc2.example.com", original.getHostName());
+ assertEquals("host1-dc2.example.com",
+ original.getHostNameBytes().toStringUtf8());
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]