diff options
author | unknown <bell@sanja.is.com.ua> | 2002-04-29 00:33:52 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2002-04-29 00:33:52 +0300 |
commit | 3c0e609165197d03d067fed2157673ae42652f26 (patch) | |
tree | f74bb7c0172682417236403294a4f2b39e49af7f /sql | |
parent | a2ce6c71b836c627e71fe37f0aa312b11e59f571 (diff) | |
download | mariadb-git-3c0e609165197d03d067fed2157673ae42652f26.tar.gz |
invalidation moved before tables unlocking
sql/sql_delete.cc:
invalidation moved before tables unlocking
invalidation on multidelete error (if something changed)
sql/sql_parse.cc:
invalidation moved to mysql_admin_table
layout fixing
sql/sql_table.cc:
invalidation moved to mysql_admin_table
sql/sql_update.cc:
invalidation moved before tables unlocking
invalidation on multiupdate error (if something changed)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_delete.cc | 7 | ||||
-rw-r--r-- | sql/sql_insert.cc | 6 | ||||
-rw-r--r-- | sql/sql_parse.cc | 7 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 | ||||
-rw-r--r-- | sql/sql_update.cc | 8 |
5 files changed, 22 insertions, 10 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f5a5a684fc0..986e7599df6 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -176,13 +176,13 @@ cleanup: } if (using_transactions && ha_autocommit_or_rollback(thd,error >= 0)) error=1; + if (deleted) + query_cache_invalidate3(thd, table_list, 1); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); thd->lock=0; } - if (deleted) - query_cache_invalidate3(thd, table_list, 1); delete select; if (error >= 0) // Fatal error send_error(&thd->net,thd->killed ? ER_SERVER_SHUTDOWN: 0); @@ -355,6 +355,9 @@ void multi_delete::send_error(uint errcode,const char *err) if (!deleted) DBUG_VOID_RETURN; + /* Somthing alredy deleted consequently we have to invalidate cache */ + query_cache_invalidate3(thd, delete_tables, 1); + /* Below can happen when thread is killed early ... */ if (!table_being_deleted) table_being_deleted=delete_tables; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 69fc7c00955..f0b9062f740 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -262,6 +262,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, info.copied=values_list.elements; end_delayed_insert(thd); } + if (info.copied || info.deleted) + query_cache_invalidate3(thd, table_list, 1); } else { @@ -303,6 +305,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, } if (using_transactions) error=ha_autocommit_or_rollback(thd,error); + if (info.copied || info.deleted) + query_cache_invalidate3(thd, table_list, 1); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); @@ -310,8 +314,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, } } thd->proc_info="end"; - if (info.copied || info.deleted) - query_cache_invalidate3(thd, table_list, 1); table->time_stamp=save_time_stamp; // Restore auto timestamp ptr table->next_number_field=0; thd->count_cuted_fields=0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dc89888a1a5..055a99320de 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1669,7 +1669,6 @@ mysql_execute_command(void) check_table_access(thd,SELECT_ACL | INSERT_ACL, tables)) goto error; /* purecov: inspected */ res = mysql_repair_table(thd, tables, &lex->check_opt); - query_cache_invalidate3(thd, tables, 0); break; } case SQLCOM_CHECK: @@ -1678,7 +1677,6 @@ mysql_execute_command(void) check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables)) goto error; /* purecov: inspected */ res = mysql_check_table(thd, tables, &lex->check_opt); - query_cache_invalidate3(thd, tables, 0); break; } case SQLCOM_ANALYZE: @@ -1941,8 +1939,9 @@ mysql_execute_command(void) /* Fix tables-to-be-deleted-from list to point at opened tables */ for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next) auxi->table= ((TABLE_LIST*) auxi->table)->table; - if (!thd->fatal_error && (result=new multi_delete(thd,aux_tables, - lex->lock_option,table_count))) + if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables, + lex->lock_option, + table_count))) { res=mysql_select(thd,tables,select_lex->item_list, select_lex->where, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dcbfd709f97..4a782d396c2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1120,8 +1120,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, if (fatal_error) table->table->version=0; // Force close of table else if (open_for_modify) + { remove_table_from_cache(thd, table->table->table_cache_key, table->table->real_name); + /* May be something modified consequently we have to invalidate cache */ + query_cache_invalidate3(thd, table->table, 0); + } close_thread_tables(thd); table->table=0; // For query cache if (my_net_write(&thd->net, (char*) packet->ptr(), diff --git a/sql/sql_update.cc b/sql/sql_update.cc index db520af61c1..eb81f315719 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -318,13 +318,13 @@ int mysql_update(THD *thd, } if (using_transactions && ha_autocommit_or_rollback(thd, error >= 0)) error=1; + if (updated) + query_cache_invalidate3(thd, table_list, 1); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); thd->lock=0; } - if (updated) - query_cache_invalidate3(thd, table_list, 1); delete select; if (error >= 0) @@ -642,6 +642,10 @@ void multi_update::send_error(uint errcode,const char *err) /* If nothing updated return */ if (!updated) return; + + /* Somthing alredy updated consequently we have to invalidate cache */ + query_cache_invalidate3(thd, update_tables, 1); + /* Below can happen when thread is killed early ... */ if (!table_being_updated) table_being_updated=update_tables; |