hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject [55/56] [abbrv] hadoop git commit: HDFS-9108. InputStreamImpl::ReadBlockContinuation stores wrong pointers of buffers. Contributed by Haohui Mai.
Date Wed, 07 Oct 2015 07:20:21 GMT
HDFS-9108. InputStreamImpl::ReadBlockContinuation stores wrong pointers of buffers. 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/89156eb5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/89156eb5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/89156eb5

Branch: refs/heads/HDFS-8707
Commit: 89156eb57a8525f912bedf9d5452767d990bc16b
Parents: 3bdf6e4
Author: Haohui Mai <wheat9@apache.org>
Authored: Mon Sep 21 16:13:53 2015 -0700
Committer: Haohui Mai <wheat9@apache.org>
Committed: Wed Oct 7 00:17:14 2015 -0700

----------------------------------------------------------------------
 .../main/native/libhdfspp/lib/fs/inputstream_impl.h   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/89156eb5/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 ca5ac38..2044f3f 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
@@ -25,6 +25,7 @@
 
 #include <functional>
 #include <future>
+#include <type_traits>
 
 namespace hdfs {
 
@@ -91,7 +92,10 @@ struct InputStreamImpl::ReadBlockContinuation : continuation::Continuation
{
   ReadBlockContinuation(Reader *reader, MutableBufferSequence buffer,
                         size_t *transferred)
       : reader_(reader), buffer_(buffer),
-        buffer_size_(asio::buffer_size(buffer)), transferred_(transferred) {}
+        buffer_size_(asio::buffer_size(buffer)), transferred_(transferred) {
+    static_assert(!std::is_reference<MutableBufferSequence>::value,
+                  "Buffer must not be a reference type");
+  }
 
   virtual void Run(const Next &next) override {
     *transferred_ = 0;
@@ -101,7 +105,7 @@ struct InputStreamImpl::ReadBlockContinuation : continuation::Continuation
{
 
 private:
   Reader *reader_;
-  MutableBufferSequence buffer_;
+  const MutableBufferSequence buffer_;
   const size_t buffer_size_;
   size_t *transferred_;
   std::function<void(const Status &)> next_;
@@ -176,12 +180,12 @@ void InputStreamImpl::AsyncReadBlock(
   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)>(
+      .Push(new ReadBlockContinuation<Reader, MutableBufferSequence>(
           s.reader(), buffers, s.transferred()));
   const std::string &dnid = dn.id().datanodeuuid();
   m->Run([handler, dnid](const Status &status,
-                   const typename BlockReaderTrait::State &state) {
-           handler(status, dnid, *state.transferred());
+                         const typename BlockReaderTrait::State &state) {
+    handler(status, dnid, *state.transferred());
   });
 }
 }


Mime
View raw message