src/backend/gc/gc_manager.cpp
// Get the number of tuples refurbished in a tile group in a table
Get the number of tuples refurbished in a tile group in a table
Get the number of tuples refurbished in a tile group in a table
size_t GCManager::GetRefurbishedTupleSlotCountPerTileGroup(
    const oid_t &table_id, const oid_t &tile_group_id) {
  if (this->gc_type_ == GC_TYPE_OFF) {
    return 0;
  }
  size_t count = 0;
  {
    std::lock_guard<std::mutex> lock(free_map_mutex);
    std::pair<size_t, std::shared_ptr<LockfreeQueue<TupleMetadata>>> free_list;
    if (free_map_.find(table_id, free_list)) {
      size_t size = free_list.first;
      for (unsigned i = 0; i < size; ++i) {
        TupleMetadata tuple_metadata;
        if (free_list.second->TryPop(tuple_metadata)) {
          if (tuple_metadata.tile_group_id == tile_group_id) {
            count++;
          }
          free_list.second->TryPush(tuple_metadata);
        }
      }
    }
  }
  return count;
}
size_t GCManager :: GetRefurbishedTupleSlotCountPerTileGroup ( const oid_t & table_id , const oid_t & tile_group_id ) { if ( this -> gc_type_ == GC_TYPE_OFF ) { return 0 ; } size_t count = 0 ; { std :: lock_guard < std :: mutex > lock ( free_map_mutex ) ; std :: pair < size_t , std :: shared_ptr < LockfreeQueue < TupleMetadata > > > free_list ; if ( free_map_ . find ( table_id , free_list ) ) { size_t size = free_list . first ; for ( unsigned i = 0 ; i < size ; ++ i ) { TupleMetadata tuple_metadata ; if ( free_list . second -> TryPop ( tuple_metadata ) ) { if ( tuple_metadata . tile_group_id == tile_group_id ) { count ++ ; } free_list . second -> TryPush ( tuple_metadata ) ; } } } } return count ; }
Get the number of tuples refurbished in a tile group in a table
Get the number of tuples refurbished in a tile group in a table
// if GC mode is off, return 0 // if there exists free_list for this table // iterate over the free list // pop the queue and then later push it back // check whether the tuple belongs to this tile group