WL#3404: new binlog event Insert_id_list_event to store multiple auto_increment intervals

Affects: Server-7.1   —   Status: Un-Assigned

SUMMARY

Add binlog event with list of auto increment numbers to make SBR work.


RATIONALE

Guilhem thinks that this task is a must-do.

Currently, no engine actually reserves multiple autoincrement
intervals for one statement (except NDB, but NDB does not have to work
with SBR), so no present engine needs this task to be done (true as of
2006-10-22).

But if an engine decides to reserve multiple intervals (InnoDB,
Falcon, Solid may want, Maria will), which they can do because the new
storage engine API allows it, SBR will fail.


DESCRIPTION

This is the last part of WL#3146, to be done by the replication team.

In sql/log.cc, MYSQL_LOG::write(), instead of storing in the
statement-based binary log only the minimum of the list of auto_inc
intervals, we need to store the entire list, in a new type of event.

This will then close BUG#18271 (note that currently the testcase of
BUG#18271 passes, you'll need to make it more concurrent to create
problems which only storing the entire list will solve).


BACKGROUND

(From Monty email)

- The new auto_increment interface (WL#3146):

  virtual void get_auto_increment(ulonglong offset, ulonglong increment,
                                  ulonglong nb_desired_values,
                                  ulonglong *first_value,
                                  ulonglong *nb_reserved_values);
  virtual void release_auto_increment() { return; };
  virtual void restore_auto_increment();            (old)
  virtual int reset_auto_increment(ulonglong value) (old)

- get_auto_increment() is used to tell engine that it should reserve
  a set of values for the table. The handler is free to reserve a
  smaller amount of values than what is requested.

  Here follows the documentation for get_auto_increment:

   SYNOPSIS
    get_auto_increment()
    offset
    increment
    nb_desired_values   how many values we want
    first_value         (OUT) the first value reserved by the handler
    nb_reserved_values  (OUT) how many values the handler reserved

  offset and increment means that we want values to be of the form
  offset + N * increment, where N>=0 is integer.
  If the function sets *first_value to ~(ulonglong)0 it means an error.
  If the function sets *nb_reserved_values to ULONGLONG_MAX it means it has
  reserved to "positive infinite".

- release_auto_increment() is called to tell engine that we are done
  with query and it's free to release any not used auto_increment
  values for other usage (if it can do that).


DECISIONS REGARDING THIS WL

- Elliot has decided, after discussing with Monty,
  that WL#3404 will not be done for 5.1; he worries
  about destabilizing 5.1 with new code at this point.
  -- Trudy writes in email to Guilhem, Lars, 2006-08-26
This task is relatively clear, so no need for a very detailed HLS, but
we should add the definition of the new log event here when doing this
work.
-- Lars, 2006-10-22

When implemented, this task will make WL#5872 obsolete.