This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 47260908546 branch-4.0: [feat](libhdfs3) support
dfs.client.use.datanode.hostname for libhdfs3 #59915 (#60712)
47260908546 is described below
commit 47260908546de2e0fe2cd29b3f3bda18b1b321d0
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Feb 14 20:36:40 2026 +0800
branch-4.0: [feat](libhdfs3) support dfs.client.use.datanode.hostname for
libhdfs3 #59915 (#60712)
Cherry-picked from #59915
Co-authored-by: camby <[email protected]>
---
thirdparty/download-thirdparty.sh | 13 ++++
thirdparty/patches/libhdfs3-v2.3.9-hostname.patch | 74 +++++++++++++++++++++++
2 files changed, 87 insertions(+)
diff --git a/thirdparty/download-thirdparty.sh
b/thirdparty/download-thirdparty.sh
index 75e5d38d814..68291cdf21c 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -526,6 +526,19 @@ if [[ " ${TP_ARCHIVES[*]} " =~ " KRB5 " ]]; then
echo "Finished patching ${KRB5_SOURCE}"
fi
+# patch libhdfs3
+if [[ " ${TP_ARCHIVES[*]} " =~ " HDFS3 " ]]; then
+ if [[ "${HDFS3_SOURCE}" == "doris-thirdparty-libhdfs3-v2.3.9" ]]; then
+ cd "${TP_SOURCE_DIR}/${HDFS3_SOURCE}"
+ if [[ ! -f "${PATCHED_MARK}" ]]; then
+ patch -p1 <"${TP_PATCH_DIR}/libhdfs3-v2.3.9-hostname.patch"
+ touch "${PATCHED_MARK}"
+ fi
+ cd -
+ fi
+ echo "Finished patching ${HDFS3_SOURCE}"
+fi
+
# patch bitshuffle
MACHINE_OS=$(uname -s)
diff --git a/thirdparty/patches/libhdfs3-v2.3.9-hostname.patch
b/thirdparty/patches/libhdfs3-v2.3.9-hostname.patch
new file mode 100644
index 00000000000..497fdd0e0ee
--- /dev/null
+++ b/thirdparty/patches/libhdfs3-v2.3.9-hostname.patch
@@ -0,0 +1,74 @@
+diff --git a/src/client/RemoteBlockReader.cpp
b/src/client/RemoteBlockReader.cpp
+--- a/src/client/RemoteBlockReader.cpp 2023-04-11 14:31:06
++++ b/src/client/RemoteBlockReader.cpp 2026-01-15 11:50:44
+@@ -30,6 +30,7 @@
+ #include "WriteBuffer.h"
+
+ #include <inttypes.h>
++#include <string>
+ #include <vector>
+
+ namespace Hdfs {
+@@ -43,6 +44,7 @@
+ SessionConfig& conf)
+ : sentStatus(false),
+ verify(verify),
++ useDatanodeHostname(conf.isUseDatanodeHostname()),
+ binfo(eb),
+ datanode(datanode),
+ checksumSize(0),
+@@ -81,7 +83,8 @@
+
+ if (!sock) {
+ sock = shared_ptr<Socket>(new TcpSocketImpl);
+- sock->connect(dn.getIpAddr().c_str(), dn.getXferPort(),
++ const std::string host = useDatanodeHostname ? dn.getHostName() :
dn.getIpAddr();
++ sock->connect(host.c_str(), dn.getXferPort(),
+ connTimeout);
+ sock->setNoDelay(true);
+ }
+diff --git a/src/client/RemoteBlockReader.h b/src/client/RemoteBlockReader.h
+--- a/src/client/RemoteBlockReader.h 2023-04-11 14:31:06
++++ b/src/client/RemoteBlockReader.h 2026-01-15 11:50:16
+@@ -79,6 +79,7 @@
+ private:
+ bool sentStatus;
+ bool verify; //verify checksum or not.
++ bool useDatanodeHostname;
+ const ExtendedBlock & binfo;
+ DatanodeInfo & datanode;
+ int checksumSize;
+diff --git a/src/common/SessionConfig.cpp b/src/common/SessionConfig.cpp
+--- a/src/common/SessionConfig.cpp 2023-04-11 14:31:06
++++ b/src/common/SessionConfig.cpp 2026-01-15 11:50:09
+@@ -56,6 +56,8 @@
+ }, {
+ &readFromLocal, "dfs.client.read.shortcircuit", true
+ }, {
++ &useDatanodeHostname, "dfs.client.use.datanode.hostname", false
++ }, {
+ &addDatanode, "output.replace-datanode-on-failure", true
+ }, {
+ ¬RetryAnotherNode, "input.notretry-another-node", false
+diff --git a/src/common/SessionConfig.h b/src/common/SessionConfig.h
+--- a/src/common/SessionConfig.h 2023-04-11 14:31:06
++++ b/src/common/SessionConfig.h 2026-01-15 11:49:40
+@@ -125,6 +125,10 @@
+ return readFromLocal;
+ }
+
++ bool isUseDatanodeHostname() const {
++ return useDatanodeHostname;
++ }
++
+ int32_t getMaxGetBlockInfoRetry() const {
+ return maxGetBlockInfoRetry;
+ }
+@@ -351,6 +355,7 @@
+ */
+ bool useMappedFile;
+ bool readFromLocal;
++ bool useDatanodeHostname;
+ bool notRetryAnotherNode;
+ bool legacyLocalBlockReader;
+ int32_t inputConnTimeout;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]