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 03f83f451aa..fccfb090530 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 > 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); 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 47618a6eaeb..efaf407db7b 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 #include #include +#include #include #include @@ -234,10 +235,10 @@ class RpcConnection : public std::enable_shared_from_this { // The request being sent over the wire; will also be in requests_on_fly_ std::shared_ptr request_over_the_wire_; // Requests to be sent over the wire - std::vector> pending_requests_; + std::deque> pending_requests_; // Requests to be sent over the wire during authentication; not retried if // there is a connection error - std::vector> auth_requests_; + std::deque> auth_requests_; // Requests that are waiting for responses typedef std::unordered_map> RequestOnFlyMap; RequestOnFlyMap requests_on_fly_;