Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/25#discussion_r66700345
  
    --- Diff: storage/InsertDestination.cpp ---
    @@ -339,21 +339,20 @@ void 
BlockPoolInsertDestination::getPartiallyFilledBlocks(std::vector<MutableBlo
     }
     
     MutableBlockReference BlockPoolInsertDestination::getBlockForInsertion() {
    -  SpinMutexLock lock(mutex_);
    -  if (available_block_refs_.empty()) {
    -    if (available_block_ids_.empty()) {
    -      return createNewBlock();
    -    } else {
    +  {
    +    SpinMutexLock lock(mutex_);
    +    if (!available_block_refs_.empty()) {
    +      MutableBlockReference retval = 
std::move(available_block_refs_.back());
    +      available_block_refs_.pop_back();
    +      return retval;
    +    } else if (!available_block_ids_.empty()) {
           const block_id id = available_block_ids_.back();
           available_block_ids_.pop_back();
           MutableBlockReference retval = storage_manager_->getBlockMutable(id, 
relation_);
           return retval;
         }
    -  } else {
    -    MutableBlockReference retval = std::move(available_block_refs_.back());
    -    available_block_refs_.pop_back();
    -    return retval;
    -  }
    +  } // release mutex_ lock
    --- End diff --
    
    For this comment, we would need one more whitespace indentation.
    
    ```
      ++i;  // Comment.
    ```
    
    On the other hand, we actually don't need this comment, as it is obvious 
that the scoped lock automatically releases. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to