Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Bug:
  2. https://mariadb.atlassian.net/browse/MDEV-8827
  3. http://bugs.mysql.com/bug.php?id=76872
  4.  
  5. handler.cc:
  6.  
  7. /*
  8. That rounding below should not be needed when all engines actually
  9. respect offset and increment in get_auto_increment(). But they don't
  10. so we still do it. Wonder if for the not-first-in-index we should do
  11. it. Hope that this rounding didn't push us out of the interval; even
  12. if it did we cannot do anything about it (calling the engine again
  13. will not help as we inserted no row).
  14. */
  15. nr= compute_next_insert_id(nr-1, variables);
  16.  
  17. InnoDB change:
  18.  
  19. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
  20. index 2bdbdf7..9a130ad 100644
  21. --- a/storage/innobase/handler/ha_innodb.cc
  22. +++ b/storage/innobase/handler/ha_innodb.cc
  23. @@ -10388,6 +10388,24 @@ static void free_share(INNOBASE_SHARE* share)
  24. return;
  25. }
  26.  
  27. + trx = prebuilt->trx;
  28. +
  29. + /* Called for the first time ? */
  30. + if (trx->n_autoinc_rows == 0 && increment > 1) {
  31. + const ulonglong save = autoinc;
  32. +
  33. + autoinc= (((autoinc + increment - offset)) / increment);
  34. + autoinc = (autoinc* increment + offset);
  35. +
  36. + if (UNIV_UNLIKELY(autoinc < save)) {
  37. + prebuilt->autoinc_last_value = 0;
  38. + dict_table_autoinc_unlock(prebuilt->table);
  39. + *nb_reserved_values = 0;
  40. + *first_value = (~(ulonglong) 0);
  41. + return;
  42. + }
  43. + }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement