src/gc/transaction_level_gc_manager.cpp
int TransactionLevelGCManager::Reclaim(const int &thread_id, const cid_t &max_cid) {
  int gc_counter = 0;

  // we delete garbage in the free list
  auto garbage_ctx_entry = reclaim_maps_[thread_id].begin();
  while (garbage_ctx_entry != reclaim_maps_[thread_id].end()) {
    const cid_t garbage_ts = garbage_ctx_entry->first;
    auto garbage_ctx = garbage_ctx_entry->second;

    // if the timestamp of the garbage is older than the current max_cid,
    // recycle it
    if (garbage_ts < max_cid) {
      AddToRecycleMap(garbage_ctx);

      // Remove from the original map
      garbage_ctx_entry = reclaim_maps_[thread_id].erase(garbage_ctx_entry);
      gc_counter++;
    } else {
      // Early break since we use an ordered map
      break;
    }
  }
  LOG_TRACE("Marked %d txn contexts as recycled", gc_counter);
  return gc_counter;
}
// executed by a single thread. so no synchronization is required.
executed by a single thread. so no synchronization is required.
executed by a single thread . so no synchronization is required .
int TransactionLevelGCManager::Reclaim(const int &thread_id, const cid_t &max_cid) {
  int gc_counter = 0;
  auto garbage_ctx_entry = reclaim_maps_[thread_id].begin();
  while (garbage_ctx_entry != reclaim_maps_[thread_id].end()) {
    const cid_t garbage_ts = garbage_ctx_entry->first;
    auto garbage_ctx = garbage_ctx_entry->second;
    if (garbage_ts < max_cid) {
      AddToRecycleMap(garbage_ctx);
      garbage_ctx_entry = reclaim_maps_[thread_id].erase(garbage_ctx_entry);
      gc_counter++;
    } else {
      break;
    }
  }
  LOG_TRACE("Marked %d txn contexts as recycled", gc_counter);
  return gc_counter;
}
int TransactionLevelGCManager :: Reclaim ( const int & thread_id , const cid_t & max_cid ) { int gc_counter = 0 ; auto garbage_ctx_entry = reclaim_maps_ [ thread_id ] . begin ( ) ; while ( garbage_ctx_entry != reclaim_maps_ [ thread_id ] . end ( ) ) { const cid_t garbage_ts = garbage_ctx_entry -> first ; auto garbage_ctx = garbage_ctx_entry -> second ; if ( garbage_ts < max_cid ) { AddToRecycleMap ( garbage_ctx ) ; garbage_ctx_entry = reclaim_maps_ [ thread_id ] . erase ( garbage_ctx_entry ) ; gc_counter ++ ; } else { break ; } } LOG_TRACE ( " " , gc_counter ) ; return gc_counter ; }
executed by a single thread.
executed by a single thread .
// we delete garbage in the free list // if the timestamp of the garbage is older than the current max_cid, // recycle it // Remove from the original map // Early break since we use an ordered map