kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [3/3] kudu git commit: Rename BlockTransaction to BlockCreationTransaction
Date Wed, 20 Sep 2017 18:37:26 GMT
Rename BlockTransaction to BlockCreationTransaction

This patch renames BlockTransaction to BlockCreationTransaction, since
the implementation of BlockTransaction is specific for block creations
that happen in a transaction.

Change-Id: I1abf5a8856de5c9564e5e1f05e5a113d3b7adc77
Reviewed-on: http://gerrit.cloudera.org:8080/8101
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <adar@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/02ba0ec6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/02ba0ec6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/02ba0ec6

Branch: refs/heads/master
Commit: 02ba0ec6ca0ae1903dee2af69b6dc8c365772b16
Parents: fb74d34
Author: hahao <hao.hao@cloudera.com>
Authored: Tue Sep 19 12:00:54 2017 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Wed Sep 20 18:36:55 2017 +0000

----------------------------------------------------------------------
 src/kudu/cfile/bloomfile.cc            |  6 +++---
 src/kudu/cfile/bloomfile.h             |  4 ++--
 src/kudu/cfile/cfile-test.cc           |  2 +-
 src/kudu/cfile/cfile_writer.cc         |  6 +++---
 src/kudu/cfile/cfile_writer.h          |  2 +-
 src/kudu/fs/block_manager-test.cc      | 18 +++++++++---------
 src/kudu/fs/block_manager.h            |  9 +++++----
 src/kudu/fs/log_block_manager-test.cc  | 10 +++++-----
 src/kudu/tablet/deltafile.cc           |  6 +++---
 src/kudu/tablet/deltafile.h            |  4 ++--
 src/kudu/tablet/diskrowset.cc          |  6 +++---
 src/kudu/tablet/diskrowset.h           |  4 ++--
 src/kudu/tablet/multi_column_writer.cc |  7 ++++---
 src/kudu/tablet/multi_column_writer.h  |  4 ++--
 src/kudu/tserver/tablet_copy_client.h  |  2 +-
 15 files changed, 46 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/cfile/bloomfile.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/bloomfile.cc b/src/kudu/cfile/bloomfile.cc
