diff options
author | unknown <aelkin/elkin@andrepl.(none)> | 2007-03-23 17:12:58 +0200 |
---|---|---|
committer | unknown <aelkin/elkin@andrepl.(none)> | 2007-03-23 17:12:58 +0200 |
commit | 4a76ac5fa6e844c78ec565c2e15ac88f0bb9a8a6 (patch) | |
tree | 69b3937c478753aaf68e93fe328ccf451a4ab2f6 /sql/sql_update.cc | |
parent | b444f808828e42b64cdd4fa8bc9e901b1ae6e119 (diff) | |
download | mariadb-git-4a76ac5fa6e844c78ec565c2e15ac88f0bb9a8a6.tar.gz |
Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit was not restored at the end of SF() invocation, where
SF() modified non-ta table.
As the result of this artifact it was not possible to detect whether there were any side-effects when
top-level query ends.
If the top level query table was not modified and the bit is lost there would be no binlogging.
Fixed with preserving the bit inside of thd->no_trans_update struct. The struct agregates two bool flags
telling whether the current query and the current transaction modified any non-ta table.
The flags stmt, all are dropped at the end of the query and the transaction.
mysql-test/r/sp_trans.result:
results will be changed once again after bug#23333 will be fixed.
mysql-test/t/sp_trans.test:
regression test added
sql/ha_ndbcluster.cc:
replacing thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit and bool thd->no_trans_update
with thd->no_trans_update as struct
sql/handler.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/log.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/set_var.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sp_head.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_class.h:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_delete.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_insert.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_load.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_parse.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_table.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_update.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 27d38114885..860d00b5bdd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -429,7 +429,7 @@ int mysql_update(THD *thd, query_id=thd->query_id; transactional_table= table->file->has_transactions(); - thd->no_trans_update= 0; + thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= test(!ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | @@ -452,7 +452,7 @@ int mysql_update(THD *thd, if (fill_record_n_invoke_before_triggers(thd, fields, values, 0, table->triggers, TRG_EVENT_UPDATE)) - break; /* purecov: inspected */ + break; /* purecov: inspected */ found++; @@ -470,12 +470,12 @@ int mysql_update(THD *thd, break; } } - if (!(error=table->file->update_row((byte*) table->record[1], - (byte*) table->record[0]))) - { - updated++; - thd->no_trans_update= !transactional_table; - + if (!(error=table->file->update_row((byte*) table->record[1], + (byte*) table->record[0]))) + { + updated++; + thd->no_trans_update.stmt= !transactional_table; + if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)) @@ -483,25 +483,25 @@ int mysql_update(THD *thd, error= 1; break; } - } - else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY) - { + } + else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY) + { /* If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to do anything; otherwise... */ if (error != HA_ERR_FOUND_DUPP_KEY) thd->fatal_error(); /* Other handler errors are fatal */ - table->file->print_error(error,MYF(0)); - error= 1; - break; - } + table->file->print_error(error,MYF(0)); + error= 1; + break; + } } - + if (!--limit && using_limit) { - error= -1; // Simulate end of file - break; + error= -1; // Simulate end of file + break; } } else @@ -546,7 +546,7 @@ int mysql_update(THD *thd, error=1; // Rollback update } if (!transactional_table) - thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; + thd->no_trans_update.all= TRUE; } free_underlaid_joins(thd, select_lex); if (transactional_table) @@ -910,7 +910,7 @@ bool mysql_multi_update(THD *thd, handle_duplicates, ignore))) DBUG_RETURN(TRUE); - thd->no_trans_update= 0; + thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= test(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); @@ -1224,7 +1224,7 @@ multi_update::~multi_update() delete [] copy_field; thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting if (!trans_safe) - thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; + thd->no_trans_update.all= TRUE; } @@ -1311,7 +1311,7 @@ bool multi_update::send_data(List<Item> ¬_used_values) else { if (!table->file->has_transactions()) - thd->no_trans_update= 1; + thd->no_trans_update.stmt= TRUE; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)) @@ -1541,10 +1541,10 @@ bool multi_update::send_eof() Query_log_event qinfo(thd, thd->query, thd->query_length, transactional_tables, FALSE); if (mysql_bin_log.write(&qinfo) && trans_safe) - local_error= 1; // Rollback update + local_error= 1; // Rollback update } if (!transactional_tables) - thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; + thd->no_trans_update.all= TRUE; } if (transactional_tables) |