kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [kudu] 03/03: rpc: replace gscoped_ptr with unique_ptr
Date Fri, 10 Jan 2020 22:46:22 GMT
This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 9c7d955c828be6eb4d4a2bf9c1e648be8590377b
Author: Adar Dembo <adar@cloudera.com>
AuthorDate: Thu Jan 9 17:19:04 2020 -0800

    rpc: replace gscoped_ptr with unique_ptr
    
    And a few other bits of modernization.
    
    Change-Id: I509e5cce6ae2c8351cea2fc68c7377d871ea40d5
    Reviewed-on: http://gerrit.cloudera.org:8080/15006
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
---
 src/kudu/master/master.cc         | 18 ++++++++----------
 src/kudu/rpc/acceptor_pool.h      |  7 ++-----
 src/kudu/rpc/blocking_ops.h       |  6 +-----
 src/kudu/rpc/connection.cc        | 26 +++++++++++++-------------
 src/kudu/rpc/connection.h         | 17 ++++++-----------
 src/kudu/rpc/constants.h          |  6 +-----
 src/kudu/rpc/inbound_call.cc      |  4 ++--
 src/kudu/rpc/inbound_call.h       | 10 +++-------
 src/kudu/rpc/messenger.cc         |  5 ++---
 src/kudu/rpc/messenger.h          |  3 +--
 src/kudu/rpc/mt-rpc-test.cc       | 10 ++++------
 src/kudu/rpc/negotiation.h        |  4 +---
 src/kudu/rpc/outbound_call.cc     |  8 ++++----
 src/kudu/rpc/outbound_call.h      | 14 +++++---------
 src/kudu/rpc/proxy.h              |  6 +-----
 src/kudu/rpc/reactor.h            |  5 +----
 src/kudu/rpc/remote_method.h      |  5 +----
 src/kudu/rpc/response_callback.h  | 10 +++-------
 src/kudu/rpc/rpc-test-base.h      |  6 ++----
 src/kudu/rpc/rpc_context.h        |  9 +++------
 src/kudu/rpc/rpc_controller.cc    |  1 -
 src/kudu/rpc/rpc_controller.h     |  4 +---
 src/kudu/rpc/rpc_service.h        | 11 +++++------
 src/kudu/rpc/rpc_sidecar.h        |  6 +-----
 src/kudu/rpc/rpc_stub-test.cc     | 12 ++++--------
 src/kudu/rpc/sasl_common.h        |  8 ++------
 src/kudu/rpc/sasl_helper.h        |  6 +-----
 src/kudu/rpc/serialization.h      |  5 +----
 src/kudu/rpc/service_if.h         |  4 +---
 src/kudu/rpc/service_pool.cc      |  8 +++-----
 src/kudu/rpc/service_pool.h       | 14 +++++---------
 src/kudu/rpc/service_queue.h      |  5 +----
 src/kudu/rpc/transfer.h           |  5 +----
 src/kudu/server/rpc_server.cc     |  8 ++++----
 src/kudu/server/rpc_server.h      |  3 +--
 src/kudu/server/server_base.cc    |  7 +++----
 src/kudu/server/server_base.h     | 15 +++++++--------
 src/kudu/tserver/tablet_server.cc | 15 ++++++++-------
 38 files changed, 113 insertions(+), 203 deletions(-)

diff --git a/src/kudu/master/master.cc b/src/kudu/master/master.cc
index 8602a07..6594c96 100644
--- a/src/kudu/master/master.cc
+++ b/src/kudu/master/master.cc
@@ -21,7 +21,6 @@
 #include <memory>
 #include <ostream>
 #include <string>
-#include <type_traits>
 #include <vector>
 
 #include <gflags/gflags.h>
@@ -37,7 +36,6 @@
 #include "kudu/fs/fs_manager.h"
 #include "kudu/gutil/bind.h"
 #include "kudu/gutil/bind_helpers.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/master/catalog_manager.h"
@@ -96,17 +94,17 @@ DEFINE_string(location_mapping_cmd, "",
               "using location awareness features this flag should not be set.");
 
 
-using std::min;
-using std::shared_ptr;
-using std::string;
-using std::vector;
-
 using kudu::consensus::RaftPeerPB;
 using kudu::fs::ErrorHandlerType;
 using kudu::rpc::ServiceIf;
 using kudu::security::TokenSigner;
 using kudu::tserver::ConsensusServiceImpl;
 using kudu::tserver::TabletCopyServiceImpl;
