src/backend/gc/gc_manager.cpp
// Moves tuples from the possibly free list to the actually free list for the
// corresponding table and updates the mapping from the table id to the table's
// free list
Moves tuples from the possibly free list to the actually free list for the
corresponding table and updates the mapping from the table id to the table's
free list
Moves tuples from the possibly free list to the actually free list for the corresponding table and updates the mapping from the table id to the table ' s free list
void GCManager::RefurbishTuple(TupleMetadata tuple_metadata) {
  auto &manager = catalog::Manager::GetInstance();
  auto tile_group_header =
      manager.GetTileGroup(tuple_metadata.tile_group_id)->GetHeader();
  tile_group_header->SetTransactionId(tuple_metadata.tuple_slot_id,
                                      INVALID_TXN_ID);
  tile_group_header->SetBeginCommitId(tuple_metadata.tuple_slot_id, MAX_CID);
  tile_group_header->SetEndCommitId(tuple_metadata.tuple_slot_id, MAX_CID);
  std::pair<size_t, std::shared_ptr<LockfreeQueue<TupleMetadata>>> free_list;
  if (free_map_.find(tuple_metadata.table_id, free_list) == true) {
    free_map_.erase(tuple_metadata.table_id);
    free_list.second->TryPush(tuple_metadata);
    free_list.first = free_list.first + 1;
  } else {
    free_list.second.reset(new LockfreeQueue<TupleMetadata>(max_tuples_per_gc));
    free_list.second->TryPush(tuple_metadata);
    free_list.first = 1;
  }
  free_map_[tuple_metadata.table_id] = free_list;
}
void GCManager :: RefurbishTuple ( TupleMetadata tuple_metadata ) { auto & manager = catalog :: Manager :: GetInstance ( ) ; auto tile_group_header = manager . GetTileGroup ( tuple_metadata . tile_group_id ) -> GetHeader ( ) ; tile_group_header -> SetTransactionId ( tuple_metadata . tuple_slot_id , INVALID_TXN_ID ) ; tile_group_header -> SetBeginCommitId ( tuple_metadata . tuple_slot_id , MAX_CID ) ; tile_group_header -> SetEndCommitId ( tuple_metadata . tuple_slot_id , MAX_CID ) ; std :: pair < size_t , std :: shared_ptr < LockfreeQueue < TupleMetadata > > > free_list ; if ( free_map_ . find ( tuple_metadata . table_id , free_list ) == true ) { free_map_ . erase ( tuple_metadata . table_id ) ; free_list . second -> TryPush ( tuple_metadata ) ; free_list . first = free_list . first + 1 ; } else { free_list . second . reset ( new LockfreeQueue < TupleMetadata > ( max_tuples_per_gc ) ) ; free_list . second -> TryPush ( tuple_metadata ) ; free_list . first = 1 ; } free_map_ [ tuple_metadata . table_id ] = free_list ; }
Moves tuples from the possibly free list to the actually free list for the
corresponding table and updates the mapping from the table id to the table's
free list
Moves tuples from the possibly free list to the actually free list for the corresponding table and updates the mapping from the table id to the table ' s free list
// Set the values for the tuple slot such that when this // can be returned by ReturnFreeSlow and used as a new tuple slot // by the calling function // if the entry for table_id exists. // if the entry for tuple_metadata.table_id exists. // update the free list and its size // if the entry for tuple_metadata.table_id does not exist // create a new free list and initialize its size // Update the map corresponding to the table to now have // the updates list