You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wh...@apache.org on 2015/09/11 22:46:07 UTC

[1/2] hadoop git commit: HDFS-8952. InputStream.PositionRead() should be aware of available DNs. Contributed by Haohui Mai.

Repository: hadoop
Updated Branches:
  refs/heads/HDFS-8707 2a98ab5bc -> 24abbead5


HDFS-8952. InputStream.PositionRead() should be aware of available DNs. Contributed by Haohui Mai.


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

Branch: refs/heads/HDFS-8707
Commit: fac65021d95bf482f57fe83bca9af36c2fb6f641
Parents: 2a98ab5
Author: Haohui Mai <wh...@apache.org>
Authored: Mon Aug 24 18:10:17 2015 -0700
Committer: Haohui Mai <wh...@apache.org>
Committed: Mon Aug 24 18:10:17 2015 -0700

----------------------------------------------------------------------
 .../native/libhdfspp/include/libhdfspp/hdfs.h   | 20 ++++--
 .../native/libhdfspp/include/libhdfspp/status.h |  1 -
 .../main/native/libhdfspp/lib/fs/filesystem.h   | 12 ++--
 .../main/native/libhdfspp/lib/fs/inputstream.cc |  8 ++-
 .../native/libhdfspp/lib/fs/inputstream_impl.h  | 50 ++++++++------
 .../native/libhdfspp/tests/inputstream_test.cc  | 69 +++++++++++++++++---
 6 files changed, 118 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fac65021/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/hdfs.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/hdfs.h b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/hdfs.h
index 59ebd60..edb1ff3 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/hdfs.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/hdfs.h
@@ -21,6 +21,7 @@
 #include "libhdfspp/status.h"
 
 #include <functional>
