Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bug:
- https://mariadb.atlassian.net/browse/MDEV-8827
- http://bugs.mysql.com/bug.php?id=76872
- handler.cc:
- /*
- That rounding below should not be needed when all engines actually
- respect offset and increment in get_auto_increment(). But they don't
- so we still do it. Wonder if for the not-first-in-index we should do
- it. Hope that this rounding didn't push us out of the interval; even
- if it did we cannot do anything about it (calling the engine again
- will not help as we inserted no row).
- */
- nr= compute_next_insert_id(nr-1, variables);
- InnoDB change:
- diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
- index 2bdbdf7..9a130ad 100644
- --- a/storage/innobase/handler/ha_innodb.cc
- +++ b/storage/innobase/handler/ha_innodb.cc
- @@ -10388,6 +10388,24 @@ static void free_share(INNOBASE_SHARE* share)
- return;
- }
- + trx = prebuilt->trx;
- +
- + /* Called for the first time ? */
- + if (trx->n_autoinc_rows == 0 && increment > 1) {
- + const ulonglong save = autoinc;
- +
- + autoinc= (((autoinc + increment - offset)) / increment);
- + autoinc = (autoinc* increment + offset);
- +
- + if (UNIV_UNLIKELY(autoinc < save)) {
- + prebuilt->autoinc_last_value = 0;
- + dict_table_autoinc_unlock(prebuilt->table);
- + *nb_reserved_values = 0;
- + *first_value = (~(ulonglong) 0);
- + return;
- + }
- + }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement