Commit beb29e1b authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mashka.mysql.fi:/home/my/mysql-4.1-narttu
parents bd4b9522 b8e5b65f
......@@ -560,12 +560,12 @@ innobase_query_caching_of_table_permitted(
#endif
if (row_search_check_if_query_cache_permitted(trx, norm_name)) {
printf("Query cache for %s permitted\n", norm_name);
/* printf("Query cache for %s permitted\n", norm_name); */
return((my_bool)TRUE);
}
printf("Query cache for %s NOT permitted\n", norm_name);
/* printf("Query cache for %s NOT permitted\n", norm_name); */
return((my_bool)FALSE);
}
......
......@@ -178,6 +178,15 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
(void) table->file->extra(HA_EXTRA_NORMAL);
cleanup:
/*
Invalidate the table in the query cache if something changed. This must
be before binlog writing and ha_autocommit_...
*/
if (deleted)
{
query_cache_invalidate3(thd, table_list, 1);
}
transactional_table= table->file->has_transactions();
log_delayed= (transactional_table || table->tmp_table);
if (deleted && (error <= 0 || !transactional_table))
......@@ -199,14 +208,6 @@ cleanup:
error=1;
}
/*
Store table for future invalidation or invalidate it in
the query cache if something changed
*/
if (deleted)
{
query_cache_invalidate3(thd, table_list, 1);
}
if (thd->lock)
{
mysql_unlock_tables(thd, thd->lock);
......@@ -480,6 +481,10 @@ bool multi_delete::send_eof()
/* reset used flags */
thd->proc_info="end";
/* We must invalidate the query cache before binlog writing and
ha_autocommit_... */
if (deleted)
query_cache_invalidate3(thd, delete_tables, 1);
/*
Write the SQL statement to the binlog if we deleted
......@@ -505,9 +510,6 @@ bool multi_delete::send_eof()
if (ha_autocommit_or_rollback(thd,local_error > 0))
local_error=1;
if (deleted)
query_cache_invalidate3(thd, delete_tables, 1);
if (local_error)
::send_error(thd);
else
......
......@@ -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));
......
......@@ -283,6 +283,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->copy_blobs=0;
thd->count_cuted_fields=0; /* Don`t calc cuted fields */
/* We must invalidate the table in query cache before binlog writing and
ha_autocommit_... */
query_cache_invalidate3(thd, table_list, 0);
if (error)
{
if (transactional_table)
......@@ -344,8 +348,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
query_cache_invalidate3(thd, table_list, 0);
err:
if (thd->lock)
{
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment