kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aw...@apache.org
Subject [kudu] branch master updated: util: gscoped_ptr<ThreadPool> -> unique_ptr<ThreadPool>
Date Sat, 12 Oct 2019 01:57:47 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new bd7416a  util: gscoped_ptr<ThreadPool> -> unique_ptr<ThreadPool>
bd7416a is described below

commit bd7416aec2f865fe4c3d187801cc775b549cc84d
Author: Andrew Wong <awong@cloudera.com>
AuthorDate: Fri Oct 11 16:58:24 2019 -0700

    util: gscoped_ptr<ThreadPool> -> unique_ptr<ThreadPool>
    
    This replaces all usages of gscoped_ptr<ThreadPool> with
    unique_ptr<ThreadPool>.
    
    I also made some trivial gscoped_ptr -> unique_ptr conversions here and
    there, and replaced a couple `ifndef`s with `pragma once`s.
    
    There are no functional changes in this patch.
    
    Change-Id: Ia69a079cf9bf834f4a626b6771442b84c7a37983
    Reviewed-on: http://gerrit.cloudera.org:8080/14419
    Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/codegen/compilation_manager.h              |  8 +++-----
 src/kudu/consensus/consensus-test-util.h            |  6 +++---
 src/kudu/consensus/consensus_peers-test.cc          |  2 +-
 src/kudu/consensus/consensus_queue-test.cc          |  4 +++-
 src/kudu/consensus/leader_election-test.cc          |  3 ++-
 src/kudu/consensus/log.cc                           |  2 +-
 src/kudu/consensus/log.h                            |  9 +++------
 src/kudu/consensus/raft_consensus_quorum-test.cc    |  2 +-
 src/kudu/fs/data_dirs.cc                            |  3 +--
 src/kudu/kserver/kserver.h                          |  7 +++----
 src/kudu/master/catalog_manager.h                   |  6 +++---
 src/kudu/master/master.h                            | 13 +++++--------
 src/kudu/rpc/messenger.h                            |  8 +++-----
 src/kudu/tablet/tablet_replica-test.cc              |  6 +++---
 src/kudu/thrift/client.h                            |  3 +--
 src/kudu/tools/ksck.cc                              |  1 -
 src/kudu/tools/ksck.h                               | 10 +++-------
 src/kudu/tools/ksck_checksum.h                      |  3 +--
 src/kudu/tools/table_scanner.h                      |  3 +--
 src/kudu/tserver/tablet_copy_source_session-test.cc |  6 +++---
 src/kudu/tserver/ts_tablet_manager.h                |  8 ++++----
 src/kudu/util/countdown_latch-test.cc               |  5 +++--
 src/kudu/util/curl_util-test.cc                     |  5 +++--
 src/kudu/util/maintenance_manager.h                 |  3 +--
 src/kudu/util/net/dns_resolver.h                    |  3 +--
 src/kudu/util/threadpool-test.cc                    |  5 ++---
 src/kudu/util/threadpool.cc                         |  5 ++---
 src/kudu/util/threadpool.h                          |  9 +++------
 src/kudu/util/trace.h                               |  7 +++----
 29 files changed, 66 insertions(+), 89 deletions(-)

diff --git a/src/kudu/codegen/compilation_manager.h b/src/kudu/codegen/compilation_manager.h
index 77c829a..4cca427 100644
--- a/src/kudu/codegen/compilation_manager.h
+++ b/src/kudu/codegen/compilation_manager.h
@@ -14,11 +14,10 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-
-#ifndef KUDU_CODEGEN_COMPILATION_MANAGER_H
-#define KUDU_CODEGEN_COMPILATION_MANAGER_H
+#pragma once
 
 #include <cstdint>
+#include <memory>
 
 #include "kudu/codegen/code_generator.h"
 #include "kudu/codegen/code_cache.h"
@@ -95,7 +94,7 @@ class CompilationManager {
 
   CodeGenerator generator_;
   CodeCache cache_;
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
 
   AtomicInt<int64_t> hit_counter_;
   AtomicInt<int64_t> query_counter_;
@@ -108,4 +107,3 @@ class CompilationManager {
 } // namespace codegen
 } // namespace kudu
 