+using std::min;
+using std::shared_ptr;
+using std::string;
+using std::unique_ptr;
+using std::vector;
 using strings::Substitute;
 
 namespace kudu {
@@ -178,10 +176,10 @@ Status Master::StartAsync() {
 
   RETURN_NOT_OK(maintenance_manager_->Start());
 
-  gscoped_ptr<ServiceIf> impl(new MasterServiceImpl(this));
-  gscoped_ptr<ServiceIf> consensus_service(
+  unique_ptr<ServiceIf> impl(new MasterServiceImpl(this));
+  unique_ptr<ServiceIf> consensus_service(
       new ConsensusServiceImpl(this, catalog_manager_.get()));
-  gscoped_ptr<ServiceIf> tablet_copy_service(
+  unique_ptr<ServiceIf> tablet_copy_service(
       new TabletCopyServiceImpl(this, catalog_manager_.get()));
 
   RETURN_NOT_OK(RegisterService(std::move(impl)));
diff --git a/src/kudu/rpc/acceptor_pool.h b/src/kudu/rpc/acceptor_pool.h
index ba1996a..6e5ae35 100644
--- a/src/kudu/rpc/acceptor_pool.h
+++ b/src/kudu/rpc/acceptor_pool.h
@@ -14,11 +14,9 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+#pragma once
 
-#ifndef KUDU_RPC_ACCEPTOR_POOL_H
-#define KUDU_RPC_ACCEPTOR_POOL_H
-
-#include <stdint.h>
+#include <cstdint>
 #include <vector>
 
 #include "kudu/gutil/atomicops.h"
@@ -81,4 +79,3 @@ class AcceptorPool {
 
 } // namespace rpc
 } // namespace kudu
-#endif
diff --git a/src/kudu/rpc/blocking_ops.h b/src/kudu/rpc/blocking_ops.h
index b305ba7..7dc5a35 100644
--- a/src/kudu/rpc/blocking_ops.h
+++ b/src/kudu/rpc/blocking_ops.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_BLOCKING_OPS_H
-#define KUDU_RPC_BLOCKING_OPS_H
+#pragma once
 
 namespace google {
 namespace protobuf {
@@ -54,5 +52,3 @@ Status ReceiveFramedMessageBlocking(Socket* sock, faststring* recv_buf,
 
 } // namespace rpc
 } // namespace kudu
-
-#endif  // KUDU_RPC_BLOCKING_OPS_H
diff --git a/src/kudu/rpc/connection.cc b/src/kudu/rpc/connection.cc
index 2b79464..a15d482 100644
--- a/src/kudu/rpc/connection.cc
+++ b/src/kudu/rpc/connection.cc
@@ -26,13 +26,13 @@
 #include <memory>
 #include <set>
 #include <string>
-#include <type_traits>
 
 #include <boost/intrusive/detail/list_iterator.hpp>
 #include <boost/intrusive/list.hpp>
 #include <ev.h>
 #include <glog/logging.h>
 
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/strings/human_readable.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -329,7 +329,7 @@ void Connection::Shutdown(const Status &status,
   }
 }
 
-void Connection::QueueOutbound(gscoped_ptr<OutboundTransfer> transfer) {
+void Connection::QueueOutbound(unique_ptr<OutboundTransfer> transfer) {
   DCHECK(reactor_thread_->IsCurrentThread());
 
   if (!shutdown_status_.ok()) {
@@ -532,7 +532,7 @@ void Connection::QueueOutboundCall(shared_ptr<OutboundCall> call)
{
 
   TransferCallbacks *cb = new CallTransferCallbacks(std::move(call), this);
   awaiting_response_[call_id] = car.release();
-  QueueOutbound(gscoped_ptr<OutboundTransfer>(
+  QueueOutbound(unique_ptr<OutboundTransfer>(
       OutboundTransfer::CreateForCallRequest(call_id, tmp_slices, n_slices, cb)));
 }
 
@@ -541,7 +541,7 @@ void Connection::QueueOutboundCall(shared_ptr<OutboundCall> call)
{
 // been responded to, we can free up all of the associated memory.
 struct ResponseTransferCallbacks : public TransferCallbacks {
  public:
-  ResponseTransferCallbacks(gscoped_ptr<InboundCall> call,
+  ResponseTransferCallbacks(unique_ptr<InboundCall> call,
                             Connection *conn) :
     call_(std::move(call)),
     conn_(conn)
@@ -565,14 +565,14 @@ struct ResponseTransferCallbacks : public TransferCallbacks {
   }
 
  private:
-  gscoped_ptr<InboundCall> call_;
+  unique_ptr<InboundCall> call_;
   Connection *conn_;
 };
 
 // Reactor task which puts a transfer on the outbound transfer queue.
 class QueueTransferTask : public ReactorTask {
  public:
-  QueueTransferTask(gscoped_ptr<OutboundTransfer> transfer,
+  QueueTransferTask(unique_ptr<OutboundTransfer> transfer,
                     Connection *conn)
     : transfer_(std::move(transfer)),
       conn_(conn)
@@ -589,11 +589,11 @@ class QueueTransferTask : public ReactorTask {
   }
 
  private:
-  gscoped_ptr<OutboundTransfer> transfer_;
+  unique_ptr<OutboundTransfer> transfer_;
   Connection *conn_;
 };
 
-void Connection::QueueResponseForCall(gscoped_ptr<InboundCall> call) {
+void Connection::QueueResponseForCall(unique_ptr<InboundCall> call) {
   // This is usually called by the IPC worker thread when the response
   // is set, but in some circumstances may also be called by the
   // reactor thread (e.g. if the service has shut down)
@@ -611,7 +611,7 @@ void Connection::QueueResponseForCall(gscoped_ptr<InboundCall> call)
{
   // After the response is sent, can delete the InboundCall object.
   // We set a dummy call ID and required feature set, since these are not needed
   // when sending responses.
-  gscoped_ptr<OutboundTransfer> t(
+  unique_ptr<OutboundTransfer> t(
       OutboundTransfer::CreateForCallResponse(tmp_slices, n_slices, cb));
 
   QueueTransferTask *task = new QueueTransferTask(std::move(t), this);
@@ -682,10 +682,10 @@ void Connection::ReadHandler(ev::io &watcher, int revents) {
   }
 }
 
-void Connection::HandleIncomingCall(gscoped_ptr<InboundTransfer> transfer) {
+void Connection::HandleIncomingCall(unique_ptr<InboundTransfer> transfer) {
   DCHECK(reactor_thread_->IsCurrentThread());
 
-  gscoped_ptr<InboundCall> call(new InboundCall(this));
+  unique_ptr<InboundCall> call(new InboundCall(this));
   Status s = call->ParseFrom(std::move(transfer));
   if (!s.ok()) {
     LOG(WARNING) << ToString() << ": received bad data: " << s.ToString();
@@ -706,9 +706,9 @@ void Connection::HandleIncomingCall(gscoped_ptr<InboundTransfer>
transfer) {
   reactor_thread_->reactor()->messenger()->QueueInboundCall(std::move(call));
 }
 
-void Connection::HandleCallResponse(gscoped_ptr<InboundTransfer> transfer) {
+void Connection::HandleCallResponse(unique_ptr<InboundTransfer> transfer) {
   DCHECK(reactor_thread_->IsCurrentThread());
-  gscoped_ptr<CallResponse> resp(new CallResponse);
+  unique_ptr<CallResponse> resp(new CallResponse);
   CHECK_OK(resp->ParseFrom(std::move(transfer)));
 
   CallAwaitingResponse *car_ptr =
diff --git a/src/kudu/rpc/connection.h b/src/kudu/rpc/connection.h
index 8f80b5a..ab3b029 100644
--- a/src/kudu/rpc/connection.h
+++ b/src/kudu/rpc/connection.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_CONNECTION_H
-#define KUDU_RPC_CONNECTION_H
+#pragma once
 
 #include <cstddef>
 #include <cstdint>
@@ -32,7 +30,6 @@
 #include <ev++.h>
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/rpc/connection_id.h"
@@ -135,7 +132,7 @@ class Connection : public RefCountedThreadSafe<Connection> {
   // Queue a call response back to the client on the server side.
   //
   // This may be called from a non-reactor thread.
-  void QueueResponseForCall(gscoped_ptr<InboundCall> call);
+  void QueueResponseForCall(std::unique_ptr<InboundCall> call);
 
   // Cancel an outbound call by removing any reference to it by CallAwaitingResponse
   // in 'awaiting_responses_'.
@@ -286,12 +283,12 @@ class Connection : public RefCountedThreadSafe<Connection> {
 
   // An incoming packet has completed transferring on the server side.
   // This parses the call and delivers it into the call queue.
-  void HandleIncomingCall(gscoped_ptr<InboundTransfer> transfer);
+  void HandleIncomingCall(std::unique_ptr<InboundTransfer> transfer);
 
   // An incoming packet has completed on the client side. This parses the
   // call response, looks up the CallAwaitingResponse, and calls the
   // client callback.
-  void HandleCallResponse(gscoped_ptr<InboundTransfer> transfer);
+  void HandleCallResponse(std::unique_ptr<InboundTransfer> transfer);
 
   // The given CallAwaitingResponse has elapsed its user-defined timeout.
   // Set it to Failed.
@@ -300,7 +297,7 @@ class Connection : public RefCountedThreadSafe<Connection> {
   // Queue a transfer for sending on this connection.
   // We will take ownership of the transfer.
   // This must be called from the reactor thread.
-  void QueueOutbound(gscoped_ptr<OutboundTransfer> transfer);
+  void QueueOutbound(std::unique_ptr<OutboundTransfer> transfer);
 
   // Internal test function for injecting cancellation request when 'call'
   // reaches state specified in 'FLAGS_rpc_inject_cancellation_state'.
@@ -331,7 +328,7 @@ class Connection : public RefCountedThreadSafe<Connection> {
   MonoTime last_activity_time_;
 
   // the inbound transfer, if any
-  gscoped_ptr<InboundTransfer> inbound_;
+  std::unique_ptr<InboundTransfer> inbound_;
 
   // notifies us when our socket is writable.
   ev::io write_io_;
@@ -397,5 +394,3 @@ class Connection : public RefCountedThreadSafe<Connection> {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/constants.h b/src/kudu/rpc/constants.h
index a3c7c67..184fc7b 100644
--- a/src/kudu/rpc/constants.h
+++ b/src/kudu/rpc/constants.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_RPC_CONSTANTS_H
-#define KUDU_RPC_RPC_CONSTANTS_H
+#pragma once
 
 #include <cstdint>
 #include <set>
@@ -56,5 +54,3 @@ extern std::set<RpcFeatureFlag> kSupportedClientRpcFeatureFlags;
 
 } // namespace rpc
 } // namespace kudu
-
-#endif // KUDU_RPC_RPC_CONSTANTS_H
diff --git a/src/kudu/rpc/inbound_call.cc b/src/kudu/rpc/inbound_call.cc
index e6c33e6..7479020 100644
--- a/src/kudu/rpc/inbound_call.cc
+++ b/src/kudu/rpc/inbound_call.cc
@@ -66,7 +66,7 @@ InboundCall::InboundCall(Connection* conn)
 
 InboundCall::~InboundCall() {}
 
-Status InboundCall::ParseFrom(gscoped_ptr<InboundTransfer> transfer) {
+Status InboundCall::ParseFrom(unique_ptr<InboundTransfer> transfer) {
   TRACE_EVENT_FLOW_BEGIN0("rpc", "InboundCall", this);
   TRACE_EVENT0("rpc", "InboundCall::ParseFrom");
   RETURN_NOT_OK(serialization::ParseMessage(transfer->data(), &header_, &serialized_request_));
@@ -162,7 +162,7 @@ void InboundCall::Respond(const MessageLite& response,
   TRACE_TO(trace_, "Queueing $0 response", is_success ? "success" : "failure");
   RecordHandlingCompleted();
   conn_->rpcz_store()->AddCall(this);
-  conn_->QueueResponseForCall(gscoped_ptr<InboundCall>(this));
+  conn_->QueueResponseForCall(unique_ptr<InboundCall>(this));
 }
 
 void InboundCall::SerializeResponseBuffer(const MessageLite& response,
diff --git a/src/kudu/rpc/inbound_call.h b/src/kudu/rpc/inbound_call.h
index 2edab8b..892b893 100644
--- a/src/kudu/rpc/inbound_call.h
+++ b/src/kudu/rpc/inbound_call.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_INBOUND_CALL_H
-#define KUDU_RPC_INBOUND_CALL_H
+#pragma once
 
 #include <cstddef>
 #include <cstdint>
@@ -27,7 +26,6 @@
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/rpc/remote_method.h"
@@ -89,7 +87,7 @@ class InboundCall {
   // 'serialized_request_' member variables. The actual call parameter is
   // not deserialized, as this may be CPU-expensive, and this is called
   // from the reactor thread.
-  Status ParseFrom(gscoped_ptr<InboundTransfer> transfer);
+  Status ParseFrom(std::unique_ptr<InboundTransfer> transfer);
 
   // Return the serialized request parameter protobuf.
   const Slice& serialized_request() const {
@@ -251,7 +249,7 @@ class InboundCall {
   // The transfer that produced the call.
   // This is kept around because it retains the memory referred to
   // by 'serialized_request_' above.
-  gscoped_ptr<InboundTransfer> transfer_;
+  std::unique_ptr<InboundTransfer> transfer_;
 
   // The buffers for serialized response. Set by SerializeResponseBuffer().
   faststring response_hdr_buf_;
@@ -293,5 +291,3 @@ class InboundCall {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/messenger.cc b/src/kudu/rpc/messenger.cc
index 3ef04d3..48af449 100644
--- a/src/kudu/rpc/messenger.cc
+++ b/src/kudu/rpc/messenger.cc
@@ -22,12 +22,10 @@
 #include <mutex>
 #include <ostream>
 #include <string>
-#include <type_traits>
 #include <utility>
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/stl_util.h"
@@ -58,6 +56,7 @@
 using std::string;
 using std::shared_ptr;
 using std::make_shared;
+using std::unique_ptr;
 using strings::Substitute;
 
 namespace boost {
@@ -368,7 +367,7 @@ void Messenger::QueueOutboundCall(const shared_ptr<OutboundCall>
&call) {
   reactor->QueueOutboundCall(call);
 }
 
-void Messenger::QueueInboundCall(gscoped_ptr<InboundCall> call) {
+void Messenger::QueueInboundCall(unique_ptr<InboundCall> call) {
   // This lock acquisition spans the entirety of the function to avoid having to
   // take a ref on the RpcService. In doing so, we guarantee that the service
   // isn't shut down here, which would be problematic because shutdown is a
diff --git a/src/kudu/rpc/messenger.h b/src/kudu/rpc/messenger.h
index 5796684..6d95615 100644
--- a/src/kudu/rpc/messenger.h
+++ b/src/kudu/rpc/messenger.h
@@ -27,7 +27,6 @@
 #include <boost/optional/optional.hpp>
 #include <gtest/gtest_prod.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/rpc/connection.h"
@@ -257,7 +256,7 @@ class Messenger {
   void QueueOutboundCall(const std::shared_ptr<OutboundCall> &call);
 
   // Enqueue a call for processing on the server.
-  void QueueInboundCall(gscoped_ptr<InboundCall> call);
+  void QueueInboundCall(std::unique_ptr<InboundCall> call);
 
   // Queue a cancellation for the given outbound call.
   void QueueCancellation(const std::shared_ptr<OutboundCall> &call);
diff --git a/src/kudu/rpc/mt-rpc-test.cc b/src/kudu/rpc/mt-rpc-test.cc
index d349e1d..0245ce6 100644
--- a/src/kudu/rpc/mt-rpc-test.cc
+++ b/src/kudu/rpc/mt-rpc-test.cc
@@ -15,26 +15,23 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include "kudu/rpc/rpc-test-base.h"
-
 #include <cstddef>
 #include <memory>
 #include <ostream>
 #include <string>
-#include <type_traits>
 #include <utility>
 #include <vector>
 
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/rpc/acceptor_pool.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/rpc/proxy.h"
+#include "kudu/rpc/rpc-test-base.h"
 #include "kudu/rpc/rpc_service.h"
 #include "kudu/rpc/service_if.h"
 #include "kudu/rpc/service_pool.h"
@@ -54,6 +51,7 @@ METRIC_DECLARE_counter(rpcs_queue_overflow);
 
 using std::string;
 using std::shared_ptr;
+using std::unique_ptr;
 using std::vector;
 using strings::Substitute;
 
@@ -178,7 +176,7 @@ TEST_F(MultiThreadedRpcTest, TestShutdownClientWhileCallsPending) {
 // This bogus service pool leaves the service queue full.
 class BogusServicePool : public ServicePool {
  public:
-  BogusServicePool(gscoped_ptr<ServiceIf> service,
+  BogusServicePool(unique_ptr<ServiceIf> service,
                    const scoped_refptr<MetricEntity>& metric_entity,
                    size_t service_queue_length)
     : ServicePool(std::move(service), metric_entity, service_queue_length) {
@@ -216,7 +214,7 @@ TEST_F(MultiThreadedRpcTest, TestBlowOutServiceQueue) {
   ASSERT_OK(pool->Start(kMaxConcurrency));
   Sockaddr server_addr = pool->bind_address();
 
-  gscoped_ptr<ServiceIf> service(new GenericCalculatorService());
+  unique_ptr<ServiceIf> service(new GenericCalculatorService());
   service_name_ = service->service_name();
   service_pool_ = new BogusServicePool(std::move(service),
                                       server_messenger_->metric_entity(),
diff --git a/src/kudu/rpc/negotiation.h b/src/kudu/rpc/negotiation.h
index b25ed0e..9f06c64 100644
--- a/src/kudu/rpc/negotiation.h
+++ b/src/kudu/rpc/negotiation.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_NEGOTIATION_H
-#define KUDU_RPC_NEGOTIATION_H
+#pragma once
 
 #include <iosfwd>
 
@@ -55,4 +54,3 @@ class Negotiation {
 
 } // namespace rpc
 } // namespace kudu
-#endif // KUDU_RPC_NEGOTIATION_H
diff --git a/src/kudu/rpc/outbound_call.cc b/src/kudu/rpc/outbound_call.cc
index 17761f5..3fe7641 100644
--- a/src/kudu/rpc/outbound_call.cc
+++ b/src/kudu/rpc/outbound_call.cc
@@ -15,11 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/rpc/outbound_call.h"
+
 #include <cstdint>
 #include <memory>
 #include <mutex>
 #include <string>
-#include <type_traits>
 #include <unordered_set>
 #include <utility>
 #include <vector>
@@ -34,7 +35,6 @@
 #include "kudu/gutil/sysinfo.h"
 #include "kudu/gutil/walltime.h"
 #include "kudu/rpc/constants.h"
-#include "kudu/rpc/outbound_call.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "kudu/rpc/rpc_introspection.pb.h"
 #include "kudu/rpc/rpc_sidecar.h"
@@ -289,7 +289,7 @@ void OutboundCall::CallCallback() {
   }
 }
 
-void OutboundCall::SetResponse(gscoped_ptr<CallResponse> resp) {
+void OutboundCall::SetResponse(unique_ptr<CallResponse> resp) {
   call_response_ = std::move(resp);
   Slice r(call_response_->serialized_response());
 
@@ -508,7 +508,7 @@ Status CallResponse::GetSidecar(int idx, Slice* sidecar) const {
   return Status::OK();
 }
 
-Status CallResponse::ParseFrom(gscoped_ptr<InboundTransfer> transfer) {
+Status CallResponse::ParseFrom(unique_ptr<InboundTransfer> transfer) {
   CHECK(!parsed_);
   RETURN_NOT_OK(serialization::ParseMessage(transfer->data(), &header_,
                                             &serialized_response_));
diff --git a/src/kudu/rpc/outbound_call.h b/src/kudu/rpc/outbound_call.h
index c48e496..7cd5f01 100644
--- a/src/kudu/rpc/outbound_call.h
+++ b/src/kudu/rpc/outbound_call.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_CLIENT_CALL_H
-#define KUDU_RPC_CLIENT_CALL_H
+#pragma once
 
 #include <cstddef>
 #include <cstdint>
@@ -29,7 +28,6 @@
 #include <glog/logging.h>
 #include <gtest/gtest_prod.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/rpc/connection_id.h"
 #include "kudu/rpc/constants.h"
@@ -146,7 +144,7 @@ class OutboundCall {
   bool IsFinished() const;
 
   // Fill in the call response.
-  void SetResponse(gscoped_ptr<CallResponse> resp);
+  void SetResponse(std::unique_ptr<CallResponse> resp);
 
   const std::set<RpcFeatureFlag>& required_rpc_features() const {
     return required_rpc_features_;
@@ -268,7 +266,7 @@ class OutboundCall {
 
   // Once a response has been received for this call, contains that response.
   // Otherwise NULL.
-  gscoped_ptr<CallResponse> call_response_;
+  std::unique_ptr<CallResponse> call_response_;
 
   // All sidecars to be sent with this call.
   std::vector<std::unique_ptr<RpcSidecar>> sidecars_;
@@ -297,7 +295,7 @@ class CallResponse {
 
   // Parse the response received from a call. This must be called before any
   // other methods on this object.
-  Status ParseFrom(gscoped_ptr<InboundTransfer> transfer);
+  Status ParseFrom(std::unique_ptr<InboundTransfer> transfer);
 
   // Return true if the call succeeded.
   bool is_success() const {
@@ -337,12 +335,10 @@ class CallResponse {
 
   // The incoming transfer data - retained because serialized_response_
   // and sidecar_slices_ refer into its data.
-  gscoped_ptr<InboundTransfer> transfer_;
+  std::unique_ptr<InboundTransfer> transfer_;
 
   DISALLOW_COPY_AND_ASSIGN(CallResponse);
 };
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/proxy.h b/src/kudu/rpc/proxy.h
index 641c514..ccf5f18 100644
--- a/src/kudu/rpc/proxy.h
+++ b/src/kudu/rpc/proxy.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_PROXY_H
-#define KUDU_RPC_PROXY_H
+#pragma once
 
 #include <memory>
 #include <string>
@@ -133,5 +131,3 @@ class Proxy {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/reactor.h b/src/kudu/rpc/reactor.h
index 4ab7ef6..1767357 100644
--- a/src/kudu/rpc/reactor.h
+++ b/src/kudu/rpc/reactor.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_REACTOR_H
-#define KUDU_RPC_REACTOR_H
+#pragma once
 
 #include <cstdint>
 #include <list>
@@ -428,5 +427,3 @@ class Reactor {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/remote_method.h b/src/kudu/rpc/remote_method.h
index a0a35bb..b5e42ae 100644
--- a/src/kudu/rpc/remote_method.h
+++ b/src/kudu/rpc/remote_method.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_REMOTE_METHOD_H_
-#define KUDU_RPC_REMOTE_METHOD_H_
+#pragma once
 
 #include <string>
 
@@ -47,5 +46,3 @@ class RemoteMethod {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif // KUDU_RPC_REMOTE_METHOD_H_
diff --git a/src/kudu/rpc/response_callback.h b/src/kudu/rpc/response_callback.h
index 8c4fc03..5a70a79 100644
--- a/src/kudu/rpc/response_callback.h
+++ b/src/kudu/rpc/response_callback.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_RESPONSE_CALLBACK_H
-#define KUDU_RPC_RESPONSE_CALLBACK_H
+#pragma once
 
 #include <boost/function.hpp>
 
@@ -25,7 +23,5 @@ namespace rpc {
 
 typedef boost::function<void()> ResponseCallback;
 
-}
-}
-
-#endif
+} // namespace rpc
+} // namespace kudu
diff --git a/src/kudu/rpc/rpc-test-base.h b/src/kudu/rpc/rpc-test-base.h
index e26bc9d..99e36ff 100644
--- a/src/kudu/rpc/rpc-test-base.h
+++ b/src/kudu/rpc/rpc-test-base.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_RPC_TEST_BASE_H
-#define KUDU_RPC_RPC_TEST_BASE_H
+#pragma once
 
 #include <algorithm>
 #include <atomic>
@@ -631,7 +630,7 @@ class RpcTestBase : public KuduTest {
     mem_tracker_ = MemTracker::CreateTracker(-1, "result_tracker");
     result_tracker_.reset(new ResultTracker(mem_tracker_));
 
-    gscoped_ptr<ServiceIf> service(new ServiceClass(metric_entity_, result_tracker_));
+    std::unique_ptr<ServiceIf> service(new ServiceClass(metric_entity_, result_tracker_));
     service_name_ = service->service_name();
     scoped_refptr<MetricEntity> metric_entity = server_messenger_->metric_entity();
     service_pool_ = new ServicePool(std::move(service), metric_entity, service_queue_length_);
@@ -658,4 +657,3 @@ class RpcTestBase : public KuduTest {
 
 } // namespace rpc
 } // namespace kudu
-#endif
diff --git a/src/kudu/rpc/rpc_context.h b/src/kudu/rpc/rpc_context.h
index b6ecaf6..b1466ce 100644
--- a/src/kudu/rpc/rpc_context.h
+++ b/src/kudu/rpc/rpc_context.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_RPC_CONTEXT_H
-#define KUDU_RPC_RPC_CONTEXT_H
+#pragma once
 
 #include <memory>
 #include <stddef.h>
@@ -23,7 +22,6 @@
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/rpc/rpc_header.pb.h"
 #include "kudu/util/monotime.h"
@@ -244,11 +242,10 @@ class RpcContext {
  private:
   friend class ResultTracker;
   InboundCall* const call_;
-  const gscoped_ptr<const google::protobuf::Message> request_pb_;
-  const gscoped_ptr<google::protobuf::Message> response_pb_;
+  const std::unique_ptr<const google::protobuf::Message> request_pb_;
+  const std::unique_ptr<google::protobuf::Message> response_pb_;
   scoped_refptr<ResultTracker> result_tracker_;
 };
 
 } // namespace rpc
 } // namespace kudu
-#endif
diff --git a/src/kudu/rpc/rpc_controller.cc b/src/kudu/rpc/rpc_controller.cc
index 77c7ca4..821b881 100644
--- a/src/kudu/rpc/rpc_controller.cc
+++ b/src/kudu/rpc/rpc_controller.cc
@@ -24,7 +24,6 @@
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/rpc/outbound_call.h"
diff --git a/src/kudu/rpc/rpc_controller.h b/src/kudu/rpc/rpc_controller.h
index aa61d83..bcdabf5 100644
--- a/src/kudu/rpc/rpc_controller.h
+++ b/src/kudu/rpc/rpc_controller.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_RPC_CONTROLLER_H
-#define KUDU_RPC_RPC_CONTROLLER_H
+#pragma once
 
 #include <cstdint>
 #include <memory>
@@ -279,4 +278,3 @@ class RpcController {
 
 } // namespace rpc
 } // namespace kudu
-#endif
diff --git a/src/kudu/rpc/rpc_service.h b/src/kudu/rpc/rpc_service.h
index dcaa9c1..42decc7 100644
--- a/src/kudu/rpc/rpc_service.h
+++ b/src/kudu/rpc/rpc_service.h
@@ -14,8 +14,9 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_SERVICE_H_
-#define KUDU_RPC_SERVICE_H_
+#pragma once
+
+#include <memory>
 
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/status.h"
@@ -34,14 +35,12 @@ class RpcService : public RefCountedThreadSafe<RpcService> {
   // Enqueue a call for processing.
   // On failure, the RpcService::QueueInboundCall() implementation is
   // responsible for responding to the client with a failure message.
-  virtual Status QueueInboundCall(gscoped_ptr<InboundCall> call) = 0;
+  virtual Status QueueInboundCall(std::unique_ptr<InboundCall> call) = 0;
 
-  virtual RpcMethodInfo* LookupMethod(const RemoteMethod& method) {
+  virtual RpcMethodInfo* LookupMethod(const RemoteMethod& /*method*/) {
     return nullptr;
   }
 };
 
 } // namespace rpc
 } // namespace kudu
-
-#endif // KUDU_RPC_SERVICE_H_
diff --git a/src/kudu/rpc/rpc_sidecar.h b/src/kudu/rpc/rpc_sidecar.h
index bfbfcea..cf555cb 100644
--- a/src/kudu/rpc/rpc_sidecar.h
+++ b/src/kudu/rpc/rpc_sidecar.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_RPC_SIDECAR_H
-#define KUDU_RPC_RPC_SIDECAR_H
+#pragma once
 
 #include <memory>
 
@@ -68,6 +67,3 @@ class RpcSidecar {
 
 } // namespace rpc
 } // namespace kudu
-
-
-#endif /* KUDU_RPC_RPC_SIDECAR_H */
diff --git a/src/kudu/rpc/rpc_stub-test.cc b/src/kudu/rpc/rpc_stub-test.cc
index f7ba53a..8c5a8a1 100644
--- a/src/kudu/rpc/rpc_stub-test.cc
+++ b/src/kudu/rpc/rpc_stub-test.cc
@@ -32,15 +32,12 @@
 #include <boost/core/ref.hpp>
 #include <boost/function.hpp>
 #include <gflags/gflags.h>
-#include <gflags/gflags_declare.h>
 #include <glog/logging.h>
 #include <glog/stl_logging.h>
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/atomicops.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/ref_counted.h"
-#include "kudu/gutil/stl_util.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/rpc/proxy.h"
 #include "kudu/rpc/rpc-test-base.h"
@@ -451,17 +448,16 @@ struct AsyncSleep {
 
 TEST_F(RpcStubTest, TestDontHandleTimedOutCalls) {
   CalculatorServiceProxy p(client_messenger_, server_addr_, server_addr_.host());
-  vector<AsyncSleep*> sleeps;
-  ElementDeleter d(&sleeps);
+  vector<unique_ptr<AsyncSleep>> sleeps;
 
   // Send enough sleep calls to occupy the worker threads.
   for (int i = 0; i < n_worker_threads_; i++) {
-    gscoped_ptr<AsyncSleep> sleep(new AsyncSleep);
+    unique_ptr<AsyncSleep> sleep(new AsyncSleep);
     sleep->rpc.set_timeout(MonoDelta::FromSeconds(1));
     sleep->req.set_sleep_micros(1000*1000); // 1sec
     p.SleepAsync(sleep->req, &sleep->resp, &sleep->rpc,
                  boost::bind(&CountDownLatch::CountDown, &sleep->latch));
-    sleeps.push_back(sleep.release());
+    sleeps.push_back(std::move(sleep));
   }
 
   // We asynchronously sent the RPCs above, but the RPCs might still
@@ -493,7 +489,7 @@ TEST_F(RpcStubTest, TestDontHandleTimedOutCalls) {
     ASSERT_STR_CONTAINS(s.ToString(), "SENT");
   });
 
-  for (AsyncSleep* s : sleeps) {
+  for (const auto& s : sleeps) {
     s->latch.Wait();
   }
 
diff --git a/src/kudu/rpc/sasl_common.h b/src/kudu/rpc/sasl_common.h
index c550882..dcda131 100644
--- a/src/kudu/rpc/sasl_common.h
+++ b/src/kudu/rpc/sasl_common.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_SASL_COMMON_H
-#define KUDU_RPC_SASL_COMMON_H
+#pragma once
 
 #include <cstddef>
 #include <cstdint>
@@ -147,7 +145,7 @@ Status SaslDecode(sasl_conn_t* conn,
                   Slice ciphertext,
                   Slice* plaintext) WARN_UNUSED_RESULT;
 
-// Deleter for sasl_conn_t instances, for use with gscoped_ptr after calling sasl_*_new()
+// Deleter for sasl_conn_t instances, for use with unique_ptr after calling sasl_*_new().
 struct SaslDeleter {
   inline void operator()(sasl_conn_t* conn) {
     sasl_dispose(&conn);
@@ -165,5 +163,3 @@ void SaslSetMutex();
 #if defined(__APPLE__)
 #pragma GCC diagnostic pop
 #endif // #if defined(__APPLE__)
-
-#endif
diff --git a/src/kudu/rpc/sasl_helper.h b/src/kudu/rpc/sasl_helper.h
index aa0c8bf..998e7a1 100644
--- a/src/kudu/rpc/sasl_helper.h
+++ b/src/kudu/rpc/sasl_helper.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_SASL_HELPER_H
-#define KUDU_RPC_SASL_HELPER_H
+#pragma once
 
 #include <cstdint>
 #include <set>
@@ -105,5 +103,3 @@ class SaslHelper {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif  // KUDU_RPC_SASL_HELPER_H
diff --git a/src/kudu/rpc/serialization.h b/src/kudu/rpc/serialization.h
index 8406a1f..9fa3858 100644
--- a/src/kudu/rpc/serialization.h
+++ b/src/kudu/rpc/serialization.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_SERIALIZATION_H
-#define KUDU_RPC_SERIALIZATION_H
+#pragma once
 
 #include <cstdint>
 #include <cstring>
@@ -85,4 +83,3 @@ Status ValidateConnHeader(const Slice& slice);
 } // namespace serialization
 } // namespace rpc
 } // namespace kudu
-#endif // KUDU_RPC_SERIALIZATION_H
diff --git a/src/kudu/rpc/service_if.h b/src/kudu/rpc/service_if.h
index 9156b4a..686580e 100644
--- a/src/kudu/rpc/service_if.h
+++ b/src/kudu/rpc/service_if.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_RPC_SERVICE_IF_H
-#define KUDU_RPC_SERVICE_IF_H
+#pragma once
 
 #include <cstdint>
 #include <functional>
@@ -131,4 +130,3 @@ class GeneratedServiceIf : public ServiceIf {
 
 } // namespace rpc
 } // namespace kudu
-#endif
diff --git a/src/kudu/rpc/service_pool.cc b/src/kudu/rpc/service_pool.cc
index f4f0130..a12a34d 100644
--- a/src/kudu/rpc/service_pool.cc
+++ b/src/kudu/rpc/service_pool.cc
@@ -21,7 +21,6 @@
 #include <memory>
 #include <ostream>
 #include <string>
-#include <type_traits>
 #include <utility>
 #include <vector>
 
@@ -29,7 +28,6 @@
 #include <glog/logging.h>
 
 #include "kudu/gutil/basictypes.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -45,8 +43,8 @@
 #include "kudu/util/thread.h"
 #include "kudu/util/trace.h"
 
-using std::shared_ptr;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 using strings::Substitute;
 
@@ -73,7 +71,7 @@ METRIC_DEFINE_counter(server, rpcs_queue_overflow,
 namespace kudu {
 namespace rpc {
 
-ServicePool::ServicePool(gscoped_ptr<ServiceIf> service,
+ServicePool::ServicePool(unique_ptr<ServiceIf> service,
                          const scoped_refptr<MetricEntity>& entity,
                          size_t service_queue_length)
   : service_(std::move(service)),
@@ -143,7 +141,7 @@ RpcMethodInfo* ServicePool::LookupMethod(const RemoteMethod& method)
{
   return service_->LookupMethod(method);
 }
 
-Status ServicePool::QueueInboundCall(gscoped_ptr<InboundCall> call) {
+Status ServicePool::QueueInboundCall(unique_ptr<InboundCall> call) {
   InboundCall* c = call.release();
 
   vector<uint32_t> unsupported_features;
diff --git a/src/kudu/rpc/service_pool.h b/src/kudu/rpc/service_pool.h
index 2bc8873..3e7229a 100644
--- a/src/kudu/rpc/service_pool.h
+++ b/src/kudu/rpc/service_pool.h
@@ -14,17 +14,15 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_SERVICE_POOL_H
-#define KUDU_SERVICE_POOL_H
+#pragma once
 
 #include <cstddef>
 #include <functional>
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
@@ -52,7 +50,7 @@ struct RpcMethodInfo;
 // Also includes a queue that calls get pushed onto for handling by the pool.
 class ServicePool : public RpcService {
  public:
-  ServicePool(gscoped_ptr<ServiceIf> service,
+  ServicePool(std::unique_ptr<ServiceIf> service,
               const scoped_refptr<MetricEntity>& metric_entity,
               size_t service_queue_length);
   virtual ~ServicePool();
@@ -76,7 +74,7 @@ class ServicePool : public RpcService {
 
   RpcMethodInfo* LookupMethod(const RemoteMethod& method) override;
 
-  virtual Status QueueInboundCall(gscoped_ptr<InboundCall> call) OVERRIDE;
+  virtual Status QueueInboundCall(std::unique_ptr<InboundCall> call) OVERRIDE;
 
   const Counter* RpcsTimedOutInQueueMetricForTests() const {
     return rpcs_timed_out_in_queue_.get();
@@ -96,7 +94,7 @@ class ServicePool : public RpcService {
   void RunThread();
   void RejectTooBusy(InboundCall* c);
 
-  gscoped_ptr<ServiceIf> service_;
+  std::unique_ptr<ServiceIf> service_;
   std::vector<scoped_refptr<kudu::Thread> > threads_;
   LifoServiceQueue service_queue_;
   scoped_refptr<Histogram> incoming_queue_time_;
@@ -113,5 +111,3 @@ class ServicePool : public RpcService {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/service_queue.h b/src/kudu/rpc/service_queue.h
index 2751a30..5c1dcdd 100644
--- a/src/kudu/rpc/service_queue.h
+++ b/src/kudu/rpc/service_queue.h
@@ -14,8 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_UTIL_SERVICE_QUEUE_H
-#define KUDU_UTIL_SERVICE_QUEUE_H
+#pragma once
 
 #include <memory>
 #include <string>
@@ -221,5 +220,3 @@ class LifoServiceQueue {
 
 } // namespace rpc
 } // namespace kudu
-
-#endif
diff --git a/src/kudu/rpc/transfer.h b/src/kudu/rpc/transfer.h
index b95d43d..3342c93 100644
--- a/src/kudu/rpc/transfer.h
+++ b/src/kudu/rpc/transfer.h
@@ -14,9 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_RPC_TRANSFER_H
-#define KUDU_RPC_TRANSFER_H
+#pragma once
 
 #include <array>
 #include <cstddef>
@@ -209,4 +207,3 @@ struct TransferCallbacks {
 
 } // namespace rpc
 } // namespace kudu
-#endif
diff --git a/src/kudu/server/rpc_server.cc b/src/kudu/server/rpc_server.cc
index ec5a135..e1d8872 100644
--- a/src/kudu/server/rpc_server.cc
+++ b/src/kudu/server/rpc_server.cc
@@ -15,11 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/server/rpc_server.h"
+
 #include <functional>
 #include <memory>
 #include <ostream>
 #include <string>
-#include <type_traits>
 #include <utility>
 #include <vector>
 
@@ -27,7 +28,6 @@
 #include <glog/logging.h>
 
 #include "kudu/gutil/casts.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/join.h"
@@ -37,7 +37,6 @@
 #include "kudu/rpc/rpc_service.h"
 #include "kudu/rpc/service_if.h"
 #include "kudu/rpc/service_pool.h"
-#include "kudu/server/rpc_server.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/net/sockaddr.h"
@@ -48,6 +47,7 @@ using kudu::rpc::Messenger;
 using kudu::rpc::ServiceIf;
 using std::shared_ptr;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 using strings::Substitute;
 
@@ -153,7 +153,7 @@ Status RpcServer::Init(const shared_ptr<Messenger>& messenger)
{
   return Status::OK();
 }
 
-Status RpcServer::RegisterService(gscoped_ptr<rpc::ServiceIf> service) {
+Status RpcServer::RegisterService(unique_ptr<rpc::ServiceIf> service) {
   CHECK(server_state_ == INITIALIZED ||
         server_state_ == BOUND) << "bad state: " << server_state_;
   string service_name = service->service_name();
diff --git a/src/kudu/server/rpc_server.h b/src/kudu/server/rpc_server.h
index 6d32c12..06f462e 100644
--- a/src/kudu/server/rpc_server.h
+++ b/src/kudu/server/rpc_server.h
@@ -26,7 +26,6 @@
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #include "kudu/util/net/sockaddr.h"
@@ -73,7 +72,7 @@ class RpcServer {
   Status Init(const std::shared_ptr<rpc::Messenger>& messenger) WARN_UNUSED_RESULT;
   // Services need to be registered after Init'ing, but before Start'ing.
   // The service's ownership will be given to a ServicePool.
-  Status RegisterService(gscoped_ptr<rpc::ServiceIf> service) WARN_UNUSED_RESULT;
+  Status RegisterService(std::unique_ptr<rpc::ServiceIf> service) WARN_UNUSED_RESULT;
   Status Bind() WARN_UNUSED_RESULT;
   Status Start() WARN_UNUSED_RESULT;
   void Shutdown();
diff --git a/src/kudu/server/server_base.cc b/src/kudu/server/server_base.cc
index e040ca3..7539bc0 100644
--- a/src/kudu/server/server_base.cc
+++ b/src/kudu/server/server_base.cc
@@ -21,7 +21,6 @@
 #include <functional>
 #include <sstream>
 #include <string>
-#include <type_traits>
 #include <utility>
 #include <vector>
 
@@ -630,7 +629,7 @@ Status ServerBase::DumpServerInfo(const string& path,
   return Status::OK();
 }
 
-Status ServerBase::RegisterService(gscoped_ptr<rpc::ServiceIf> rpc_impl) {
+Status ServerBase::RegisterService(unique_ptr<rpc::ServiceIf> rpc_impl) {
   return rpc_server_->RegisterService(std::move(rpc_impl));
 }
 
@@ -701,8 +700,8 @@ std::string ServerBase::FooterHtml() const {
 Status ServerBase::Start() {
   GenerateInstanceID();
 
-  RETURN_NOT_OK(RegisterService(make_gscoped_ptr<rpc::ServiceIf>(
-                                  new GenericServiceImpl(this))));
+  RETURN_NOT_OK(RegisterService(
+      unique_ptr<rpc::ServiceIf>(new GenericServiceImpl(this))));
   RETURN_NOT_OK(rpc_server_->Start());
 
   if (web_server_) {
diff --git a/src/kudu/server/server_base.h b/src/kudu/server/server_base.h
index f97214c..77e4c7d 100644
--- a/src/kudu/server/server_base.h
+++ b/src/kudu/server/server_base.h
@@ -20,7 +20,6 @@
 #include <memory>
 #include <string>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/rpc/messenger.h"
@@ -143,7 +142,7 @@ class ServerBase {
 
   // Registers a new RPC service. Once Start() is called, the server will
   // process and dispatch incoming RPCs belonging to this service.
-  Status RegisterService(gscoped_ptr<rpc::ServiceIf> rpc_impl);
+  Status RegisterService(std::unique_ptr<rpc::ServiceIf> rpc_impl);
 
   // Unregisters all RPC services. After this function returns, any subsequent
   // incoming RPCs will be rejected.
@@ -174,11 +173,11 @@ class ServerBase {
 
   std::unique_ptr<MinidumpExceptionHandler> minidump_handler_;
   std::shared_ptr<MemTracker> mem_tracker_;
-  gscoped_ptr<MetricRegistry> metric_registry_;
+  std::unique_ptr<MetricRegistry> metric_registry_;
   scoped_refptr<MetricEntity> metric_entity_;
-  gscoped_ptr<FsManager> fs_manager_;
-  gscoped_ptr<RpcServer> rpc_server_;
-  gscoped_ptr<Webserver> web_server_;
+  std::unique_ptr<FsManager> fs_manager_;
+  std::unique_ptr<RpcServer> rpc_server_;
+  std::unique_ptr<Webserver> web_server_;
 
   std::shared_ptr<rpc::Messenger> messenger_;
   scoped_refptr<rpc::ResultTracker> result_tracker_;
@@ -187,7 +186,7 @@ class ServerBase {
   std::unique_ptr<clock::Clock> clock_;
 
   // The instance identifier of this server.
-  gscoped_ptr<NodeInstancePB> instance_pb_;
+  std::unique_ptr<NodeInstancePB> instance_pb_;
 
   // The ACL of users who are allowed to act as superusers.
   security::SimpleAcl superuser_acl_;
@@ -232,7 +231,7 @@ class ServerBase {
 #endif
   CountDownLatch stop_background_threads_latch_;
 
-  gscoped_ptr<ScopedGLogMetrics> glog_metrics_;
+  std::unique_ptr<ScopedGLogMetrics> glog_metrics_;
 
   DISALLOW_COPY_AND_ASSIGN(ServerBase);
 };
diff --git a/src/kudu/tserver/tablet_server.cc b/src/kudu/tserver/tablet_server.cc
index 7e51b53..a120e21 100644
--- a/src/kudu/tserver/tablet_server.cc
+++ b/src/kudu/tserver/tablet_server.cc
@@ -17,8 +17,8 @@
 
 #include "kudu/tserver/tablet_server.h"
 
+#include <memory>
 #include <ostream>
-#include <type_traits>
 #include <utility>
 #include <vector>
 
@@ -43,10 +43,11 @@
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/status.h"
 
-using std::string;
-using std::vector;
 using kudu::fs::ErrorHandlerType;
 using kudu::rpc::ServiceIf;
+using std::string;
+using std::unique_ptr;
+using std::vector;
 
 namespace kudu {
 namespace tserver {
@@ -126,10 +127,10 @@ Status TabletServer::Start() {
   fs_manager_->SetErrorNotificationCb(ErrorHandlerType::CFILE_CORRUPTION,
       Bind(&TSTabletManager::FailTabletAndScheduleShutdown, Unretained(tablet_manager_.get())));
 
-  gscoped_ptr<ServiceIf> ts_service(new TabletServiceImpl(this));
-  gscoped_ptr<ServiceIf> admin_service(new TabletServiceAdminImpl(this));
-  gscoped_ptr<ServiceIf> consensus_service(new ConsensusServiceImpl(this, tablet_manager_.get()));
-  gscoped_ptr<ServiceIf> tablet_copy_service(new TabletCopyServiceImpl(
+  unique_ptr<ServiceIf> ts_service(new TabletServiceImpl(this));
+  unique_ptr<ServiceIf> admin_service(new TabletServiceAdminImpl(this));
+  unique_ptr<ServiceIf> consensus_service(new ConsensusServiceImpl(this, tablet_manager_.get()));
+  unique_ptr<ServiceIf> tablet_copy_service(new TabletCopyServiceImpl(
       this, tablet_manager_.get()));
 
   RETURN_NOT_OK(RegisterService(std::move(ts_service)));


Mime
View raw message