summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authortsmith@ramayana.hindu.god <>2007-08-15 17:20:54 -0600
committertsmith@ramayana.hindu.god <>2007-08-15 17:20:54 -0600
commit5e926bc1204059783375ae23c3fa34b7ad75bc0c (patch)
treecec562a0c69f21f9a3f99e535eddafc7c5dfd1fd /sql/ha_innodb.cc
parente2d64f287853313de92e72a36c79add730b69216 (diff)
downloadmariadb-git-5e926bc1204059783375ae23c3fa34b7ad75bc0c.tar.gz
NULL MERGE this ChangeSet to 5.1
Apply innodb-5.0-ss1696 snapshot Fixes: - Bug#20090: InnoDB: Error: trying to declare trx to enter InnoDB - Bug#23710: crash_commit_before fails if innodb_file_per_table=1 At InnoDB startup consider the case where log scan went beyond checkpoint_lsn as a crash and initiate crash recovery code path. - Bug#28781: InnoDB increments auto-increment value incorrectly with ON DUPLICATE KEY UPDATE We need to do some special AUTOINC handling for the following case: INSERT INTO t (c1,c2) VALUES(x,y) ON DUPLICATE KEY UPDATE ... We need to use the AUTOINC counter that was actually used by MySQL in the UPDATE statement, which can be different from the value used in the INSERT statement. - Bug#29097: fsp_get_available_space_in_free_extents() is capped at 4TB Fix by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". - Bug#29155: Innodb "Parallel recovery" is not prevented Fix by enabling file locking on FreeBSD. It has been disabled because InnoDB has refused to start on FreeBSD & LinuxThreads, but now it starts just fine.
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index f87d47174ac..2d47c42cf1d 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -3301,8 +3301,6 @@ no_commit:
if (error == DB_DUPLICATE_KEY && auto_inc_used
&& (user_thd->lex->sql_command == SQLCOM_REPLACE
|| user_thd->lex->sql_command == SQLCOM_REPLACE_SELECT
- || (user_thd->lex->sql_command == SQLCOM_INSERT
- && user_thd->lex->duplicates == DUP_UPDATE)
|| (user_thd->lex->sql_command == SQLCOM_LOAD
&& user_thd->lex->duplicates == DUP_REPLACE))) {
@@ -3533,6 +3531,27 @@ ha_innobase::update_row(
error = row_update_for_mysql((byte*) old_row, prebuilt);
+ /* We need to do some special AUTOINC handling for the following case:
+
+ INSERT INTO t (c1,c2) VALUES(x,y) ON DUPLICATE KEY UPDATE ...
+
+ We need to use the AUTOINC counter that was actually used by
+ MySQL in the UPDATE statement, which can be different from the
+ value used in the INSERT statement.*/
+ if (error == DB_SUCCESS
+ && table->next_number_field && new_row == table->record[0]
+ && user_thd->lex->sql_command == SQLCOM_INSERT
+ && user_thd->lex->duplicates == DUP_UPDATE) {
+
+ longlong auto_inc;
+
+ auto_inc = table->next_number_field->val_int();
+
+ if (auto_inc != 0) {
+ dict_table_autoinc_update(prebuilt->table, auto_inc);
+ }
+ }
+
innodb_srv_conc_exit_innodb(prebuilt->trx);
error = convert_error_code_to_mysql(error, user_thd);
@@ -5609,9 +5628,9 @@ ha_innobase::update_table_comment(
mutex_enter_noninline(&srv_dict_tmpfile_mutex);
rewind(srv_dict_tmpfile);
- fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB",
- (ulong) fsp_get_available_space_in_free_extents(
- prebuilt->table->space));
+ fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB",
+ fsp_get_available_space_in_free_extents(
+ prebuilt->table->space));
dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile,
prebuilt->trx, prebuilt->table);