kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] kudu git commit: Integrate BlockCreationTransaction into MajorDeltaCompaction
Date Fri, 20 Oct 2017 00:40:54 GMT
Integrate BlockCreationTransaction into MajorDeltaCompaction

Previous commit 59ca360bf integrated BlockCreationTransaction with
RowSet compaction, so that only a single transaction is used to finalize
underlying blocks. However in major delta compaction, MultiColumnWriter
and DeltaFileWriter use separate creation transactions, which does not
take full advantage of BlockCreationTransaction.

This patch includes a minor improvement to incorporate
BlockCreationTransaction with MajorDeltaCompaction to use a single
transaction for a RowSet's major delta compaction.

Change-Id: I887e20643ac8e4e728f8f91450d2d5059cb33d20
Reviewed-on: http://gerrit.cloudera.org:8080/8325
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-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/4172983f
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/4172983f
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/4172983f

Branch: refs/heads/master
Commit: 4172983fd29f5e2fd9b322ff10c2b016f89a5acb
Parents: c7fa4aa
Author: hahao <hao.hao@cloudera.com>
Authored: Wed Oct 18 16:30:49 2017 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Fri Oct 20 00:40:38 2017 +0000

----------------------------------------------------------------------
 src/kudu/tablet/delta_compaction.cc    | 11 ++++++++---
 src/kudu/tablet/multi_column_writer.cc |  8 --------
 src/kudu/tablet/multi_column_writer.h  |  5 -----
 3 files changed, 8 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/4172983f/src/kudu/tablet/delta_compaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_compaction.cc b/src/kudu/tablet/delta_compaction.cc
index 0b7fecd..4c4a09c 100644
--- a/src/kudu/tablet/delta_compaction.cc
+++ b/src/kudu/tablet/delta_compaction.cc
@@ -53,6 +53,8 @@ using std::shared_ptr;
 
 namespace kudu {
 
+using fs::BlockCreationTransaction;
+using fs::BlockManager;
 using fs::CreateBlockOptions;
 using fs::WritableBlock;
 using std::string;
@@ -228,17 +230,20 @@ Status MajorDeltaCompaction::FlushRowSetAndDeltas() {
     nrows += n;
   }
 
-  RETURN_NOT_OK(base_data_writer_->Finish());
+  BlockManager* bm = fs_manager_->block_manager();
+  unique_ptr<BlockCreationTransaction> transaction = bm->NewCreationTransaction();
+  RETURN_NOT_OK(base_data_writer_->FinishAndReleaseBlocks(transaction.get()));
 
   if (redo_delta_mutations_written_ > 0) {
     new_redo_delta_writer_->WriteDeltaStats(redo_stats);
-    RETURN_NOT_OK(new_redo_delta_writer_->Finish());
+    RETURN_NOT_OK(new_redo_delta_writer_->FinishAndReleaseBlock(transaction.get()));
   }
 
   if (undo_delta_mutations_written_ > 0) {
     new_undo_delta_writer_->WriteDeltaStats(undo_stats);
-    RETURN_NOT_OK(new_undo_delta_writer_->Finish());
+    RETURN_NOT_OK(new_undo_delta_writer_->FinishAndReleaseBlock(transaction.get()));
   }
+  transaction->CommitCreatedBlocks();
 
   DVLOG(1) << "Applied all outstanding deltas for columns "
            << partial_schema_.ToString()

http://git-wip-us.apache.org/repos/asf/kudu/blob/4172983f/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 1fc2671..15f70b5 100644
--- a/src/kudu/tablet/multi_column_writer.cc
+++ b/src/kudu/tablet/multi_column_writer.cc
@@ -38,7 +38,6 @@ namespace tablet {
 
 using cfile::CFileWriter;
 using fs::BlockCreationTransaction;
-using fs::BlockManager;
 using fs::CreateBlockOptions;
 using fs::WritableBlock;
 using std::unique_ptr;
@@ -119,13 +118,6 @@ Status MultiColumnWriter::AppendBlock(const RowBlock& block) {
   return Status::OK();
 }
 
-Status MultiColumnWriter::Finish() {
-  BlockManager* bm = fs_->block_manager();
-  unique_ptr<BlockCreationTransaction> transaction = bm->NewCreationTransaction();
-  RETURN_NOT_OK(FinishAndReleaseBlocks(transaction.get()));
-  return transaction->CommitCreatedBlocks();
-}
-
 Status MultiColumnWriter::FinishAndReleaseBlocks(
     BlockCreationTransaction* transaction) {
   CHECK(!finished_);

http://git-wip-us.apache.org/repos/asf/kudu/blob/4172983f/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 7d880f4..259d0bc 100644
--- a/src/kudu/tablet/multi_column_writer.h
+++ b/src/kudu/tablet/multi_column_writer.h
@@ -63,11 +63,6 @@ class MultiColumnWriter {
   // Note that the selection vector here is ignored.
   Status AppendBlock(const RowBlock& block);
 
-  // Close the in-progress files.
-  //
-  // The file's blocks may be retrieved using FlushedBlocks().
-  Status Finish();
-
   // Close the in-progress CFiles, finalizing the underlying writable
   // blocks and releasing them to 'transaction'.
   Status FinishAndReleaseBlocks(fs::BlockCreationTransaction* transaction);


Mime
View raw message