diff options
author | unknown <heikki@hundin.mysql.fi> | 2005-01-12 18:25:39 +0200 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2005-01-12 18:25:39 +0200 |
commit | 871fdda191d09b459f742d560ba1c5c0a5014b98 (patch) | |
tree | d30906a22182ffa9552c4f342634d32ca1bdd65b /sql | |
parent | c153522d354f69206861e9ce4abe5bcc7016f541 (diff) | |
download | mariadb-git-871fdda191d09b459f742d560ba1c5c0a5014b98.tar.gz |
ha_innodb.cc:
Add comments about why the InnoDB latching order is obeyed also for the MySQL query cache mutex; add an error printf if that is not the case
sync0sync.h:
Assign sync0sync.h ranks also for the MySQL query cache mutex and the MySQL binlog mutex; the latching order must be obeyed also for these
row0ins.c:
Add a comment why the query cache invalidate operation cannot deadlock in a cascaded FOREIGN KEY operation
innobase/row/row0ins.c:
Add a comment why the query cache invalidate operation cannot deadlock in a cascaded FOREIGN KEY operation
innobase/include/sync0sync.h:
Assign sync0sync.h ranks also for the MySQL query cache mutex and the MySQL binlog mutex; the latching order must be obeyed also for these
sql/ha_innodb.cc:
Add comments about why the InnoDB latching order is obeyed also for the MySQL query cache mutex; add an error printf if that is not the case
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 0bca8c21715..3df61333b75 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -765,7 +765,14 @@ returns TRUE for all tables in the query. If thd is not in the autocommit state, this function also starts a new transaction for thd if there is no active trx yet, and assigns a consistent -read view to it if there is no read view yet. */ +read view to it if there is no read view yet. + +Why a deadlock of threads is not possible: the query cache calls this function +at the start of a SELECT processing. Then the calling thread cannot be +holding any InnoDB semaphores. The calling thread is holding the +query cache mutex, and this function will reserver the InnoDB kernel mutex. +Thus, the 'rank' in sync0sync.h of the MySQL query cache mutex is above +the InnoDB kernel mutex. */ my_bool innobase_query_caching_of_table_permitted( @@ -802,6 +809,13 @@ innobase_query_caching_of_table_permitted( trx = check_trx_exists(thd); } + if (trx->has_search_latch) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Error: the calling thread is holding the adaptive search\n" +"InnoDB: latch though calling innobase_query_caching_of_table_permitted\n"); + } + innobase_release_stat_resources(trx); if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { @@ -877,6 +891,10 @@ innobase_invalidate_query_cache( ulint full_name_len) /* in: full name length where also the null chars count */ { + /* Note that the sync0sync.h rank of the query cache mutex is just + above the InnoDB kernel mutex. The caller of this function must not + have latches of a lower rank. */ + /* Argument TRUE below means we are using transactions */ #ifdef HAVE_QUERY_CACHE query_cache.invalidate((THD*)(trx->mysql_thd), |