index f5c793b..ec301a0 100644
--- a/src/kudu/cfile/bloomfile.cc
+++ b/src/kudu/cfile/bloomfile.cc
@@ -57,7 +57,7 @@ using std::vector;
 namespace kudu {
 namespace cfile {
 
-using fs::BlockTransaction;
+using fs::BlockCreationTransaction;
 using fs::ReadableBlock;
 using fs::WritableBlock;
 
@@ -113,12 +113,12 @@ Status BloomFileWriter::Start() {
 }
 
 Status BloomFileWriter::Finish() {
-  BlockTransaction transaction;
+  BlockCreationTransaction transaction;
   RETURN_NOT_OK(FinishAndReleaseBlock(&transaction));
   return transaction.CommitCreatedBlocks();
 }
 
-Status BloomFileWriter::FinishAndReleaseBlock(BlockTransaction* transaction) {
+Status BloomFileWriter::FinishAndReleaseBlock(BlockCreationTransaction* transaction) {
   if (bloom_builder_.count() > 0) {
     RETURN_NOT_OK(FinishCurrentBloomBlock());
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/cfile/bloomfile.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/bloomfile.h b/src/kudu/cfile/bloomfile.h
index bf59705..27c2311 100644
--- a/src/kudu/cfile/bloomfile.h
+++ b/src/kudu/cfile/bloomfile.h
@@ -35,7 +35,7 @@
 namespace kudu {
 
 namespace fs {
-class BlockTransaction;
+class BlockCreationTransaction;
 class ReadableBlock;
 class WritableBlock;
 }
@@ -58,7 +58,7 @@ class BloomFileWriter {
 
   // Close the bloom's CFile, finalizing the underlying block and
   // releasing it to 'transaction'.
-  Status FinishAndReleaseBlock(fs::BlockTransaction* transaction);
+  Status FinishAndReleaseBlock(fs::BlockCreationTransaction* transaction);
 
   // Estimate the amount of data already written to this file.
   size_t written_size() const;

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/cfile/cfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test.cc b/src/kudu/cfile/cfile-test.cc
index c2c5f35..b35d77b 100644
--- a/src/kudu/cfile/cfile-test.cc
+++ b/src/kudu/cfile/cfile-test.cc
@@ -934,7 +934,7 @@ TEST_P(TestCFileBothCacheTypes, TestReleaseBlock) {
   WriterOptions opts;
   CFileWriter w(opts, GetTypeInfo(STRING), false, std::move(sink));
   ASSERT_OK(w.Start());
-  fs::BlockTransaction transaction;
+  fs::BlockCreationTransaction transaction;
   ASSERT_OK(w.FinishAndReleaseBlock(&transaction));
   ASSERT_EQ(1, transaction.created_blocks().size());
   ASSERT_EQ(WritableBlock::FINALIZED, transaction.created_blocks()[0]->state());

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/cfile/cfile_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.cc b/src/kudu/cfile/cfile_writer.cc
index 4506749..e0a07e4 100644
--- a/src/kudu/cfile/cfile_writer.cc
+++ b/src/kudu/cfile/cfile_writer.cc
@@ -58,7 +58,7 @@ DEFINE_bool(cfile_write_checksums, true,
 TAG_FLAG(cfile_write_checksums, evolving);
 
 using google::protobuf::RepeatedPtrField;
-using kudu::fs::BlockTransaction;
+using kudu::fs::BlockCreationTransaction;
 using kudu::fs::WritableBlock;
 using std::accumulate;
 using std::pair;
@@ -202,12 +202,12 @@ Status CFileWriter::Start() {
 
 Status CFileWriter::Finish() {
   TRACE_EVENT0("cfile", "CFileWriter::Finish");
-  BlockTransaction transaction;
+  BlockCreationTransaction transaction;
   RETURN_NOT_OK(FinishAndReleaseBlock(&transaction));
   return transaction.CommitCreatedBlocks();
 }
 
-Status CFileWriter::FinishAndReleaseBlock(BlockTransaction* transaction) {
+Status CFileWriter::FinishAndReleaseBlock(BlockCreationTransaction* transaction) {
   TRACE_EVENT0("cfile", "CFileWriter::FinishAndReleaseBlock");
   CHECK(state_ == kWriterWriting) <<
     "Bad state for Finish(): " << state_;

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/cfile/cfile_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.h b/src/kudu/cfile/cfile_writer.h
index 4800573..f9f703b 100644
--- a/src/kudu/cfile/cfile_writer.h
+++ b/src/kudu/cfile/cfile_writer.h
@@ -116,7 +116,7 @@ class CFileWriter {
 
   // Close the CFile, finalizing the underlying block and releasing
   // it to 'transaction'.
-  Status FinishAndReleaseBlock(fs::BlockTransaction* transaction);
+  Status FinishAndReleaseBlock(fs::BlockCreationTransaction* transaction);
 
   bool finished() {
     return state_ == kWriterFinished;

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/fs/block_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/block_manager-test.cc b/src/kudu/fs/block_manager-test.cc
index f12c655..c681ca5 100644
--- a/src/kudu/fs/block_manager-test.cc
+++ b/src/kudu/fs/block_manager-test.cc
@@ -131,7 +131,7 @@ class BlockManagerTest : public KuduTest {
     int num_blocks = num_dirs * num_blocks_per_dir;
 
     // Write 'num_blocks' blocks to this data dir group.
-    BlockTransaction transaction;
+    BlockCreationTransaction transaction;
     for (int i = 0; i < num_blocks; i++) {
       unique_ptr<WritableBlock> written_block;
       ASSERT_OK(bm_->CreateBlock(opts, &written_block));
@@ -348,7 +348,7 @@ void BlockManagerTest<LogBlockManager>::RunMultipathTest(const vector<string>&
p
   ASSERT_OK(dd_manager_->CreateDataDirGroup("multipath_test"));
 
   const char* kTestData = "test data";
-  BlockTransaction transaction;
+  BlockCreationTransaction transaction;
   // Creates (numPaths * 2) containers.
   for (int j = 0; j < paths.size() * 2; j++) {
     unique_ptr<WritableBlock> block;
@@ -1061,11 +1061,11 @@ TYPED_TEST(BlockManagerTest, ConcurrentCloseFinalizedWritableBlockTest)
{
 }
 
 TYPED_TEST(BlockManagerTest, TestBlockTransaction) {
-  // Create a BlockTransaction. In this transaction,
+  // Create a BlockCreationTransaction. In this transaction,
   // create some blocks and commit the writes all together.
   const string kTestData = "test data";
-  BlockTransaction transaction;
-  vector<BlockId> block_ids;
+  BlockCreationTransaction creation_transaction;
+  vector<BlockId> created_blocks;
   for (int i = 0; i < 20; i++) {
     unique_ptr<WritableBlock> writer;
     ASSERT_OK(this->bm_->CreateBlock(this->test_block_opts_, &writer));
@@ -1073,13 +1073,13 @@ TYPED_TEST(BlockManagerTest, TestBlockTransaction) {
     // Write some data to it.
     ASSERT_OK(writer->Append(kTestData));
     ASSERT_OK(writer->Finalize());
-    block_ids.emplace_back(writer->id());
-    transaction.AddCreatedBlock(std::move(writer));
+    created_blocks.emplace_back(writer->id());
+    creation_transaction.AddCreatedBlock(std::move(writer));
   }
-  ASSERT_OK(transaction.CommitCreatedBlocks());
+  ASSERT_OK(creation_transaction.CommitCreatedBlocks());
 
   // Read the blocks and verify the content.
-  for (const auto& block : block_ids) {
+  for (const auto& block : created_blocks) {
     unique_ptr<ReadableBlock> reader;
     ASSERT_OK(this->bm_->OpenBlock(block, &reader));
     uint64_t sz;

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/fs/block_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/fs/block_manager.h b/src/kudu/fs/block_manager.h
index 5c62ced..2bd7737 100644
--- a/src/kudu/fs/block_manager.h
+++ b/src/kudu/fs/block_manager.h
@@ -260,10 +260,11 @@ class BlockManager {
 };
 
 // Group a set of block creations together in a transaction. This has two
-// major motivations: 1) the underlying block manager can optimize
-// synchronization for a batch of blocks if possible to achieve better
-// performance. 2) to be able to track all blocks in one logical operation.
-class BlockTransaction {
+// major motivations:
+//  1) the underlying block manager can optimize synchronization for
+//     a batch of blocks if possible to achieve better performance.
+//  2) to be able to track all blocks created in one logical operation.
+class BlockCreationTransaction {
  public:
   void AddCreatedBlock(std::unique_ptr<WritableBlock> block) {
     created_blocks_.emplace_back(std::move(block));

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/fs/log_block_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/log_block_manager-test.cc b/src/kudu/fs/log_block_manager-test.cc
index 66715b8..b870623 100644
--- a/src/kudu/fs/log_block_manager-test.cc
+++ b/src/kudu/fs/log_block_manager-test.cc
@@ -290,7 +290,7 @@ TEST_F(LogBlockManagerTest, MetricsTest) {
   BlockId saved_id;
   {
     Random rand(SeedRandom());
-    BlockTransaction transaction;
+    BlockCreationTransaction transaction;
     for (int i = 0; i < 10; i++) {
       unique_ptr<WritableBlock> b;
       ASSERT_OK(bm_->CreateBlock(test_block_opts_, &b));
@@ -377,7 +377,7 @@ TEST_F(LogBlockManagerTest, TestReuseBlockIds) {
 
   // Create 4 containers, with the first four block IDs in the sequence.
   {
-    BlockTransaction transaction;
+    BlockCreationTransaction transaction;
     for (int i = 0; i < 4; i++) {
       unique_ptr<WritableBlock> writer;
       ASSERT_OK(bm_->CreateBlock(test_block_opts_, &writer));
@@ -806,7 +806,7 @@ TEST_F(LogBlockManagerTest, StartupBenchmark) {
   const int kNumBlocks = AllowSlowTests() ? 1000000 : 1000;
   // Creates 'kNumBlocks' blocks with minimal data.
   {
-    BlockTransaction transaction;
+    BlockCreationTransaction transaction;
     for (int i = 0; i < kNumBlocks; i++) {
       unique_ptr<WritableBlock> block;
       ASSERT_OK_FAST(bm_->CreateBlock(test_block_opts_, &block));
@@ -986,7 +986,7 @@ TEST_F(LogBlockManagerTest, TestRepairPreallocateExcessSpace) {
 
   // Create several full containers.
   {
-    BlockTransaction transaction;
+    BlockCreationTransaction transaction;
     for (int i = 0; i < kNumContainers; i++) {
       unique_ptr<WritableBlock> block;
       ASSERT_OK(bm_->CreateBlock(test_block_opts_, &block));
@@ -1179,7 +1179,7 @@ TEST_F(LogBlockManagerTest, TestRepairPartialRecords) {
 
   // Create some containers.
   {
-    BlockTransaction transaction;
+    BlockCreationTransaction transaction;
     for (int i = 0; i < kNumContainers; i++) {
       unique_ptr<WritableBlock> block;
       ASSERT_OK(bm_->CreateBlock(test_block_opts_, &block));

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tablet/deltafile.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltafile.cc b/src/kudu/tablet/deltafile.cc
index b7db07f..e742793 100644
--- a/src/kudu/tablet/deltafile.cc
+++ b/src/kudu/tablet/deltafile.cc
@@ -79,7 +79,7 @@ using cfile::BlockPointer;
 using cfile::CFileReader;
 using cfile::IndexTreeIterator;
 using cfile::ReaderOptions;
-using fs::BlockTransaction;
+using fs::BlockCreationTransaction;
 using fs::ReadableBlock;
 using fs::WritableBlock;
 
@@ -113,12 +113,12 @@ Status DeltaFileWriter::Start() {
 }
 
 Status DeltaFileWriter::Finish() {
-  BlockTransaction transaction;
+  BlockCreationTransaction transaction;
   RETURN_NOT_OK(FinishAndReleaseBlock(&transaction));
   return transaction.CommitCreatedBlocks();
 }
 
-Status DeltaFileWriter::FinishAndReleaseBlock(BlockTransaction* transaction) {
+Status DeltaFileWriter::FinishAndReleaseBlock(BlockCreationTransaction* transaction) {
   if (writer_->written_value_count() == 0) {
     return Status::Aborted("no deltas written");
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tablet/deltafile.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltafile.h b/src/kudu/tablet/deltafile.h
index bd85ecb..75a6b79 100644
--- a/src/kudu/tablet/deltafile.h
+++ b/src/kudu/tablet/deltafile.h
@@ -64,7 +64,7 @@ struct ReaderOptions;
 } // namespace cfile
 
 namespace fs {
-class BlockTransaction;
+class BlockCreationTransaction;
 class ReadableBlock;
 class WritableBlock;
 } // namespace fs
@@ -98,7 +98,7 @@ class DeltaFileWriter {
   //
   // Returns Status::Aborted() if no deltas were ever appended to this
   // writer.
-  Status FinishAndReleaseBlock(fs::BlockTransaction* transaction);
+  Status FinishAndReleaseBlock(fs::BlockCreationTransaction* transaction);
 
   // Append a given delta to the file. This must be called in ascending order
   // of (key, timestamp) for REDOS and ascending order of key, descending order

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tablet/diskrowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset.cc b/src/kudu/tablet/diskrowset.cc
index b37004f..d67644a 100644
--- a/src/kudu/tablet/diskrowset.cc
+++ b/src/kudu/tablet/diskrowset.cc
@@ -81,7 +81,7 @@ class OpId;
 namespace tablet {
 
 using cfile::BloomFileWriter;
-using fs::BlockTransaction;
+using fs::BlockCreationTransaction;
 using fs::CreateBlockOptions;
 using fs::WritableBlock;
 using log::LogAnchorRegistry;
@@ -227,12 +227,12 @@ Status DiskRowSetWriter::AppendBlock(const RowBlock &block) {
 
 Status DiskRowSetWriter::Finish() {
   TRACE_EVENT0("tablet", "DiskRowSetWriter::Finish");
-  BlockTransaction transaction;
+  BlockCreationTransaction transaction;
   RETURN_NOT_OK(FinishAndReleaseBlocks(&transaction));
   return transaction.CommitCreatedBlocks();
 }
 
-Status DiskRowSetWriter::FinishAndReleaseBlocks(BlockTransaction* transaction) {
+Status DiskRowSetWriter::FinishAndReleaseBlocks(BlockCreationTransaction* transaction) {
   TRACE_EVENT0("tablet", "DiskRowSetWriter::FinishAndReleaseBlocks");
   CHECK(!finished_);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tablet/diskrowset.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset.h b/src/kudu/tablet/diskrowset.h
index b4d6215..15b8b18 100644
--- a/src/kudu/tablet/diskrowset.h
+++ b/src/kudu/tablet/diskrowset.h
@@ -107,7 +107,7 @@ class DiskRowSetWriter {
 
   // Closes the CFiles, finalizing the underlying blocks and releasing
   // them to 'transaction'. If no rows were written, returns Status::Aborted().
-  Status FinishAndReleaseBlocks(fs::BlockTransaction* transaction);
+  Status FinishAndReleaseBlocks(fs::BlockCreationTransaction* transaction);
 
   // The base DiskRowSetWriter never rolls. This method is necessary for tests
   // which are templatized on the writer type.
@@ -269,7 +269,7 @@ class RollingDiskRowSetWriter {
 
   // Syncs and commits all writes of outstanding blocks when the rolling
   // writer is destroyed.
-  fs::BlockTransaction block_transaction_;
+  fs::BlockCreationTransaction block_transaction_;
 
   DISALLOW_COPY_AND_ASSIGN(RollingDiskRowSetWriter);
 };

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tablet/multi_column_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/multi_column_writer.cc b/src/kudu/tablet/multi_column_writer.cc
index 43b5781..60713b1 100644
--- a/src/kudu/tablet/multi_column_writer.cc
+++ b/src/kudu/tablet/multi_column_writer.cc
@@ -37,7 +37,7 @@ namespace kudu {
 namespace tablet {
 
 using cfile::CFileWriter;
-using fs::BlockTransaction;
+using fs::BlockCreationTransaction;
 using fs::CreateBlockOptions;
 using fs::WritableBlock;
 using std::unique_ptr;
@@ -119,12 +119,13 @@ Status MultiColumnWriter::AppendBlock(const RowBlock& block) {
 }
 
 Status MultiColumnWriter::Finish() {
-  BlockTransaction transaction;
+  BlockCreationTransaction transaction;
   RETURN_NOT_OK(FinishAndReleaseBlocks(&transaction));
   return transaction.CommitCreatedBlocks();
 }
 
-Status MultiColumnWriter::FinishAndReleaseBlocks(BlockTransaction* transaction) {
+Status MultiColumnWriter::FinishAndReleaseBlocks(
+    BlockCreationTransaction* transaction) {
   CHECK(!finished_);
   for (int i = 0; i < schema_->num_columns(); i++) {
     CFileWriter *writer = cfile_writers_[i];

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tablet/multi_column_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/multi_column_writer.h b/src/kudu/tablet/multi_column_writer.h
index 7502d2f..7d880f4 100644
--- a/src/kudu/tablet/multi_column_writer.h
+++ b/src/kudu/tablet/multi_column_writer.h
@@ -40,7 +40,7 @@ class CFileWriter;
 } // namespace cfile
 
 namespace fs {
-class BlockTransaction;
+class BlockCreationTransaction;
 } // namespace fs
 
 namespace tablet {
@@ -70,7 +70,7 @@ class MultiColumnWriter {
 
   // Close the in-progress CFiles, finalizing the underlying writable
   // blocks and releasing them to 'transaction'.
-  Status FinishAndReleaseBlocks(fs::BlockTransaction* transaction);
+  Status FinishAndReleaseBlocks(fs::BlockCreationTransaction* transaction);
 
   // Return the number of bytes written so far.
   size_t written_size() const;

http://git-wip-us.apache.org/repos/asf/kudu/blob/02ba0ec6/src/kudu/tserver/tablet_copy_client.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_client.h b/src/kudu/tserver/tablet_copy_client.h
index 95dd865..0516c9f 100644
--- a/src/kudu/tserver/tablet_copy_client.h
+++ b/src/kudu/tserver/tablet_copy_client.h
@@ -247,7 +247,7 @@ class TabletCopyClient {
   TabletCopyClientMetrics* tablet_copy_metrics_;
 
   // Block transaction for the tablet copy.
-  fs::BlockTransaction transaction_;
+  fs::BlockCreationTransaction transaction_;
 
   DISALLOW_COPY_AND_ASSIGN(TabletCopyClient);
 };


Mime
View raw message