HDFS-10739: libhdfs++: In RpcEngine replace vector with deque for pending requests. Contributed by Anatoli Shein.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b1ed72e0 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b1ed72e0 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b1ed72e0 Branch: refs/heads/trunk Commit: b1ed72e098069efce4df5d20cd53613fdfc38842 Parents: 649aff1 Author: James <[email protected]> Authored: Tue Aug 9 15:55:18 2016 -0400 Committer: James Clampffer <[email protected]> Committed: Thu Mar 22 17:19:47 2018 -0400 ---------------------------------------------------------------------- .../src/main/native/libhdfspp/lib/rpc/rpc_connection.cc | 1 - .../src/main/native/libhdfspp/lib/rpc/rpc_engine.h | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/b1ed72e0/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc index 03f83f4..fccfb09 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc @@ -445,7 +445,6 @@ void RpcConnection::SendRpcRequests(const std::vector<std::shared_ptr<Request> > Status status = Status::ResourceUnavailable("RpcConnection closed before send."); engine_->AsyncRpcCommsError(status, shared_from_this(), requests); } else { - pending_requests_.reserve(pending_requests_.size() + requests.size()); for (auto r: requests) { if (r->method_name() != SASL_METHOD_NAME) pending_requests_.push_back(r); http://git-wip-us.apache.org/repos/asf/hadoop/blob/b1ed72e0/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.h index 47618a6..efaf407 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.h @@ -41,6 +41,7 @@ #include <memory> #include <unordered_map> #include <vector> +#include <deque> #include <mutex> #include <future> @@ -234,10 +235,10 @@ class RpcConnection : public std::enable_shared_from_this<RpcConnection> { // The request being sent over the wire; will also be in requests_on_fly_ std::shared_ptr<Request> request_over_the_wire_; // Requests to be sent over the wire - std::vector<std::shared_ptr<Request>> pending_requests_; + std::deque<std::shared_ptr<Request>> pending_requests_; // Requests to be sent over the wire during authentication; not retried if // there is a connection error - std::vector<std::shared_ptr<Request>> auth_requests_; + std::deque<std::shared_ptr<Request>> auth_requests_; // Requests that are waiting for responses typedef std::unordered_map<int, std::shared_ptr<Request>> RequestOnFlyMap; RequestOnFlyMap requests_on_fly_; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
