mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Apply InnoDB snapshot innodb-5.1-2858, part 7.
A follow-up fix for Bug 38839, which exposed a pre-existing bug in the autoinc handling. Detailed revision comments: r2722 | sunny | 2008-10-04 02:48:04 +0300 (Sat, 04 Oct 2008) | 18 lines branches/5.1: This bug has always existed but was masked by other errors. The fix for bug# 38839 triggered this bug. When the offset and increment are > 1 we need to calculate the next value taking into consideration the two variables. Previously we simply assumed they were 1 particularly offset was never used. MySQL does its own calculation and that's probably why it seemed to work in the past. We would return what we thought was the correct next value and then MySQL would recalculate the actual value from that and return it to the caller (e.g., handler::write_row()). Several new tests have been added that try and catch some edge cases. The tests exposed a wrap around error in MySQL next value calculation which was filed as bug 39828. The tests will need to be updated once MySQL fix that bug. One good side effect of this fix is that dict_table_t size has been reduced by 8 bytes because we have moved the autoinc_increment field to the row_prebuilt_t structure. See review-board for a detailed discussion. rb://3
This commit is contained in:
parent
968608efb7
commit
220ee82cb7
7 changed files with 713 additions and 40 deletions
|
|
@ -411,11 +411,6 @@ struct dict_table_struct{
|
|||
SELECT MAX(auto inc column) */
|
||||
ib_ulonglong autoinc;/* autoinc counter value to give to the
|
||||
next inserted row */
|
||||
|
||||
ib_longlong autoinc_increment;
|
||||
/* The increment step of the auto increment
|
||||
column. Value must be greater than or equal
|
||||
to 1 */
|
||||
ulong n_waiting_or_granted_auto_inc_locks;
|
||||
/* This counter is used to track the number
|
||||
of granted and pending autoinc locks on this
|
||||
|
|
@ -425,6 +420,7 @@ struct dict_table_struct{
|
|||
acquired the AUTOINC lock or not. Of course
|
||||
only one transaction can be granted the
|
||||
lock but there can be multiple waiters. */
|
||||
/*----------------------*/
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
ulint magic_n;/* magic number */
|
||||
|
|
|
|||
|
|
@ -683,7 +683,16 @@ struct row_prebuilt_struct {
|
|||
to this heap */
|
||||
mem_heap_t* old_vers_heap; /* memory heap where a previous
|
||||
version is built in consistent read */
|
||||
ulonglong last_value; /* last value of AUTO-INC interval */
|
||||
/*----------------------*/
|
||||
ulonglong autoinc_last_value;/* last value of AUTO-INC interval */
|
||||
ulonglong autoinc_increment;/* The increment step of the auto
|
||||
increment column. Value must be
|
||||
greater than or equal to 1. Required to
|
||||
calculate the next value */
|
||||
ulonglong autoinc_offset; /* The offset passed to
|
||||
get_auto_increment() by MySQL. Required
|
||||
to calculate the next value */
|
||||
/*----------------------*/
|
||||
ulint magic_n2; /* this should be the same as
|
||||
magic_n */
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue