summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-09-08 18:38:13 +0200
committerSergei Golubchik <sergii@pisem.net>2014-09-08 18:38:13 +0200
commit6b720ae4cb76228accc32c91c2c59eb3aa53b259 (patch)
treefc24adbadda74ba67ba3af42bf32c0b17e156602 /sql/ha_partition.cc
parent8deb9066e230f8cba682d15ff4a05e543ed7ac23 (diff)
downloadmariadb-git-6b720ae4cb76228accc32c91c2c59eb3aa53b259.tar.gz
MDEV-6605 Multiple Clients Inserting Causing Error: Failed to read auto-increment value from storage engine
* handler::get_auto_increment() was not expecting any errors from the storage engine. That was wrong, errors could happen. * ha_partition::get_auto_increment() was doing index lookups in partition under a mutex. This was redundant (engine transaction isolation was covering that anyway) and harmful (causing deadlocks).
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index ab4afc03fac..15fa7d12b16 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -7854,8 +7854,7 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong first_value_part, max_first_value;
handler **file= m_file;
first_value_part= max_first_value= *first_value;
- /* Must lock and find highest value among all partitions. */
- lock_auto_increment();
+ /* Must find highest value among all partitions. */
do
{
/* Only nb_desired_values = 1 makes sense */
@@ -7866,7 +7865,6 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
*first_value= first_value_part;
/* log that the error was between table/partition handler */
sql_print_error("Partition failed to reserve auto_increment value");
- unlock_auto_increment();
DBUG_VOID_RETURN;
}
DBUG_PRINT("info", ("first_value_part: %lu", (ulong) first_value_part));
@@ -7874,7 +7872,6 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
} while (*(++file));
*first_value= max_first_value;
*nb_reserved_values= 1;
- unlock_auto_increment();
}
else
{