diff options
author | heikki@hundin.mysql.fi <> | 2003-05-26 19:10:43 +0300 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2003-05-26 19:10:43 +0300 |
commit | b8e5b65f887589b5ef676578cbeee91cea3e68fe (patch) | |
tree | 1350dc4877b9878316638fceb4a88709e7cda9d7 /sql/sql_update.cc | |
parent | 31d0d44919eebfc5f83fe82ae38312f13541144a (diff) | |
download | mariadb-git-b8e5b65f887589b5ef676578cbeee91cea3e68fe.tar.gz |
ha_innodb.cc:
Remove accidenatlly committed debug printfs when query cache is used
sql_update.cc, sql_load.cc, sql_insert.cc, sql_delete.cc:
For the transactional query cache algorithm to work we must invalidate the query cache in INSERT/DELETE/UPDATE before writing to the binlog or calling ha_autocommit_... Note that binlog writing may also call commit. The crucial thing is that the transaction which modified data must not be committed BEFORE the query cache is invalidated.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 9d4d7ccbbab..62fcb02163d 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -332,6 +332,21 @@ int mysql_update(THD *thd, free_io_cache(table); // If ORDER BY thd->proc_info="end"; VOID(table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY)); + + /* + Invalidate the table in the query cache if something changed. + This must be before binlog writing and ha_autocommit_... + */ + if (updated) + { + query_cache_invalidate3(thd, table_list, 1); + } + if (thd->lock) + { + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; + } + transactional_table= table->file->has_transactions(); log_delayed= (transactional_table || table->tmp_table); if (updated && (error <= 0 || !transactional_table)) @@ -353,20 +368,6 @@ int mysql_update(THD *thd, error=1; } - /* - Store table for future invalidation or invalidate it in - the query cache if something changed - */ - if (updated) - { - query_cache_invalidate3(thd, table_list, 1); - } - if (thd->lock) - { - mysql_unlock_tables(thd, thd->lock); - thd->lock=0; - } - delete select; free_underlaid_joins(thd, &thd->lex.select_lex); if (error >= 0) @@ -950,6 +951,14 @@ bool multi_update::send_eof() int local_error = (table_count) ? do_updates(0) : 0; thd->proc_info= "end"; + /* We must invalidate the query cache before binlog writing and + ha_autocommit_... */ + + if (updated) + { + query_cache_invalidate3(thd, update_tables, 1); + } + /* Write the SQL statement to the binlog if we updated rows and we succeeded or if we updated some non @@ -988,10 +997,6 @@ bool multi_update::send_eof() sprintf(buff,ER(ER_UPDATE_INFO), (long) found, (long) updated, (long) thd->cuted_fields); - if (updated) - { - query_cache_invalidate3(thd, update_tables, 1); - } ::send_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated, thd->insert_id_used ? thd->insert_id() : 0L,buff); |