Commit e89155b3 authored by sunny's avatar sunny

Bug fix: The problem was that when write_row() attempted to update the max

autoinc value, and if it was rolled back because of a deadlock, the 
deadlock error (transaction rollback) was not being propagated back to MySQL.
parent 1a4b717f
...@@ -3495,6 +3495,7 @@ ha_innobase::write_row( ...@@ -3495,6 +3495,7 @@ ha_innobase::write_row(
/* Handle duplicate key errors */ /* Handle duplicate key errors */
if (auto_inc_used) { if (auto_inc_used) {
ulint err;
ulonglong auto_inc; ulonglong auto_inc;
/* Note the number of rows processed for this statement, used /* Note the number of rows processed for this statement, used
...@@ -3548,7 +3549,11 @@ ha_innobase::write_row( ...@@ -3548,7 +3549,11 @@ ha_innobase::write_row(
ut_a(prebuilt->table->autoinc_increment > 0); ut_a(prebuilt->table->autoinc_increment > 0);
auto_inc += prebuilt->table->autoinc_increment; auto_inc += prebuilt->table->autoinc_increment;
innobase_set_max_autoinc(auto_inc); err = innobase_set_max_autoinc(auto_inc);
if (err != DB_SUCCESS) {
error = err;
}
} }
break; break;
} }
...@@ -3784,7 +3789,7 @@ ha_innobase::update_row( ...@@ -3784,7 +3789,7 @@ ha_innobase::update_row(
if (auto_inc != 0) { if (auto_inc != 0) {
auto_inc += prebuilt->table->autoinc_increment; auto_inc += prebuilt->table->autoinc_increment;
innobase_set_max_autoinc(auto_inc); error = innobase_set_max_autoinc(auto_inc);
} }
} }
......
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