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,7 +3152,15 @@ int handler::update_auto_increment() ...@@ -3152,7 +3152,15 @@ 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); {
/*
It's better to return an error here than getting a confusing
'duplicate key error' later.
*/
result= HA_ERR_AUTOINC_ERANGE;
}
else
{
/* /*
Field refused this value (overflow) and truncated it, use the result Field refused this value (overflow) and truncated it, use the result
of the truncation (which is going to be inserted); however we try to of the truncation (which is going to be inserted); however we try to
...@@ -3165,6 +3173,7 @@ int handler::update_auto_increment() ...@@ -3165,6 +3173,7 @@ int handler::update_auto_increment()
if (unlikely(table->next_number_field->store((longlong)nr, TRUE))) if (unlikely(table->next_number_field->store((longlong)nr, TRUE)))
nr= table->next_number_field->val_int(); nr= table->next_number_field->val_int();
} }
}
if (append) if (append)
{ {
auto_inc_interval_for_cur_row.replace(nr, nb_reserved_values, auto_inc_interval_for_cur_row.replace(nr, nb_reserved_values,
...@@ -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