src/backend/storage/tile_group.cpp
/**
 * Grab next slot (thread-safe) and fill in the tuple
 *
 * Returns slot where inserted (INVALID_ID if not inserted)
 */
Grab next slot (thread-safe) and fill in the tuple
Returns slot where inserted (INVALID_ID if not inserted)
Grab next slot ( thread - safe ) and fill in the tuple Returns slot where inserted ( INVALID_ID if not inserted )
oid_t TileGroup::InsertTuple(const Tuple *tuple) {
  oid_t tuple_slot_id = tile_group_header->GetNextEmptyTupleSlot();
  LOG_TRACE("Tile Group Id :: %u status :: %u out of %u slots ",
            tile_group_id, tuple_slot_id, num_tuple_slots);
  if (tuple_slot_id == INVALID_OID) {
    LOG_WARN("Failed to get next empty tuple slot within tile group.");
    return INVALID_OID;
  }
  oid_t tile_column_count;
  oid_t column_itr = 0;
  for (oid_t tile_itr = 0; tile_itr < tile_count; tile_itr++) {
    const catalog::Schema &schema = tile_schemas[tile_itr];
    tile_column_count = schema.GetColumnCount();
    storage::Tile *tile = GetTile(tile_itr);
    assert(tile);
    char *tile_tuple_location = tile->GetTupleLocation(tuple_slot_id);
    assert(tile_tuple_location);
    storage::Tuple tile_tuple(&schema, tile_tuple_location);
    for (oid_t tile_column_itr = 0; tile_column_itr < tile_column_count;
         tile_column_itr++) {
      tile_tuple.SetValue(tile_column_itr, tuple->GetValue(column_itr),
                          tile->GetPool());
      column_itr++;
    }
  }
  assert(tile_group_header->GetTransactionId(tuple_slot_id) == INVALID_TXN_ID);
  assert(tile_group_header->GetBeginCommitId(tuple_slot_id) == MAX_CID);
  assert(tile_group_header->GetEndCommitId(tuple_slot_id) == MAX_CID);
  return tuple_slot_id;
}
oid_t TileGroup :: InsertTuple ( const Tuple * tuple ) { oid_t tuple_slot_id = tile_group_header -> GetNextEmptyTupleSlot ( ) ; LOG_TRACE ( " " , tile_group_id , tuple_slot_id , num_tuple_slots ) ; if ( tuple_slot_id == INVALID_OID ) { LOG_WARN ( " " ) ; return INVALID_OID ; } oid_t tile_column_count ; oid_t column_itr = 0 ; for ( oid_t tile_itr = 0 ; tile_itr < tile_count ; tile_itr ++ ) { const catalog :: Schema & schema = tile_schemas [ tile_itr ] ; tile_column_count = schema . GetColumnCount ( ) ; storage :: Tile * tile = GetTile ( tile_itr ) ; assert ( tile ) ; char * tile_tuple_location = tile -> GetTupleLocation ( tuple_slot_id ) ; assert ( tile_tuple_location ) ; storage :: Tuple tile_tuple ( & schema , tile_tuple_location ) ; for ( oid_t tile_column_itr = 0 ; tile_column_itr < tile_column_count ; tile_column_itr ++ ) { tile_tuple . SetValue ( tile_column_itr , tuple -> GetValue ( column_itr ) , tile -> GetPool ( ) ) ; column_itr ++ ; } } assert ( tile_group_header -> GetTransactionId ( tuple_slot_id ) == INVALID_TXN_ID ) ; assert ( tile_group_header -> GetBeginCommitId ( tuple_slot_id ) == MAX_CID ) ; assert ( tile_group_header -> GetEndCommitId ( tuple_slot_id ) == MAX_CID ) ; return tuple_slot_id ; }
Grab next slot (thread-safe) and fill in the tuple
 Returns slot where inserted (INVALID_ID if not inserted)
Grab next slot ( thread - safe ) and fill in the tuple Returns slot where inserted ( INVALID_ID if not inserted )
// No more slots // NOTE:: Only a tuple wrapper //  // Set MVCC info