• unknown's avatar
    Fix for BUG#20524 "auto_increment_* not observed when inserting · 8646be88
    unknown authored
    a too large value": the bug was that if MySQL generated a value for an
    auto_increment column, based on auto_increment_* variables, and this value
    was bigger than the column's max possible value, then that max possible
    value was inserted (after issuing a warning). But this didn't honour
    auto_increment_* variables (and so could cause conflicts in a master-master
    replication where one master is supposed to generated only even numbers,
    and the other only odd numbers), so now we "round down" this max possible
    value to honour auto_increment_* variables, before inserting it.
    
    
    mysql-test/r/rpl_auto_increment.result:
      result update. Before the fix, the result was that master inserted 127 in t1
      (which didn't honour auto_increment_* variables!),
      instead of failing with "duplicate key 125" like now.
    mysql-test/t/rpl_auto_increment.test:
      Test for BUG#20524 "auto_increment_* not observed when inserting
      a too large value".
      We also check the pathological case (table t2) where it's impossible to
      "round down".
      The fixer of BUG#20573 will be able to use table t2 for testing his fix.
    sql/handler.cc:
      If handler::update_auto_increment() generates a value larger than the field's
      max possible value, we used to simply insert this max possible value
      (after pushing a warning). Now we "round down" this max possible value to
      honour auto_increment_* variables (if at all possible), before trying the
      insertion.
    8646be88
handler.cc 74.7 KB