+#include <set>
 
 namespace hdfs {
 
@@ -57,12 +58,23 @@ public:
 class InputStream {
 public:
   /**
-   * Read data from a specific position. The handler returns the
-   * number of bytes has read.
+   * Read data from a specific position. The current implementation
+   * stops at the block boundary.
+   *
+   * @param buf the pointer to the buffer
+   * @param nbyte the size of the buffer
+   * @param offset the offset the file
+   * @param excluded_datanodes the UUID of the datanodes that should
+   * not be used in this read
+   *
+   * The handler returns the datanode that serves the block and the number of
+   * bytes has read.
    **/
   virtual void
-  PositionRead(void *buf, size_t nbyte, size_t offset,
-               const std::function<void(const Status &, size_t)> &handler) = 0;
+  PositionRead(void *buf, size_t nbyte, uint64_t offset,
+               const std::set<std::string> &excluded_datanodes,
+               const std::function<void(const Status &, const std::string &,
+                                        size_t)> &handler) = 0;
   virtual ~InputStream();
 };
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fac65021/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/status.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/status.h b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/status.h
index d2ef005..fc5ea66 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/status.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/include/libhdfspp/status.h
@@ -66,7 +66,6 @@ class Status {
   //    state_[4]    == code
   //    state_[5..]  == message
   const char* state_;
-  friend class StatusHelper;
 
   enum Code {
     kOk = 0,

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fac65021/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/filesystem.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/filesystem.h b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/filesystem.h
index 4e29a80..0c9dd7a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/filesystem.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/filesystem.h
@@ -46,16 +46,20 @@ class InputStreamImpl : public InputStream {
 public:
   InputStreamImpl(FileSystemImpl *fs,
                   const ::hadoop::hdfs::LocatedBlocksProto *blocks);
-  virtual void PositionRead(
-      void *buf, size_t nbyte, size_t offset,
-      const std::function<void(const Status &, size_t)> &handler) override;
+  virtual void
+  PositionRead(void *buf, size_t nbyte, uint64_t offset,
+               const std::set<std::string> &excluded_datanodes,
+               const std::function<void(const Status &, const std::string &,
+                                        size_t)> &handler) override;
   template <class MutableBufferSequence, class Handler>
   void AsyncPreadSome(size_t offset, const MutableBufferSequence &buffers,
+                      const std::set<std::string> &excluded_datanodes,
                       const Handler &handler);
   template <class BlockReaderTrait, class MutableBufferSequence, class Handler>
   void AsyncReadBlock(const std::string &client_name,
                       const hadoop::hdfs::LocatedBlockProto &block,
-                      size_t offset, const MutableBufferSequence &buffers,
+                      const hadoop::hdfs::DatanodeInfoProto &dn, size_t offset,
+                      const MutableBufferSequence &buffers,
                       const Handler &handler);
 
 private:

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fac65021/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream.cc b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream.cc
index 1b230c6..b47dcb1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream.cc
@@ -37,8 +37,10 @@ InputStreamImpl::InputStreamImpl(FileSystemImpl *fs,
 }
 
 void InputStreamImpl::PositionRead(
-    void *buf, size_t nbyte, size_t offset,
-    const std::function<void(const Status &, size_t)> &handler) {
-  AsyncPreadSome(offset, asio::buffer(buf, nbyte), handler);
+    void *buf, size_t nbyte, uint64_t offset,
+    const std::set<std::string> &excluded_datanodes,
+    const std::function<void(const Status &, const std::string &, size_t)>
+        &handler) {
+  AsyncPreadSome(offset, asio::buffer(buf, nbyte), excluded_datanodes, handler);
 }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fac65021/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h
index 077a15f..ca5ac38 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h
@@ -33,7 +33,7 @@ struct InputStreamImpl::RemoteBlockReaderTrait {
   struct State {
     std::unique_ptr<asio::ip::tcp::socket> conn_;
     std::unique_ptr<Reader> reader_;
-    std::vector<asio::ip::tcp::endpoint> endpoints_;
+    std::array<asio::ip::tcp::endpoint, 1> endpoints_;
     size_t transferred_;
     Reader *reader() { return reader_.get(); }
     size_t *transferred() { return &transferred_; }
@@ -41,17 +41,15 @@ struct InputStreamImpl::RemoteBlockReaderTrait {
   };
   static continuation::Pipeline<State> *
   CreatePipeline(::asio::io_service *io_service,
-                 const ::hadoop::hdfs::LocatedBlockProto &b) {
+                 const ::hadoop::hdfs::DatanodeInfoProto &dn) {
     using namespace ::asio::ip;
     auto m = continuation::Pipeline<State>::Create();
     auto &s = m->state();
     s.conn_.reset(new tcp::socket(*io_service));
     s.reader_.reset(new Reader(BlockReaderOptions(), s.conn_.get()));
-    for (auto &loc : b.locs()) {
-      auto datanode = loc.id();
-      s.endpoints_.push_back(tcp::endpoint(
-          address::from_string(datanode.ipaddr()), datanode.xferport()));
-    }
+    auto datanode = dn.id();
+    s.endpoints_[0] = tcp::endpoint(address::from_string(datanode.ipaddr()),
+                                    datanode.xferport());
 
     m->Push(continuation::Connect(s.conn_.get(), s.endpoints_.begin(),
                                   s.endpoints_.end()));
@@ -125,12 +123,11 @@ private:
 };
 
 template <class MutableBufferSequence, class Handler>
-void InputStreamImpl::AsyncPreadSome(size_t offset,
-                                     const MutableBufferSequence &buffers,
-                                     const Handler &handler) {
+void InputStreamImpl::AsyncPreadSome(
+    size_t offset, const MutableBufferSequence &buffers,
+    const std::set<std::string> &excluded_datanodes, const Handler &handler) {
+  using ::hadoop::hdfs::DatanodeInfoProto;
   using ::hadoop::hdfs::LocatedBlockProto;
-  namespace ip = ::asio::ip;
-  using ::asio::ip::tcp;
 
   auto it = std::find_if(
       blocks_.begin(), blocks_.end(), [offset](const LocatedBlockProto &p) {
@@ -138,10 +135,21 @@ void InputStreamImpl::AsyncPreadSome(size_t offset,
       });
 
   if (it == blocks_.end()) {
-    handler(Status::InvalidArgument("Cannot find corresponding blocks"), 0);
+    handler(Status::InvalidArgument("Cannot find corresponding blocks"), "", 0);
     return;
-  } else if (!it->locs_size()) {
-    handler(Status::ResourceUnavailable("No datanodes available"), 0);
+  }
+
+  const DatanodeInfoProto *chosen_dn = nullptr;
+  for (int i = 0; i < it->locs_size(); ++i) {
+    const auto &di = it->locs(i);
+    if (!excluded_datanodes.count(di.id().datanodeuuid())) {
+      chosen_dn = &di;
+      break;
+    }
+  }
+
+  if (!chosen_dn) {
+    handler(Status::ResourceUnavailable("No datanodes available"), "", 0);
     return;
   }
 
@@ -150,28 +158,30 @@ void InputStreamImpl::AsyncPreadSome(size_t offset,
       it->b().numbytes() - offset_within_block, asio::buffer_size(buffers));
 
   AsyncReadBlock<RemoteBlockReaderTrait>(
-      fs_->rpc_engine().client_name(), *it, offset_within_block,
+      fs_->rpc_engine().client_name(), *it, *chosen_dn, offset_within_block,
       asio::buffer(buffers, size_within_block), handler);
 }
 
 template <class BlockReaderTrait, class MutableBufferSequence, class Handler>
 void InputStreamImpl::AsyncReadBlock(
     const std::string &client_name,
-    const hadoop::hdfs::LocatedBlockProto &block, size_t offset,
+    const hadoop::hdfs::LocatedBlockProto &block,
+    const hadoop::hdfs::DatanodeInfoProto &dn, size_t offset,
     const MutableBufferSequence &buffers, const Handler &handler) {
 
   typedef typename BlockReaderTrait::Reader Reader;
   auto m =
-      BlockReaderTrait::CreatePipeline(&fs_->rpc_engine().io_service(), block);
+      BlockReaderTrait::CreatePipeline(&fs_->rpc_engine().io_service(), dn);
   auto &s = m->state();
   size_t size = asio::buffer_size(buffers);
   m->Push(new HandshakeContinuation<Reader>(s.reader(), client_name, nullptr,
                                             &block.b(), size, offset))
       .Push(new ReadBlockContinuation<Reader, decltype(buffers)>(
           s.reader(), buffers, s.transferred()));
-  m->Run([handler](const Status &status,
+  const std::string &dnid = dn.id().datanodeuuid();
+  m->Run([handler, dnid](const Status &status,
                    const typename BlockReaderTrait::State &state) {
-           handler(status, *state.transferred());
+           handler(status, dnid, *state.transferred());
   });
 }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fac65021/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/inputstream_test.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/inputstream_test.cc b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/inputstream_test.cc
index 96aa38a..6d87823 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/inputstream_test.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/inputstream_test.cc
@@ -20,6 +20,8 @@
 #include <gmock/gmock.h>
 
 using hadoop::common::TokenProto;
+using hadoop::hdfs::DatanodeInfoProto;
+using hadoop::hdfs::DatanodeIDProto;
 using hadoop::hdfs::ExtendedBlockProto;
 using hadoop::hdfs::LocatedBlockProto;
 using hadoop::hdfs::LocatedBlocksProto;
@@ -57,7 +59,7 @@ template <class Trait> struct MockBlockReaderTrait {
   };
 
   static continuation::Pipeline<State> *
-  CreatePipeline(::asio::io_service *, const LocatedBlockProto &) {
+  CreatePipeline(::asio::io_service *, const DatanodeInfoProto &) {
     auto m = continuation::Pipeline<State>::Create();
     *m->state().transferred() = 0;
     Trait::InitializeMockReader(m->state().reader());
@@ -69,6 +71,7 @@ template <class Trait> struct MockBlockReaderTrait {
 TEST(InputStreamTest, TestReadSingleTrunk) {
   LocatedBlocksProto blocks;
   LocatedBlockProto block;
+  DatanodeInfoProto dn;
   char buf[4096] = {
       0,
   };
@@ -82,14 +85,14 @@ TEST(InputStreamTest, TestReadSingleTrunk) {
       EXPECT_CALL(*reader, async_connect(_, _, _, _, _, _))
           .WillOnce(InvokeArgument<5>(Status::OK()));
 
-      EXPECT_CALL(*reader, async_read_some(_,_))
+      EXPECT_CALL(*reader, async_read_some(_, _))
           .WillOnce(InvokeArgument<1>(Status::OK(), sizeof(buf)));
     }
   };
 
   is.AsyncReadBlock<MockBlockReaderTrait<Trait>>(
-      "client", block, 0, asio::buffer(buf, sizeof(buf)),
-      [&stat, &read](const Status &status, size_t transferred) {
+      "client", block, dn, 0, asio::buffer(buf, sizeof(buf)),
+      [&stat, &read](const Status &status, const std::string &, size_t transferred) {
         stat = status;
         read = transferred;
       });
@@ -101,6 +104,7 @@ TEST(InputStreamTest, TestReadSingleTrunk) {
 TEST(InputStreamTest, TestReadMultipleTrunk) {
   LocatedBlocksProto blocks;
   LocatedBlockProto block;
+  DatanodeInfoProto dn;
   char buf[4096] = {
       0,
   };
@@ -114,15 +118,16 @@ TEST(InputStreamTest, TestReadMultipleTrunk) {
       EXPECT_CALL(*reader, async_connect(_, _, _, _, _, _))
           .WillOnce(InvokeArgument<5>(Status::OK()));
 
-      EXPECT_CALL(*reader, async_read_some(_,_))
+      EXPECT_CALL(*reader, async_read_some(_, _))
           .Times(4)
           .WillRepeatedly(InvokeArgument<1>(Status::OK(), sizeof(buf) / 4));
     }
   };
 
   is.AsyncReadBlock<MockBlockReaderTrait<Trait>>(
-      "client", block, 0, asio::buffer(buf, sizeof(buf)),
-      [&stat, &read](const Status &status, size_t transferred) {
+      "client", block, dn, 0, asio::buffer(buf, sizeof(buf)),
+      [&stat, &read](const Status &status, const std::string &,
+                     size_t transferred) {
         stat = status;
         read = transferred;
       });
@@ -134,6 +139,7 @@ TEST(InputStreamTest, TestReadMultipleTrunk) {
 TEST(InputStreamTest, TestReadError) {
   LocatedBlocksProto blocks;
   LocatedBlockProto block;
+  DatanodeInfoProto dn;
   char buf[4096] = {
       0,
   };
@@ -147,7 +153,7 @@ TEST(InputStreamTest, TestReadError) {
       EXPECT_CALL(*reader, async_connect(_, _, _, _, _, _))
           .WillOnce(InvokeArgument<5>(Status::OK()));
 
-      EXPECT_CALL(*reader, async_read_some(_,_))
+      EXPECT_CALL(*reader, async_read_some(_, _))
           .WillOnce(InvokeArgument<1>(Status::OK(), sizeof(buf) / 4))
           .WillOnce(InvokeArgument<1>(Status::OK(), sizeof(buf) / 4))
           .WillOnce(InvokeArgument<1>(Status::OK(), sizeof(buf) / 4))
@@ -156,8 +162,9 @@ TEST(InputStreamTest, TestReadError) {
   };
 
   is.AsyncReadBlock<MockBlockReaderTrait<Trait>>(
-      "client", block, 0, asio::buffer(buf, sizeof(buf)),
-      [&stat, &read](const Status &status, size_t transferred) {
+      "client", block, dn, 0, asio::buffer(buf, sizeof(buf)),
+      [&stat, &read](const Status &status, const std::string &,
+                     size_t transferred) {
         stat = status;
         read = transferred;
       });
@@ -166,6 +173,48 @@ TEST(InputStreamTest, TestReadError) {
   read = 0;
 }
 
+TEST(InputStreamTest, TestExcludeDataNode) {
+  LocatedBlocksProto blocks;
+  LocatedBlockProto *block = blocks.add_blocks();
+  ExtendedBlockProto *b = block->mutable_b();
+  b->set_poolid("");
+  b->set_blockid(1);
+  b->set_generationstamp(1);
+  b->set_numbytes(4096);
+
+  DatanodeInfoProto *di = block->add_locs();
+  DatanodeIDProto *dnid = di->mutable_id();
+  dnid->set_datanodeuuid("foo");
+
+  char buf[4096] = {
+      0,
+  };
+  IoServiceImpl io_service;
+  FileSystemImpl fs(&io_service);
+  InputStreamImpl is(&fs, &blocks);
+  Status stat;
+  size_t read = 0;
+  struct Trait {
+    static void InitializeMockReader(MockReader *reader) {
+      EXPECT_CALL(*reader, async_connect(_, _, _, _, _, _))
+          .WillOnce(InvokeArgument<5>(Status::OK()));
+
+      EXPECT_CALL(*reader, async_read_some(_, _))
+          .WillOnce(InvokeArgument<1>(Status::OK(), sizeof(buf)));
+    }
+  };
+
+
+  std::set<std::string> excluded_dn({"foo"});
+  is.AsyncPreadSome(0, asio::buffer(buf, sizeof(buf)), excluded_dn,
+      [&stat, &read](const Status &status, const std::string &, size_t transferred) {
+        stat = status;
+        read = transferred;
+      });
+  ASSERT_EQ(static_cast<int>(std::errc::resource_unavailable_try_again), stat.code());
+  ASSERT_EQ(0UL, read);
+}
+
 int main(int argc, char *argv[]) {
   // The following line must be executed to initialize Google Mock
   // (and Google Test) before running the tests.


[2/2] hadoop git commit: HDFS-9025. Fix compilation issues on arch linux. Contributed by Owen O'Malley.

Posted by wh...@apache.org.
HDFS-9025. Fix compilation issues on arch linux. Contributed by Owen O'Malley.


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

Branch: refs/heads/HDFS-8707
Commit: 24abbead5d605fe5b93605b4e743b00c867c9025
Parents: fac6502
Author: Haohui Mai <wh...@apache.org>
Authored: Fri Sep 11 13:45:51 2015 -0700
Committer: Haohui Mai <wh...@apache.org>
Committed: Fri Sep 11 13:45:51 2015 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs-client/pom.xml            | 10 ++++++++++
 .../src/main/native/libhdfspp/lib/proto/CMakeLists.txt    |  4 ++--
 .../main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc    |  2 ++
 .../src/main/native/libhdfspp/tests/CMakeLists.txt        |  6 +++---
 4 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/24abbead/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml b/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml
index 9f7070e..7c41601 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml
@@ -124,6 +124,16 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
             <artifactId>maven-antrun-plugin</artifactId>
             <executions>
               <execution>
+                <id>debug</id>
+                <phase>compile</phase>
+                <goals><goal>run</goal></goals>
+                <configuration>
+                  <target>
+                    <echo>[PROTOC] ${env.HADOOP_PROTOC_PATH}</echo>
+                  </target>
+                </configuration>
+              </execution>
+              <execution>
                 <id>make</id>
                 <phase>compile</phase>
                 <goals><goal>run</goal></goals>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/24abbead/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt
index 3f703b2..4b0bac6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt
@@ -1,5 +1,5 @@
-set(CLIENT_PROTO_DIR ${CMAKE_SOURCE_DIR}/../proto)
-set(COMMON_PROTO_DIR ${CMAKE_SOURCE_DIR}/../../../../../hadoop-common-project/hadoop-common/src/main/proto)
+set(CLIENT_PROTO_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../proto)
+set(COMMON_PROTO_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../../../../hadoop-common-project/hadoop-common/src/main/proto)
 set(PROTOBUF_IMPORT_DIRS ${CLIENT_PROTO_DIR} ${COMMON_PROTO_DIR})
 
 protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS

http://git-wip-us.apache.org/repos/asf/hadoop/blob/24abbead/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc
index e4b5acc..d8e9ab2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc
@@ -25,6 +25,8 @@
 #include <google/protobuf/io/zero_copy_stream.h>
 #include <google/protobuf/stubs/common.h>
 
+#include <memory>
+
 using ::google::protobuf::FileDescriptor;
 using ::google::protobuf::MethodDescriptor;
 using ::google::protobuf::ServiceDescriptor;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/24abbead/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/CMakeLists.txt
index 4c622f2..df57d04 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/CMakeLists.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/tests/CMakeLists.txt
@@ -19,13 +19,13 @@
 add_library(test_common OBJECT mock_connection.cc)
 
 add_executable(remote_block_reader_test remote_block_reader_test.cc $<TARGET_OBJECTS:test_common>)
-target_link_libraries(remote_block_reader_test reader proto common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} gmock_main)
+target_link_libraries(remote_block_reader_test reader proto common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
 add_test(remote_block_reader remote_block_reader_test)
 
 add_executable(sasl_digest_md5_test sasl_digest_md5_test.cc)
-target_link_libraries(sasl_digest_md5_test common ${OPENSSL_LIBRARIES} gmock_main)
+target_link_libraries(sasl_digest_md5_test common ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
 add_test(sasl_digest_md5 sasl_digest_md5_test)
 
 add_executable(inputstream_test inputstream_test.cc)
-target_link_libraries(inputstream_test fs rpc reader proto common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} gmock_main)
+target_link_libraries(inputstream_test fs rpc reader proto common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
 add_test(inputstream inputstream_test)