~patrick-crews/drizzle/qp-merge2

« back to all changes in this revision

Viewing changes to drizzled/cursor.cc

  • Committer: Patrick Crews
  • Date: 2012-02-20 22:04:21 UTC
  • mfrom: (2483.1.30 drizzle)
  • Revision ID: gleebix@gmail.com-20120220220421-9a77n2wnglo211r0
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
372
372
    values we have not used. If yes, we pick the smallest one and use it.
373
373
    Otherwise:
374
374
 
375
 
  - If a list of intervals has been provided to the statement via SET
376
 
    INSERT_ID or via an Intvar_log_event (in a replication slave), we pick the
377
 
    first unused interval from this list, consider it as reserved.
378
 
 
379
375
  - Otherwise we set the column for the first row to the value
380
376
    next_insert_id(get_auto_increment(column))) which is usually
381
377
    max-used-column-value+1.
389
385
    we either take the next provided interval or call get_auto_increment()
390
386
    again to reserve a new interval.
391
387
 
392
 
  - In both cases, the reserved intervals are remembered in
393
 
    session->auto_inc_intervals_in_cur_stmt_for_binlog if statement-based
394
 
    binlogging; the last reserved interval is remembered in
 
388
  - the last reserved interval is remembered in
395
389
    auto_inc_interval_for_cur_row.
396
390
 
397
391
    The idea is that generated auto_increment values are predictable and
407
401
    with a value, session->next_insert_id is filled with the value to use for the
408
402
    next row, if a value was autogenerated for the current row it is stored in
409
403
    session->insert_id_for_cur_row, if get_auto_increment() was called
410
 
    session->auto_inc_interval_for_cur_row is modified, if that interval is not
411
 
    present in session->auto_inc_intervals_in_cur_stmt_for_binlog it is added to
412
 
    this list.
 
404
    session->auto_inc_interval_for_cur_row is modified.
413
405
 
414
406
  @todo
415
407
    Replace all references to "next number" or NEXT_NUMBER to
1222
1214
  return error ?  error : error1;
1223
1215
}
1224
1216
 
1225
 
/**
1226
 
  Check if the conditions for row-based binlogging is correct for the table.
1227
 
 
1228
 
  A row in the given table should be replicated if:
1229
 
  - It is not a temporary table
1230
 
*/
1231
 
 
1232
1217
static bool log_row_for_replication(Table* table,
1233
1218
                                    const unsigned char *before_record,
1234
1219
                                    const unsigned char *after_record)
1444
1429
  }
1445
1430
 
1446
1431
  if (unlikely(log_row_for_replication(getTable(), NULL, buf)))
1447
 
    return HA_ERR_RBR_LOGGING_FAILED;
 
1432
    return HA_ERR_LOG_ROW_FOR_REPLICATION_FAILED;
1448
1433
 
1449
1434
  return 0;
1450
1435
}
1490
1475
  }
1491
1476
 
1492
1477
  if (unlikely(log_row_for_replication(getTable(), old_data, new_data)))
1493
 
    return HA_ERR_RBR_LOGGING_FAILED;
 
1478
    return HA_ERR_LOG_ROW_FOR_REPLICATION_FAILED;
1494
1479
 
1495
1480
  return 0;
1496
1481
}
1526
1511
    return error;
1527
1512
 
1528
1513
  if (unlikely(log_row_for_replication(getTable(), buf, NULL)))
1529
 
    return HA_ERR_RBR_LOGGING_FAILED;
 
1514
    return HA_ERR_LOG_ROW_FOR_REPLICATION_FAILED;
1530
1515
 
1531
1516
  return 0;
1532
1517
}