diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-07-16 19:09:54 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-07-16 19:09:54 +0200 |
commit | 005c7e54214546584c8dc67a746e215f8dbe4b58 (patch) | |
tree | dea50cd7b32808413e058d43d20cf230d1cc7477 /sql/sql_update.cc | |
parent | b9f220b45afaae9b61af29129a8c8ec5f9a7759b (diff) | |
parent | 4f5c10e6b565bc2761b9d083e25c6a36141552a0 (diff) | |
download | mariadb-git-005c7e54214546584c8dc67a746e215f8dbe4b58.tar.gz |
mysql-5.5.32 merge
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 42e12f4cb76..0cedf50e4a2 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2011 Monty Program Ab +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2011, 2013, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -535,7 +535,10 @@ int mysql_update(THD *thd, /* If quick select is used, initialize it before retrieving rows. */ if (select && select->quick && select->quick->reset()) + { + close_cached_file(&tempfile); goto err; + } table->file->try_semi_consistent_read(1); /* @@ -587,13 +590,18 @@ int mysql_update(THD *thd, } else { - table->file->unlock_row(); + /* + Don't try unlocking the row if skip_record reported an error since in + this case the transaction might have been rolled back already. + */ if (error < 0) { /* Fatal error from select->skip_record() */ error= 1; break; } + else + table->file->unlock_row(); } } if (thd->killed && !error) @@ -832,8 +840,17 @@ int mysql_update(THD *thd, } } } - else + /* + Don't try unlocking the row if skip_record reported an error since in + this case the transaction might have been rolled back already. + */ + else if (!thd->is_error()) table->file->unlock_row(); + else + { + error= 1; + break; + } thd->warning_info->inc_current_row_for_warning(); if (thd->is_error()) { |