You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by na...@apache.org on 2016/06/27 18:51:29 UTC

incubator-quickstep git commit: Remove unused AlwaysCreateBlockInsertDestination

Repository: incubator-quickstep
Updated Branches:
  refs/heads/remove_alwayscreateinsertdest [created] dab473f40


Remove unused AlwaysCreateBlockInsertDestination


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/dab473f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/dab473f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/dab473f4

Branch: refs/heads/remove_alwayscreateinsertdest
Commit: dab473f40f538fb130338b034c642f9dc87d1306
Parents: 714874c
Author: Navneet Potti <na...@gmail.com>
Authored: Mon Jun 27 11:22:47 2016 -0500
Committer: Navneet Potti <na...@gmail.com>
Committed: Mon Jun 27 11:22:47 2016 -0500

----------------------------------------------------------------------
 storage/InsertDestination.cpp | 57 --------------------------------------
 storage/InsertDestination.hpp | 44 -----------------------------
 2 files changed, 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/dab473f4/storage/InsertDestination.cpp
----------------------------------------------------------------------
diff --git a/storage/InsertDestination.cpp b/storage/InsertDestination.cpp
index 2866c5f..2ed3aa3 100644
--- a/storage/InsertDestination.cpp
+++ b/storage/InsertDestination.cpp
@@ -92,15 +92,6 @@ InsertDestination* InsertDestination::ReconstructFromProto(
   }
 
   switch (proto.insert_destination_type()) {
-    case serialization::InsertDestinationType::ALWAYS_CREATE_BLOCK: {
-      return new AlwaysCreateBlockInsertDestination(relation,
-                                                    layout,
-                                                    storage_manager,
-                                                    proto.relational_op_index(),
-                                                    query_id,
-                                                    scheduler_client_id,
-                                                    bus);
-    }
     case serialization::InsertDestinationType::BLOCK_POOL: {
       vector<block_id> blocks;
       for (int i = 0; i < proto.ExtensionSize(serialization::BlockPoolInsertDestination::blocks); ++i) {
@@ -262,54 +253,6 @@ void InsertDestination::insertTuplesFromVector(std::vector<Tuple>::const_iterato
   returnBlock(std::move(dest_block), false);
 }
 
-MutableBlockReference AlwaysCreateBlockInsertDestination::createNewBlock() {
-  const block_id new_id = storage_manager_->createBlock(relation_, *layout_);
-
-  // Notify Foreman to add the newly created block id in the master Catalog.
-  serialization::CatalogRelationNewBlockMessage proto;
-  proto.set_relation_id(relation_.getID());
-  proto.set_block_id(new_id);
-  proto.set_query_id(getQueryID());
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage tagged_msg(static_cast<const void *>(proto_bytes),
-                           proto_length,
-                           kCatalogRelationNewBlockMessage);
-  free(proto_bytes);
-
-  const tmb::MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         thread_id_map_.getValue(),
-                                         scheduler_client_id_,
-                                         move(tagged_msg));
-  CHECK(send_status == tmb::MessageBus::SendStatus::kOK)
-      << "CatalogRelationNewBlockMessage could not be sent from InsertDestination to Foreman.";
-
-  return storage_manager_->getBlockMutable(new_id, relation_);
-}
-
-MutableBlockReference AlwaysCreateBlockInsertDestination::getBlockForInsertion() {
-  SpinMutexLock lock(mutex_);
-  return createNewBlock();
-}
-
-void AlwaysCreateBlockInsertDestination::returnBlock(MutableBlockReference &&block, const bool full) {
-  {
-    SpinMutexLock lock(mutex_);
-    returned_block_ids_.push_back(block->getID());
-  }
-  if (!block->rebuild()) {
-    LOG_WARNING("Rebuilding of StorageBlock with ID: " << block->getID() <<
-                "invalidated one or more IndexSubBlocks.");
-  }
-  // Due to the nature of this InsertDestination, a block will always be
-  // streamed no matter if it's full or not.
-  sendBlockFilledMessage(block->getID());
-}
-
 MutableBlockReference BlockPoolInsertDestination::createNewBlock() {
   const block_id new_id = storage_manager_->createBlock(relation_, *layout_);
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/dab473f4/storage/InsertDestination.hpp
----------------------------------------------------------------------
diff --git a/storage/InsertDestination.hpp b/storage/InsertDestination.hpp
index 5ff33f5..772d250 100644
--- a/storage/InsertDestination.hpp
+++ b/storage/InsertDestination.hpp
@@ -290,50 +290,6 @@ class InsertDestination : public InsertDestinationInterface {
 };
 
 /**
- * @brief Implementation of InsertDestination that always creates new blocks,
- *        leaving some blocks potentially very underfull.
- **/
-class AlwaysCreateBlockInsertDestination : public InsertDestination {
- public:
-  AlwaysCreateBlockInsertDestination(const CatalogRelationSchema &relation,
-                                     const StorageBlockLayout *layout,
-                                     StorageManager *storage_manager,
-                                     const std::size_t relational_op_index,
-                                     const std::size_t query_id,
-                                     const tmb::client_id scheduler_client_id,
-                                     tmb::MessageBus *bus)
-      : InsertDestination(relation,
-                          layout,
-                          storage_manager,
-                          relational_op_index,
-                          query_id,
-                          scheduler_client_id,
-                          bus) {}
-
-  ~AlwaysCreateBlockInsertDestination() override {
-  }
-
- protected:
-  MutableBlockReference getBlockForInsertion() override;
-
-  void returnBlock(MutableBlockReference &&block, const bool full) override;
-
-  MutableBlockReference createNewBlock() override;
-
-  const std::vector<block_id>& getTouchedBlocksInternal() override {
-    return returned_block_ids_;
-  }
-
-  void getPartiallyFilledBlocks(std::vector<MutableBlockReference> *partial_blocks) override {
-  }
-
- private:
-  std::vector<block_id> returned_block_ids_;
-
-  DISALLOW_COPY_AND_ASSIGN(AlwaysCreateBlockInsertDestination);
-};
-
-/**
  * @brief Implementation of InsertDestination that keeps a pool of
  *        partially-full blocks. Creates new blocks as necessary when
  *        getBlockForInsertion() is called and there are no partially-full