You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/11/02 05:22:04 UTC

[kudu] 02/02: [fs] gscoped_ptr -> unique_ptr

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 8f509b2f7dbf3857ac838192368eb5c30c58ca9a
Author: lingbin <li...@gmail.com>
AuthorDate: Sat Nov 2 11:51:17 2019 +0800

    [fs] gscoped_ptr<T> -> unique_ptr<T>
    
    Replace all existing `gscoped_ptr` in the fs dir with `unique_ptr`.
    
    There are no functional changes here.
    
    Change-Id: I1d7617fd0c51d2a1c7e24e03396bcf8128817cfc
    Reviewed-on: http://gerrit.cloudera.org:8080/14618
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
 src/kudu/fs/block_manager-stress-test.cc | 5 ++---
 src/kudu/fs/block_manager-test.cc        | 9 ++++-----
 src/kudu/fs/log_block_manager-test.cc    | 3 +--
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/kudu/fs/block_manager-stress-test.cc b/src/kudu/fs/block_manager-stress-test.cc
index 9d424f6..27d4a5b 100644
--- a/src/kudu/fs/block_manager-stress-test.cc
+++ b/src/kudu/fs/block_manager-stress-test.cc
@@ -41,7 +41,6 @@
 #include "kudu/fs/fs_report.h"
 #include "kudu/fs/log_block_manager-test-util.h"
 #include "kudu/fs/log_block_manager.h"  // IWYU pragma: keep
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/split.h"
@@ -269,7 +268,7 @@ class BlockManagerStressTest : public KuduTest {
   simple_spinlock lock_;
 
   // The block manager.
-  gscoped_ptr<BlockManager> bm_;
+  unique_ptr<BlockManager> bm_;
 
   // The directory manager.
   unique_ptr<DataDirManager> dd_manager_;
@@ -408,7 +407,7 @@ void BlockManagerStressTest<T>::ReaderThread() {
     // Read it fully into memory.
     uint64_t block_size;
     CHECK_OK(block->Size(&block_size));
-    gscoped_ptr<uint8_t[]> scratch(new uint8_t[block_size]);
+    unique_ptr<uint8_t[]> scratch(new uint8_t[block_size]);
     Slice data(scratch.get(), block_size);
     CHECK_OK(block->Read(0, data));
 
diff --git a/src/kudu/fs/block_manager-test.cc b/src/kudu/fs/block_manager-test.cc
index 7262ff0..ae1194d 100644
--- a/src/kudu/fs/block_manager-test.cc
+++ b/src/kudu/fs/block_manager-test.cc
@@ -43,7 +43,6 @@
 #include "kudu/gutil/basictypes.h"
 #include "kudu/gutil/bind.h"
 #include "kudu/gutil/casts.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -514,7 +513,7 @@ TYPED_TEST(BlockManagerTest, ReadAfterDeleteTest) {
               .IsNotFound());
 
   // But we should still be able to read from the opened block.
-  gscoped_ptr<uint8_t[]> scratch(new uint8_t[test_data.length()]);
+  unique_ptr<uint8_t[]> scratch(new uint8_t[test_data.length()]);
   Slice data(scratch.get(), test_data.length());
   ASSERT_OK(read_block->Read(0, data));
   ASSERT_EQ(test_data, data);
@@ -683,7 +682,7 @@ TYPED_TEST(BlockManagerTest, PersistenceTest) {
   // The existing block manager is left open, which proxies for the process
   // having crashed without cleanly shutting down the block manager. The
   // on-disk metadata should still be clean.
-  gscoped_ptr<BlockManager> new_bm(this->CreateBlockManager(
+  unique_ptr<BlockManager> new_bm(this->CreateBlockManager(
       scoped_refptr<MetricEntity>(),
       MemTracker::CreateTracker(-1, "other tracker")));
   ASSERT_OK(new_bm->Open(nullptr));
@@ -698,7 +697,7 @@ TYPED_TEST(BlockManagerTest, PersistenceTest) {
   ASSERT_OK(new_bm->OpenBlock(written_block2->id(), &read_block));
   ASSERT_OK(read_block->Size(&sz));
   ASSERT_EQ(test_data.length(), sz);
-  gscoped_ptr<uint8_t[]> scratch(new uint8_t[test_data.length()]);
+  unique_ptr<uint8_t[]> scratch(new uint8_t[test_data.length()]);
   Slice data(scratch.get(), test_data.length());
   ASSERT_OK(read_block->Read(0, data));
   ASSERT_EQ(test_data, data);
@@ -797,7 +796,7 @@ TYPED_TEST(BlockManagerTest, MetricsTest) {
         i * kTestData.length(), (i + 1) * kTestData.length()));
 
     // The read is reflected in total_bytes_read.
-    gscoped_ptr<uint8_t[]> scratch(new uint8_t[kTestData.length()]);
+    unique_ptr<uint8_t[]> scratch(new uint8_t[kTestData.length()]);
     Slice data(scratch.get(), kTestData.length());
     ASSERT_OK(reader->Read(0, data));
     NO_FATALS(CheckMetrics(
diff --git a/src/kudu/fs/log_block_manager-test.cc b/src/kudu/fs/log_block_manager-test.cc
index c82b7ff..897789f 100644
--- a/src/kudu/fs/log_block_manager-test.cc
+++ b/src/kudu/fs/log_block_manager-test.cc
@@ -47,7 +47,6 @@
 #include "kudu/gutil/bind.h"
 #include "kudu/gutil/bind_helpers.h"
 #include "kudu/gutil/casts.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/strip.h"
@@ -762,7 +761,7 @@ TEST_F(LogBlockManagerTest, TestMetadataTruncation) {
   uint64_t latest_meta_size;
   ASSERT_OK(env_->GetFileSize(metadata_path, &latest_meta_size));
   ASSERT_OK(env_->NewRandomAccessFile(metadata_path, &meta_file));
-  gscoped_ptr<uint8_t[]> scratch(new uint8_t[latest_meta_size]);
+  unique_ptr<uint8_t[]> scratch(new uint8_t[latest_meta_size]);
   Slice result(scratch.get(), latest_meta_size);
   ASSERT_OK(meta_file->Read(0, result));
   string data = result.ToString();