diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-03-12 11:14:40 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-03-12 11:14:40 +0100 |
commit | f3190ea61f4a4f419872033d38f20adbfce07251 (patch) | |
tree | cd09da969868b6b89763685e1040bdb0501cb836 /sql/ha_partition.cc | |
parent | 459d04c6398adf681eac2d4a0d008ffadb02c074 (diff) | |
parent | 1f77c7b49a976026522aba4ff766702b7a76346d (diff) | |
download | mariadb-git-f3190ea61f4a4f419872033d38f20adbfce07251.tar.gz |
merged
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e7f74ffa37f..4523d620821 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -6455,9 +6455,22 @@ void ha_partition::release_auto_increment() ulonglong next_auto_inc_val; lock_auto_increment(); next_auto_inc_val= ha_data->next_auto_inc_val; + /* + If the current auto_increment values is lower than the reserved + value, and the reserved value was reserved by this thread, + we can lower the reserved value. + */ if (next_insert_id < next_auto_inc_val && auto_inc_interval_for_cur_row.maximum() >= next_auto_inc_val) - ha_data->next_auto_inc_val= next_insert_id; + { + THD *thd= ha_thd(); + /* + Check that we do not lower the value because of a failed insert + with SET INSERT_ID, i.e. forced/non generated values. + */ + if (thd->auto_inc_intervals_forced.maximum() < next_insert_id) + ha_data->next_auto_inc_val= next_insert_id; + } DBUG_PRINT("info", ("ha_data->next_auto_inc_val: %lu", (ulong) ha_data->next_auto_inc_val)); |