hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject hadoop git commit: Revert HDFS-10543 patch due to correctness issues it caused. Done by James Clampffer
Date Wed, 27 Jul 2016 21:02:48 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-8707 d18e39685 -> ba6f2fe33


Revert HDFS-10543 patch due to correctness issues it caused.  Done by James Clampffer


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

Branch: refs/heads/HDFS-8707
Commit: ba6f2fe339ef942e410a86deeb46444bb512f693
Parents: d18e396
Author: James <jhc@apache.org>
Authored: Wed Jul 27 17:02:11 2016 -0400
Committer: James <jhc@apache.org>
Committed: Wed Jul 27 17:02:11 2016 -0400

----------------------------------------------------------------------
 .../main/native/libhdfspp/lib/fs/filehandle.cc  | 38 ++++++++------------
 1 file changed, 15 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba6f2fe3/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc
index df147d3..40f1b4a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc
@@ -78,34 +78,26 @@ Status FileHandleImpl::PositionRead(void *buf, size_t *nbyte, off_t offset)
{
   LOG_TRACE(kFileHandle, << "FileHandleImpl::[sync]PositionRead("
                          << FMT_THIS_ADDR << ", buf=" << buf
                          << ", nbyte=" << *nbyte << ") called");
-  size_t totalBytesRead = 0;
-  Status stat = Status::OK();
-  while (*nbyte != 0 && offset < (off_t)(file_info_->file_length_)) {
-    auto callstate = std::make_shared<std::promise<std::tuple<Status, size_t>>>();
-    std::future<std::tuple<Status, size_t>> future(callstate->get_future());
 
-    /* wrap async call with promise/future to make it blocking */
-    auto callback = [callstate](const Status &s, size_t bytes) {
-      callstate->set_value(std::make_tuple(s,bytes));
-    };
+  auto callstate = std::make_shared<std::promise<std::tuple<Status, size_t>>>();
+  std::future<std::tuple<Status, size_t>> future(callstate->get_future());
 
-    PositionRead(buf, *nbyte, offset, callback);
+  /* wrap async call with promise/future to make it blocking */
+  auto callback = [callstate](const Status &s, size_t bytes) {
+    callstate->set_value(std::make_tuple(s,bytes));
+  };
 
-    /* wait for async to finish */
-    auto returnstate = future.get();
-    stat = std::get<0>(returnstate);
+  PositionRead(buf, *nbyte, offset, callback);
 
-    if (!stat.ok()) {
-      return stat;
-    }
+  /* wait for async to finish */
+  auto returnstate = future.get();
+  auto stat = std::get<0>(returnstate);
 
-    size_t bytesRead = std::get<1>(returnstate);
-    *nbyte = *nbyte - bytesRead;
-    totalBytesRead += bytesRead;
-    offset += bytesRead;
+  if (!stat.ok()) {
+    return stat;
   }
-  /* Update the bytes read for return */
-  *nbyte = totalBytesRead;
+
+  *nbyte = std::get<1>(returnstate);
   return stat;
 }
 
@@ -118,8 +110,8 @@ Status FileHandleImpl::Read(void *buf, size_t *nbyte) {
   if(!stat.ok()) {
     return stat;
   }
-  offset_ += *nbyte;
 
+  offset_ += *nbyte;
   return Status::OK();
 }
 


---------------------------------------------------------------------
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