diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-05-26 19:10:43 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-05-26 19:10:43 +0300 |
commit | cf381ae46b639a9f928a706e7268214aac8b5b48 (patch) | |
tree | 1350dc4877b9878316638fceb4a88709e7cda9d7 /sql/sql_insert.cc | |
parent | 720584b0c6eb435fa87b5da42578f214d83735d1 (diff) | |
download | mariadb-git-cf381ae46b639a9f928a706e7268214aac8b5b48.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.
sql/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.
sql/sql_insert.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.
sql/sql_load.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.
sql/sql_update.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.
sql/ha_innodb.cc:
Remove accidenatlly committed debug printfs when query cache is used
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9be0270947a..48cc6d4e254 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -344,7 +344,18 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, else if (table->next_number_field) id=table->next_number_field->val_int(); // Return auto_increment value + /* + Invalidate the table in the query cache if something changed. + For the transactional algorithm to work the invalidation must be + before binlog writing and ha_autocommit_... + */ + if (info.copied || info.deleted) + { + query_cache_invalidate3(thd, table_list, 1); + } + transactional_table= table->file->has_transactions(); + log_delayed= (transactional_table || table->tmp_table); if ((info.copied || info.deleted) && (error <= 0 || !transactional_table)) { @@ -362,14 +373,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, if (transactional_table) error=ha_autocommit_or_rollback(thd,error); - /* - Store table for future invalidation or invalidate it in - the query cache if something changed - */ - if (info.copied || info.deleted) - { - query_cache_invalidate3(thd, table_list, 1); - } if (thd->lock) { mysql_unlock_tables(thd, thd->lock); @@ -1420,11 +1423,11 @@ void select_insert::send_error(uint errcode,const char *err) ::send_error(thd,errcode,err); table->file->extra(HA_EXTRA_NO_CACHE); table->file->activate_all_index(thd); - ha_rollback_stmt(thd); if (info.copied || info.deleted) { query_cache_invalidate3(thd, table, 1); } + ha_rollback_stmt(thd); } @@ -1435,6 +1438,14 @@ bool select_insert::send_eof() error=table->file->activate_all_index(thd); table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); + /* We must invalidate the table in the query cache before binlog writing + and ha_autocommit_... */ + + if (info.copied || info.deleted) + { + query_cache_invalidate3(thd, table, 1); + } + /* Write to binlog before commiting transaction */ if (mysql_bin_log.is_open()) { @@ -1444,10 +1455,6 @@ bool select_insert::send_eof() } if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) error=error2; - if (info.copied || info.deleted) - { - query_cache_invalidate3(thd, table, 1); - } if (error) { table->file->print_error(error,MYF(0)); |