From ec3c5a369dd7167a6388d548c17c58e5c1d0b02d Mon Sep 17 00:00:00 2001 From: Weiqing Xu Date: Fri, 19 Jul 2019 07:32:59 +0800 Subject: [PATCH] support reading from HA mode HDSF the driver libhdfs3 can support HA mode. When the uri doesn't contain port num, the libhdfs3 will handle it in HA mode, treat the uri as nameservice name and read the real host and port from configuration file as the origin Java client. the default configuration file is hdfs-client.xml in the working directory, it also can be set in env variable "LIBHDFS3_CONF". the format of the configuration file is same with hdfs-site.xml. --- dbms/src/IO/HDFSCommon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/IO/HDFSCommon.cpp b/dbms/src/IO/HDFSCommon.cpp index 4be67c7a0de..0f1a58942d6 100644 --- a/dbms/src/IO/HDFSCommon.cpp +++ b/dbms/src/IO/HDFSCommon.cpp @@ -16,7 +16,7 @@ HDFSBuilderPtr createHDFSBuilder(const Poco::URI & uri) auto & host = uri.getHost(); auto port = uri.getPort(); auto & path = uri.getPath(); - if (host.empty() || port == 0 || path.empty()) + if (host.empty() || path.empty()) throw Exception("Illegal HDFS URI: " + uri.toString(), ErrorCodes::BAD_ARGUMENTS); HDFSBuilderPtr builder(hdfsNewBuilder());