hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [25/52] [abbrv] hadoop git commit: HDFS-11099: libhdfs++: Expose rack id in hdfsDNInfo. Contributed by Xiaowei Zhu.
Date Thu, 22 Mar 2018 21:24:05 GMT
HDFS-11099: libhdfs++: Expose rack id in hdfsDNInfo.  Contributed by Xiaowei Zhu.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2524afbc
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2524afbc
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2524afbc

Branch: refs/heads/trunk
Commit: 2524afbc206d8f6f0344ee7de29e36b6c1b46e4e
Parents: b7d9a0f
Author: James <jhc@apache.org>
Authored: Mon Nov 7 10:41:59 2016 -0500
Committer: James Clampffer <james.clampffer@hp.com>
Committed: Thu Mar 22 17:19:47 2018 -0400

----------------------------------------------------------------------
 .../main/native/libhdfspp/include/hdfspp/block_location.h   | 9 +++++++++
 .../src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h     | 1 +
 .../src/main/native/libhdfspp/lib/bindings/c/hdfs.cc        | 5 +++++
 .../src/main/native/libhdfspp/lib/fs/filesystem.cc          | 2 ++
 .../src/main/native/libhdfspp/tests/hdfs_ext_test.cc        | 1 +
 5 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2524afbc/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/block_location.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/block_location.h
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/block_location.h
index cbe34be..5a03f41 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/block_location.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/block_location.h
@@ -41,6 +41,14 @@ public:
     this->ip_addr = ip_addr;
   }
 
+  std::string getNetworkLocation() const {
+    return network_location;
+  }
+
+  void setNetworkLocation(const std::string & location) {
+    this->network_location = location;
+  }
+
   int getXferPort() const {
     return xfer_port;
   }
@@ -75,6 +83,7 @@ public:
 private:
   std::string hostname;
   std::string ip_addr;
+  std::string network_location;
   int         xfer_port;
   int         info_port;
   int         IPC_port;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2524afbc/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h
index b41857c..72434e6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h
@@ -132,6 +132,7 @@ int hdfsBuilderConfGetLong(struct hdfsBuilder *bld, const char *key, int64_t
*va
 struct hdfsDNInfo {
   const char *    ip_address;
   const char *    hostname;
+  const char *    network_location;
   int             xfer_port;
   int             info_port;
   int             IPC_port;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2524afbc/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
index a43d94f..dd7d00c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
@@ -1248,6 +1248,10 @@ int hdfsGetBlockLocations(hdfsFS fs, const char *path, struct hdfsBlockLocations
         buf = new char[ppDNInfo.getIPAddr().size() + 1];
         strncpy(buf, ppDNInfo.getIPAddr().c_str(), ppDNInfo.getIPAddr().size() + 1);
         dn_info->ip_address = buf;
+
+        buf = new char[ppDNInfo.getNetworkLocation().size() + 1];
+        strncpy(buf, ppDNInfo.getNetworkLocation().c_str(), ppDNInfo.getNetworkLocation().size()
+ 1);
+        dn_info->network_location = buf;
       }
     }
 
@@ -1270,6 +1274,7 @@ int hdfsFreeBlockLocations(struct hdfsBlockLocations * blockLocations)
{
       auto location = &block->locations[j];
       delete[] location->hostname;
       delete[] location->ip_address;
+      delete[] location->network_location;
     }
   }
   delete[] blockLocations->blocks;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2524afbc/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc
index 72b30e5..5d5b9f2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc
@@ -354,6 +354,8 @@ BlockLocation LocatedBlockToBlockLocation(const hadoop::hdfs::LocatedBlockProto
         newInfo.setIPCPort(id.ipcport());
     if (id.has_infosecureport())
       newInfo.setInfoSecurePort(id.infosecureport());
+    if (datanode_info.has_location())
+      newInfo.setNetworkLocation(datanode_info.location());
     dn_info.push_back(newInfo);
   }
   result.setDataNodes(dn_info);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2524afbc/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc
index c160f7f..400b97c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc
@@ -56,6 +56,7 @@ TEST_F(HdfsExtTest, TestGetBlockLocations) {
   EXPECT_EQ(1, blocks->blocks->num_locations);
   EXPECT_NE(nullptr, blocks->blocks->locations->hostname);
   EXPECT_NE(nullptr, blocks->blocks->locations->ip_address);
+  EXPECT_NE(nullptr, blocks->blocks->locations->network_location);
   EXPECT_NE(0, blocks->blocks->locations->xfer_port);
 
   result = hdfsFreeBlockLocations(blocks);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message