-#endif
diff --git a/src/kudu/consensus/consensus-test-util.h b/src/kudu/consensus/consensus-test-util.h
index a0a0e42..cc799c1 100644
--- a/src/kudu/consensus/consensus-test-util.h
+++ b/src/kudu/consensus/consensus-test-util.h
@@ -401,7 +401,7 @@ class NoOpTestPeerProxyFactory : public PeerProxyFactory {
     return messenger_;
   }
  private:
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
   std::shared_ptr<rpc::Messenger> messenger_;
 };
 
@@ -630,7 +630,7 @@ class LocalTestPeerProxyFactory : public PeerProxyFactory {
   }
 
  private:
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
   std::shared_ptr<rpc::Messenger> messenger_;
   TestPeerMapManager* const peers_;
     // NOTE: There is no need to delete this on the dctor because proxies are externally
managed
@@ -734,7 +734,7 @@ class TestTransactionFactory : public ConsensusRoundHandler {
   }
 
  private:
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
   RaftConsensus* consensus_;
   log::Log* log_;
 };
diff --git a/src/kudu/consensus/consensus_peers-test.cc b/src/kudu/consensus/consensus_peers-test.cc
index 73246f5..08797c6 100644
--- a/src/kudu/consensus/consensus_peers-test.cc
+++ b/src/kudu/consensus/consensus_peers-test.cc
@@ -165,7 +165,7 @@ class ConsensusPeersTest : public KuduTest {
   scoped_refptr<MetricEntity> metric_entity_;
   gscoped_ptr<FsManager> fs_manager_;
   scoped_refptr<Log> log_;
-  gscoped_ptr<ThreadPool> raft_pool_;
+  unique_ptr<ThreadPool> raft_pool_;
   gscoped_ptr<PeerMessageQueue> message_queue_;
   const Schema schema_;
   LogOptions options_;
diff --git a/src/kudu/consensus/consensus_queue-test.cc b/src/kudu/consensus/consensus_queue-test.cc
index 807681b..0f8d866 100644
--- a/src/kudu/consensus/consensus_queue-test.cc
+++ b/src/kudu/consensus/consensus_queue-test.cc
@@ -17,6 +17,7 @@
 
 #include <cstddef>
 #include <cstdint>
+#include <memory>
 #include <ostream>
 #include <string>
 #include <vector>
@@ -62,6 +63,7 @@ DECLARE_int32(consensus_max_batch_size_bytes);
 DECLARE_int32(follower_unavailable_considered_failed_sec);
 
 using kudu::consensus::HealthReportPB;
+using std::unique_ptr;
 using std::vector;
 
 namespace kudu {
@@ -228,7 +230,7 @@ class ConsensusQueueTest : public KuduTest {
   MetricRegistry metric_registry_;
   scoped_refptr<MetricEntity> metric_entity_;
   scoped_refptr<log::Log> log_;
-  gscoped_ptr<ThreadPool> raft_pool_;
+  unique_ptr<ThreadPool> raft_pool_;
   gscoped_ptr<PeerMessageQueue> queue_;
   scoped_refptr<log::LogAnchorRegistry> registry_;
   scoped_refptr<clock::Clock> clock_;
diff --git a/src/kudu/consensus/leader_election-test.cc b/src/kudu/consensus/leader_election-test.cc
index 245fb47..94facbc 100644
--- a/src/kudu/consensus/leader_election-test.cc
+++ b/src/kudu/consensus/leader_election-test.cc
@@ -59,6 +59,7 @@ namespace consensus {
 
 using std::shared_ptr;
 using std::string;
+using std::unique_ptr;
 using std::unordered_map;
 using std::vector;
 using strings::Substitute;
@@ -147,7 +148,7 @@ class LeaderElectionTest : public KuduTest {
   RaftConfigPB config_;
   ProxyMap proxies_;
   gscoped_ptr<PeerProxyFactory> proxy_factory_;
-  gscoped_ptr<ThreadPool> pool_;
+  unique_ptr<ThreadPool> pool_;
 
   CountDownLatch latch_;
   gscoped_ptr<ElectionResult> result_;
diff --git a/src/kudu/consensus/log.cc b/src/kudu/consensus/log.cc
index 43b11a1..7a95afa 100644
--- a/src/kudu/consensus/log.cc
+++ b/src/kudu/consensus/log.cc
@@ -258,7 +258,7 @@ class Log::AppendThread {
 
   // Pool with a single thread, which handles shutting down the thread
   // when idle.
-  gscoped_ptr<ThreadPool> append_pool_;
+  unique_ptr<ThreadPool> append_pool_;
 };
 
 
diff --git a/src/kudu/consensus/log.h b/src/kudu/consensus/log.h
index 5abbf3a..34ffe15 100644
--- a/src/kudu/consensus/log.h
+++ b/src/kudu/consensus/log.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_CONSENSUS_LOG_H_
-#define KUDU_CONSENSUS_LOG_H_
+#pragma once
 
 #include <atomic>
 #include <cstddef>
@@ -350,7 +348,7 @@ class Log : public RefCountedThreadSafe<Log> {
   uint32_t schema_version_;
 
   // The currently active segment being written.
-  gscoped_ptr<WritableLogSegment> active_segment_;
+  std::unique_ptr<WritableLogSegment> active_segment_;
 
   // The current (active) segment sequence number.
   uint64_t active_segment_sequence_number_;
@@ -389,7 +387,7 @@ class Log : public RefCountedThreadSafe<Log> {
   // Thread writing to the log
   gscoped_ptr<AppendThread> append_thread_;
 
-  gscoped_ptr<ThreadPool> allocation_pool_;
+  std::unique_ptr<ThreadPool> allocation_pool_;
 
   // If true, sync on all appends.
   bool force_sync_all_;
@@ -565,4 +563,3 @@ class Log::LogFaultHooks {
 
 }  // namespace log
 }  // namespace kudu
-#endif /* KUDU_CONSENSUS_LOG_H_ */
diff --git a/src/kudu/consensus/raft_consensus_quorum-test.cc b/src/kudu/consensus/raft_consensus_quorum-test.cc
index 75edcab..1b66e43 100644
--- a/src/kudu/consensus/raft_consensus_quorum-test.cc
+++ b/src/kudu/consensus/raft_consensus_quorum-test.cc
@@ -579,7 +579,7 @@ class RaftConsensusQuorumTest : public KuduTest {
   vector<shared_ptr<MemTracker>> parent_mem_trackers_;
   vector<FsManager*> fs_managers_;
   vector<scoped_refptr<Log> > logs_;
-  gscoped_ptr<ThreadPool> raft_pool_;
+  unique_ptr<ThreadPool> raft_pool_;
   vector<scoped_refptr<ConsensusMetadataManager>> cmeta_managers_;
   gscoped_ptr<TestPeerMapManager> peers_;
   vector<TestTransactionFactory*> txn_factories_;
diff --git a/src/kudu/fs/data_dirs.cc b/src/kudu/fs/data_dirs.cc
index 7263c09..c5205ab 100644
--- a/src/kudu/fs/data_dirs.cc
+++ b/src/kudu/fs/data_dirs.cc
@@ -40,7 +40,6 @@
 #include "kudu/fs/block_manager_util.h"
 #include "kudu/fs/fs.pb.h"
 #include "kudu/gutil/bind.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
@@ -710,7 +709,7 @@ Status DataDirManager::Open() {
     const string data_dir = instance->dir();
 
     // Create a per-dir thread pool.
-    gscoped_ptr<ThreadPool> pool;
+    unique_ptr<ThreadPool> pool;
     RETURN_NOT_OK(ThreadPoolBuilder(Substitute("data dir $0", i))
                   .set_max_threads(1)
                   .set_trace_metric_prefix("data dirs")
diff --git a/src/kudu/kserver/kserver.h b/src/kudu/kserver/kserver.h
index c9fdec1..09903a9 100644
--- a/src/kudu/kserver/kserver.h
+++ b/src/kudu/kserver/kserver.h
@@ -19,7 +19,6 @@
 
 #include <string>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/server/server_base.h"
 #include "kudu/util/threadpool.h"
@@ -63,13 +62,13 @@ class KuduServer : public server::ServerBase {
  private:
 
   // Thread pool for preparing transactions, shared between all tablets.
-  gscoped_ptr<ThreadPool> tablet_prepare_pool_;
+  std::unique_ptr<ThreadPool> tablet_prepare_pool_;
 
   // Thread pool for applying transactions, shared between all tablets.
-  gscoped_ptr<ThreadPool> tablet_apply_pool_;
+  std::unique_ptr<ThreadPool> tablet_apply_pool_;
 
   // Thread pool for Raft-related operations, shared between all tablets.
-  gscoped_ptr<ThreadPool> raft_pool_;
+  std::unique_ptr<ThreadPool> raft_pool_;
 
   DISALLOW_COPY_AND_ASSIGN(KuduServer);
 };
diff --git a/src/kudu/master/catalog_manager.h b/src/kudu/master/catalog_manager.h
index 03e423a..f4ce890 100644
--- a/src/kudu/master/catalog_manager.h
+++ b/src/kudu/master/catalog_manager.h
@@ -1085,12 +1085,12 @@ class CatalogManager : public tserver::TabletReplicaLookupIf {
   // Random number generator used for selecting replica locations.
   ThreadSafeRandom rng_;
 
-  gscoped_ptr<SysCatalogTable> sys_catalog_;
+  std::unique_ptr<SysCatalogTable> sys_catalog_;
 
   // Background thread, used to execute the catalog manager tasks
   // like the assignment and cleaner
   friend class CatalogManagerBgTasks;
-  gscoped_ptr<CatalogManagerBgTasks> background_tasks_;
+  std::unique_ptr<CatalogManagerBgTasks> background_tasks_;
 
   std::unique_ptr<hms::HmsCatalog> hms_catalog_;
   std::unique_ptr<HmsNotificationLogListenerTask> hms_notification_log_listener_;
@@ -1111,7 +1111,7 @@ class CatalogManager : public tserver::TabletReplicaLookupIf {
   State state_;
 
   // Singleton pool that serializes invocations of ElectedAsLeaderCb().
-  gscoped_ptr<ThreadPool> leader_election_pool_;
+  std::unique_ptr<ThreadPool> leader_election_pool_;
 
   // This field is updated when a node becomes leader master,
   // waits for all outstanding uncommitted metadata (table and tablet metadata)
diff --git a/src/kudu/master/master.h b/src/kudu/master/master.h
index 0b3c66b..b66a31b 100644
--- a/src/kudu/master/master.h
+++ b/src/kudu/master/master.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_MASTER_MASTER_H
-#define KUDU_MASTER_MASTER_H
+#pragma once
 
 #include <atomic>
 #include <cstdint>
@@ -23,7 +22,6 @@
 #include <vector>
 
 #include "kudu/common/wire_protocol.pb.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #include "kudu/kserver/kserver.h"
@@ -133,11 +131,11 @@ class Master : public kserver::KuduServer {
 
   std::unique_ptr<MasterCertAuthority> cert_authority_;
   std::unique_ptr<security::TokenSigner> token_signer_;
-  gscoped_ptr<CatalogManager> catalog_manager_;
-  gscoped_ptr<MasterPathHandlers> path_handlers_;
+  std::unique_ptr<CatalogManager> catalog_manager_;
+  std::unique_ptr<MasterPathHandlers> path_handlers_;
 
   // For initializing the catalog manager.
-  gscoped_ptr<ThreadPool> init_pool_;
+  std::unique_ptr<ThreadPool> init_pool_;
 
   // The status of the master initialization. This is set
   // by the async initialization task.
@@ -155,11 +153,10 @@ class Master : public kserver::KuduServer {
   // A simplistic cache to track already assigned locations.
   std::unique_ptr<LocationCache> location_cache_;
 
-  gscoped_ptr<TSManager> ts_manager_;
+  std::unique_ptr<TSManager> ts_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(Master);
 };
 
 } // namespace master
 } // namespace kudu
-#endif
diff --git a/src/kudu/rpc/messenger.h b/src/kudu/rpc/messenger.h
index 56b087c..5dfa104 100644
--- a/src/kudu/rpc/messenger.h
+++ b/src/kudu/rpc/messenger.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_MESSENGER_H
-#define KUDU_RPC_MESSENGER_H
+#pragma once
 
 #include <cstdint>
 #include <memory>
@@ -379,8 +378,8 @@ class Messenger {
 
   // Separate client and server negotiation pools to avoid possibility of distributed
   // deadlock. See KUDU-2041.
-  gscoped_ptr<ThreadPool> client_negotiation_pool_;
-  gscoped_ptr<ThreadPool> server_negotiation_pool_;
+  std::unique_ptr<ThreadPool> client_negotiation_pool_;
+  std::unique_ptr<ThreadPool> server_negotiation_pool_;
 
   std::unique_ptr<security::TlsContext> tls_context_;
 
@@ -458,4 +457,3 @@ class Messenger {
 } // namespace rpc
 } // namespace kudu
 
-#endif
diff --git a/src/kudu/tablet/tablet_replica-test.cc b/src/kudu/tablet/tablet_replica-test.cc
index 376fb89..e41239e 100644
--- a/src/kudu/tablet/tablet_replica-test.cc
+++ b/src/kudu/tablet/tablet_replica-test.cc
@@ -388,9 +388,9 @@ class TabletReplicaTest : public KuduTabletTest {
   MetricRegistry metric_registry_;
   scoped_refptr<MetricEntity> metric_entity_;
   shared_ptr<Messenger> messenger_;
-  gscoped_ptr<ThreadPool> prepare_pool_;
-  gscoped_ptr<ThreadPool> apply_pool_;
-  gscoped_ptr<ThreadPool> raft_pool_;
+  unique_ptr<ThreadPool> prepare_pool_;
+  unique_ptr<ThreadPool> apply_pool_;
+  unique_ptr<ThreadPool> raft_pool_;
   unique_ptr<DnsResolver> dns_resolver_;
 
   scoped_refptr<ConsensusMetadataManager> cmeta_manager_;
diff --git a/src/kudu/thrift/client.h b/src/kudu/thrift/client.h
index ff948cb..2e684e7 100644
--- a/src/kudu/thrift/client.h
+++ b/src/kudu/thrift/client.h
@@ -28,7 +28,6 @@
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -123,7 +122,7 @@ class HaClient {
   Status Reconnect();
 
   // Background thread which executes calls to the Thrift service.
-  gscoped_ptr<ThreadPool> threadpool_;
+  std::unique_ptr<ThreadPool> threadpool_;
 
   // Client options.
   std::vector<HostPort> addresses_;
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index c66d9bd..6c39b7f 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -34,7 +34,6 @@
 #include <glog/logging.h>
 
 #include "kudu/consensus/quorum_util.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/join.h"
diff --git a/src/kudu/tools/ksck.h b/src/kudu/tools/ksck.h
index 4412b6e..71aa2b7 100644
--- a/src/kudu/tools/ksck.h
+++ b/src/kudu/tools/ksck.h
@@ -16,9 +16,7 @@
 // under the License.
 //
 // Ksck, a tool to run a Kudu System Check.
-
-#ifndef KUDU_TOOLS_KSCK_H
-#define KUDU_TOOLS_KSCK_H
+#pragma once
 
 #include <atomic>
 #include <cstdint>
@@ -36,7 +34,6 @@
 
 #include "kudu/common/schema.h"
 #include "kudu/consensus/metadata.pb.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/rebalance/cluster_status.h" // IWYU pragma: keep
@@ -482,7 +479,7 @@ class KsckCluster {
   MasterList masters_;
   TSMap tablet_servers_;
   std::vector<std::shared_ptr<KsckTable>> tables_;
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
 
   std::vector<std::string> table_filters_;
   std::vector<std::string> tablet_id_filters_;
@@ -614,7 +611,7 @@ class Ksck {
       int table_num_replicas);
 
   const std::shared_ptr<KsckCluster> cluster_;
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
 
   bool check_replica_count_ = true;
   std::vector<std::string> table_filters_;
@@ -633,4 +630,3 @@ class Ksck {
 } // namespace tools
 } // namespace kudu
 
-#endif // KUDU_TOOLS_KSCK_H
diff --git a/src/kudu/tools/ksck_checksum.h b/src/kudu/tools/ksck_checksum.h
index a09dba7..47b0947 100644
--- a/src/kudu/tools/ksck_checksum.h
+++ b/src/kudu/tools/ksck_checksum.h
@@ -28,7 +28,6 @@
 #include <vector>
 
 #include "kudu/common/schema.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/tools/ksck_results.h"
 #include "kudu/util/countdown_latch.h"
@@ -259,7 +258,7 @@ class KsckChecksumManager : public std::enable_shared_from_this<KsckChecksumMana
 
   // A threadpool for running tasks that find additional tablets that can
   // be checksummed based on available slots on tablet servers.
-  gscoped_ptr<ThreadPool> find_tablets_to_checksum_pool_;
+  std::unique_ptr<ThreadPool> find_tablets_to_checksum_pool_;
 
   std::atomic<int64_t> rows_summed_;
   std::atomic<int64_t> disk_bytes_summed_;
diff --git a/src/kudu/tools/table_scanner.h b/src/kudu/tools/table_scanner.h
index 17c75d2..b784835 100644
--- a/src/kudu/tools/table_scanner.h
+++ b/src/kudu/tools/table_scanner.h
@@ -29,7 +29,6 @@
 #include "kudu/client/client.h"
 #include "kudu/client/scan_batch.h"
 #include "kudu/client/shared_ptr.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/util/atomic.h"
 #include "kudu/util/mutex.h"
 #include "kudu/util/status.h"
@@ -97,7 +96,7 @@ class TableScanner {
   std::string table_name_;
   boost::optional<client::sp::shared_ptr<kudu::client::KuduClient>> dst_client_;
   boost::optional<std::string> dst_table_name_;
-  gscoped_ptr<ThreadPool> thread_pool_;
+  std::unique_ptr<ThreadPool> thread_pool_;
 
   // Protects output to 'out_' so that rows don't get interleaved.
   Mutex output_lock_;
diff --git a/src/kudu/tserver/tablet_copy_source_session-test.cc b/src/kudu/tserver/tablet_copy_source_session-test.cc
index fa18b0a..5bc912b 100644
--- a/src/kudu/tserver/tablet_copy_source_session-test.cc
+++ b/src/kudu/tserver/tablet_copy_source_session-test.cc
@@ -258,9 +258,9 @@ class TabletCopyTest : public KuduTabletTest {
 
   MetricRegistry metric_registry_;
   scoped_refptr<LogAnchorRegistry> log_anchor_registry_;
-  gscoped_ptr<ThreadPool> prepare_pool_;
-  gscoped_ptr<ThreadPool> apply_pool_;
-  gscoped_ptr<ThreadPool> raft_pool_;
+  unique_ptr<ThreadPool> prepare_pool_;
+  unique_ptr<ThreadPool> apply_pool_;
+  unique_ptr<ThreadPool> raft_pool_;
   unique_ptr<DnsResolver> dns_resolver_;
   scoped_refptr<TabletReplica> tablet_replica_;
   scoped_refptr<TabletCopySourceSession> session_;
diff --git a/src/kudu/tserver/ts_tablet_manager.h b/src/kudu/tserver/ts_tablet_manager.h
index 880fc86..863c1b7 100644
--- a/src/kudu/tserver/ts_tablet_manager.h
+++ b/src/kudu/tserver/ts_tablet_manager.h
@@ -20,6 +20,7 @@
 #include <cstdint>
 #include <functional>
 #include <map>
+#include <memory>
 #include <string>
 #include <unordered_map>
 #include <unordered_set>
@@ -28,7 +29,6 @@
 #include <gtest/gtest_prod.h>
 
 #include "kudu/consensus/metadata.pb.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/tablet/metadata.pb.h"
@@ -393,13 +393,13 @@ class TSTabletManager : public tserver::TabletReplicaLookupIf {
   TSTabletManagerStatePB state_;
 
   // Thread pool used to run tablet copy operations.
-  gscoped_ptr<ThreadPool> tablet_copy_pool_;
+  std::unique_ptr<ThreadPool> tablet_copy_pool_;
 
   // Thread pool used to open the tablets async, whether bootstrap is required or not.
-  gscoped_ptr<ThreadPool> open_tablet_pool_;
+  std::unique_ptr<ThreadPool> open_tablet_pool_;
 
   // Thread pool used to delete tablets asynchronously.
-  gscoped_ptr<ThreadPool> delete_tablet_pool_;
+  std::unique_ptr<ThreadPool> delete_tablet_pool_;
 
   FunctionGaugeDetacher metric_detacher_;
 
diff --git a/src/kudu/util/countdown_latch-test.cc b/src/kudu/util/countdown_latch-test.cc
index adb2623..32a673f 100644
--- a/src/kudu/util/countdown_latch-test.cc
+++ b/src/kudu/util/countdown_latch-test.cc
@@ -15,10 +15,11 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <memory>
+
 #include <boost/bind.hpp> // IWYU pragma: keep
 #include <gtest/gtest.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/monotime.h"
@@ -40,7 +41,7 @@ static void DecrementLatch(CountDownLatch* latch, int amount) {
 // as 1 by one.
 TEST(TestCountDownLatch, TestLatch) {
 
-  gscoped_ptr<ThreadPool> pool;
+  std::unique_ptr<ThreadPool> pool;
   ASSERT_OK(ThreadPoolBuilder("cdl-test").set_max_threads(1).Build(&pool));
 
   CountDownLatch latch(1000);
diff --git a/src/kudu/util/curl_util-test.cc b/src/kudu/util/curl_util-test.cc
index f43b6c7..7f750e7 100644
--- a/src/kudu/util/curl_util-test.cc
+++ b/src/kudu/util/curl_util-test.cc
@@ -17,9 +17,10 @@
 
 #include "kudu/util/curl_util.h"
 
+#include <memory>
+
 #include <gtest/gtest.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/util/debug/sanitizer_scopes.h"
 #include "kudu/util/faststring.h"
 #include "kudu/util/monotime.h"
@@ -41,7 +42,7 @@ TEST(CurlUtilTest, TestTimeout) {
 
 TEST(CurlUtilTest, NonSharedObjectsBetweenThreads) {
   const int kThreadCount = 8;
-  gscoped_ptr<ThreadPool> pool;
+  std::unique_ptr<ThreadPool> pool;
   ThreadPoolBuilder("curl-util-test")
       .set_min_threads(kThreadCount)
       .set_max_threads(kThreadCount)
diff --git a/src/kudu/util/maintenance_manager.h b/src/kudu/util/maintenance_manager.h
index 95a7987..631d0d6 100644
--- a/src/kudu/util/maintenance_manager.h
+++ b/src/kudu/util/maintenance_manager.h
@@ -30,7 +30,6 @@
 #include <glog/logging.h>
 #include <gtest/gtest_prod.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/atomic.h"
@@ -343,7 +342,7 @@ class MaintenanceManager : public std::enable_shared_from_this<MaintenanceManage
   OpMapTy ops_; // Registered operations.
   Mutex lock_;
   scoped_refptr<kudu::Thread> monitor_thread_;
-  gscoped_ptr<ThreadPool> thread_pool_;
+  std::unique_ptr<ThreadPool> thread_pool_;
   ConditionVariable cond_;
   bool shutdown_;
   int32_t polling_interval_ms_;
diff --git a/src/kudu/util/net/dns_resolver.h b/src/kudu/util/net/dns_resolver.h
index 8526385..b07384a 100644
--- a/src/kudu/util/net/dns_resolver.h
+++ b/src/kudu/util/net/dns_resolver.h
@@ -23,7 +23,6 @@
 #include <string>
 #include <vector>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/net/sockaddr.h"
@@ -97,7 +96,7 @@ class DnsResolver {
   bool GetCachedAddresses(const HostPort& hostport,
                           std::vector<Sockaddr>* addresses);
 
-  gscoped_ptr<ThreadPool> pool_;
+  std::unique_ptr<ThreadPool> pool_;
   std::unique_ptr<HostRecordCache> cache_;
 
   DISALLOW_COPY_AND_ASSIGN(DnsResolver);
diff --git a/src/kudu/util/threadpool-test.cc b/src/kudu/util/threadpool-test.cc
index 23fc45c..f440cda 100644
--- a/src/kudu/util/threadpool-test.cc
+++ b/src/kudu/util/threadpool-test.cc
@@ -38,7 +38,6 @@
 #include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/bind.h"
 #include "kudu/gutil/bind_helpers.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -92,7 +91,7 @@ class ThreadPoolTest : public KuduTest {
   }
 
  protected:
-  gscoped_ptr<ThreadPool> pool_;
+  unique_ptr<ThreadPool> pool_;
 };
 
 TEST_F(ThreadPoolTest, TestNoTaskOpenClose) {
@@ -346,7 +345,7 @@ TEST_F(ThreadPoolTest, TestZeroQueueSize) {
 // other tasks on the same pool.
 TEST_F(ThreadPoolTest, TestSlowThreadStart) {
   // Start a pool of threads from which we'll submit tasks.
-  gscoped_ptr<ThreadPool> submitter_pool;
+  unique_ptr<ThreadPool> submitter_pool;
   ASSERT_OK(ThreadPoolBuilder("submitter")
             .set_min_threads(5)
             .set_max_threads(5)
diff --git a/src/kudu/util/threadpool.cc b/src/kudu/util/threadpool.cc
index 23dda3d..e983c7c 100644
--- a/src/kudu/util/threadpool.cc
+++ b/src/kudu/util/threadpool.cc
@@ -123,10 +123,9 @@ ThreadPoolBuilder& ThreadPoolBuilder::set_metrics(ThreadPoolMetrics
metrics) {
   return *this;
 }
 
-Status ThreadPoolBuilder::Build(gscoped_ptr<ThreadPool>* pool) const {
+Status ThreadPoolBuilder::Build(unique_ptr<ThreadPool>* pool) const {
   pool->reset(new ThreadPool(*this));
-  RETURN_NOT_OK((*pool)->Init());
-  return Status::OK();
+  return (*pool)->Init();
 }
 
 ////////////////////////////////////////////////////////
diff --git a/src/kudu/util/threadpool.h b/src/kudu/util/threadpool.h
index 1557486..789b132 100644
--- a/src/kudu/util/threadpool.h
+++ b/src/kudu/util/threadpool.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_THREAD_POOL_H
-#define KUDU_UTIL_THREAD_POOL_H
+#pragma once
 
 #include <deque>
 #include <iosfwd>
@@ -28,7 +27,6 @@
 #include <gtest/gtest_prod.h>
 
 #include "kudu/gutil/callback.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
@@ -128,7 +126,7 @@ class ThreadPoolBuilder {
   ThreadPoolBuilder& set_metrics(ThreadPoolMetrics metrics);
 
   // Instantiate a new ThreadPool with the existing builder arguments.
-  Status Build(gscoped_ptr<ThreadPool>* pool) const;
+  Status Build(std::unique_ptr<ThreadPool>* pool) const;
 
  private:
   friend class ThreadPool;
@@ -168,7 +166,7 @@ class ThreadPoolBuilder {
 //    static void Func(int n) { ... }
 //    class Task : public Runnable { ... }
 //
-//    gscoped_ptr<ThreadPool> thread_pool;
+//    unique_ptr<ThreadPool> thread_pool;
 //    CHECK_OK(
 //        ThreadPoolBuilder("my_pool")
 //            .set_min_threads(0)
@@ -502,4 +500,3 @@ class ThreadPoolToken {
 };
 
 } // namespace kudu
-#endif
diff --git a/src/kudu/util/trace.h b/src/kudu/util/trace.h
index fb79150..61e3b13 100644
--- a/src/kudu/util/trace.h
+++ b/src/kudu/util/trace.h
@@ -14,10 +14,10 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_UTIL_TRACE_H
-#define KUDU_UTIL_TRACE_H
+#pragma once
 
 #include <iosfwd>
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
@@ -224,7 +224,7 @@ class Trace : public RefCountedThreadSafe<Trace> {
 
   void MetricsToJSON(JsonWriter* jw) const;
 
-  gscoped_ptr<ThreadSafeArena> arena_;
+  std::unique_ptr<ThreadSafeArena> arena_;
 
   // Lock protecting the entries linked list.
   mutable simple_spinlock lock_;
@@ -289,4 +289,3 @@ class ScopedTraceLatencyCounter {
 };
 
 } // namespace kudu
-#endif /* KUDU_UTIL_TRACE_H */


Mime
View raw message