Commit 5a87e3ee authored by Jan Lindström's avatar Jan Lindström

Revert offending part of MDEV-9519: Data corruption will happen on the Galera cluster size change

This will allow test binlog.binlog_stm_binlog to pass more often.
Note that this is not a real fix to that test failure.
parent 243f829c
...@@ -3016,7 +3016,7 @@ int handler::update_auto_increment() ...@@ -3016,7 +3016,7 @@ int handler::update_auto_increment()
bool append= FALSE; bool append= FALSE;
THD *thd= table->in_use; THD *thd= table->in_use;
struct system_variables *variables= &thd->variables; struct system_variables *variables= &thd->variables;
int tmp; int result=0, tmp;
enum enum_check_fields save_count_cuted_fields; enum enum_check_fields save_count_cuted_fields;
DBUG_ENTER("handler::update_auto_increment"); DBUG_ENTER("handler::update_auto_increment");
...@@ -3152,18 +3152,27 @@ int handler::update_auto_increment() ...@@ -3152,18 +3152,27 @@ int handler::update_auto_increment()
*/ */
if (thd->killed == KILL_BAD_DATA || if (thd->killed == KILL_BAD_DATA ||
nr > table->next_number_field->get_max_int_value()) nr > table->next_number_field->get_max_int_value())
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); {
/* /*
Field refused this value (overflow) and truncated it, use the result It's better to return an error here than getting a confusing
of the truncation (which is going to be inserted); however we try to 'duplicate key error' later.
decrease it to honour auto_increment_* variables. */
That will shift the left bound of the reserved interval, we don't result= HA_ERR_AUTOINC_ERANGE;
bother shifting the right bound (anyway any other value from this }
interval will cause a duplicate key). else
*/ {
nr= prev_insert_id(table->next_number_field->val_int(), variables); /*
if (unlikely(table->next_number_field->store((longlong)nr, TRUE))) Field refused this value (overflow) and truncated it, use the result
nr= table->next_number_field->val_int(); of the truncation (which is going to be inserted); however we try to
decrease it to honour auto_increment_* variables.
That will shift the left bound of the reserved interval, we don't
bother shifting the right bound (anyway any other value from this
interval will cause a duplicate key).
*/
nr= prev_insert_id(table->next_number_field->val_int(), variables);
if (unlikely(table->next_number_field->store((longlong)nr, TRUE)))
nr= table->next_number_field->val_int();
}
} }
if (append) if (append)
{ {
...@@ -3188,6 +3197,9 @@ int handler::update_auto_increment() ...@@ -3188,6 +3197,9 @@ int handler::update_auto_increment()
*/ */
insert_id_for_cur_row= nr; insert_id_for_cur_row= nr;
if (result) // overflow
DBUG_RETURN(result);
/* /*
Set next insert id to point to next auto-increment value to be able to Set next insert id to point to next auto-increment value to be able to
handle multi-row statements. handle multi-row statements.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment