From e70b22e55c5756a8318c07ab337a1c31acf1aa86 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Mar 2003 19:31:01 +0200 Subject: ha_innodb.h, ha_innodb.cc, handler.h, handler.cc, sql_class.cc: Fix a hang on the adaptive hash S-latch if an application program uses mysql_use_result() and performs queries on two connections at the same time sql/sql_class.cc: Fix a hang on the adaptive hash S-latch if an application program uses mysql_use_result() and performs queries on two connections at the same time sql/handler.cc: Fix a hang on the adaptive hash S-latch if an application program uses mysql_use_result() and performs queries on two connections at the same time sql/handler.h: Fix a hang on the adaptive hash S-latch if an application program uses mysql_use_result() and performs queries on two connections at the same time sql/ha_innodb.cc: Fix a hang on the adaptive hash S-latch if an application program uses mysql_use_result() and performs queries on two connections at the same time sql/ha_innodb.h: Fix a hang on the adaptive hash S-latch if an application program uses mysql_use_result() and performs queries on two connections at the same time --- sql/handler.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index fb33888e91e..3fae7c3bd72 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -238,8 +238,10 @@ int ha_autocommit_or_rollback(THD *thd, int error) handler must be the same as in the binlog. arguments: + thd: the thread handle of the current connection log_file_name: latest binlog file name end_offset: the offset in the binlog file up to which we wrote + return value: 0 if success, 1 if error */ int ha_report_binlog_offset_and_commit(THD *thd, @@ -266,6 +268,34 @@ int ha_report_binlog_offset_and_commit(THD *thd, return error; } +/* + This function should be called when MySQL sends rows of a SELECT result set + or the EOF mark to the client. It releases a possible adaptive hash index + S-latch held by thd in InnoDB and also releases a possible InnoDB query + FIFO ticket to enter InnoDB. To save CPU time, InnoDB allows a thd to + keep them over several calls of the InnoDB handler interface when a join + is executed. But when we let the control to pass to the client they have + to be released because if the application program uses mysql_use_result(), + it may deadlock on the S-latch if the application on another connection + performs another SQL query. In MySQL-4.1 this is even more important because + there a connection can have several SELECT queries open at the same time. + + arguments: + thd: the thread handle of the current connection + return value: always 0 +*/ + +int ha_release_temporary_latches(THD *thd) +{ +#ifdef HAVE_INNOBASE_DB + THD_TRANS *trans; + trans = &thd->transaction.all; + if (trans->innobase_tid) + innobase_release_temporary_latches(trans->innobase_tid); +#endif + return 0; +} + int ha_commit_trans(THD *thd, THD_TRANS* trans) { int error=0; -- cgit v1.2.1 From 3446199d8e421da02a5546f439ee76b368594700 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Mar 2003 12:22:35 +0200 Subject: Fixed bug in LOCK TABLE + DROP TABLE when other thread was waiting for a table that was locked bug not droped client/mysqltest.c: Fixed bug that comments did a ping include/thr_lock.h: Added function to abort a lock for a specific thread mysql-test/mysql-test-run.sh: Fixed where mysqltest traces are put mysql-test/r/lock_multi.result: Test for LOCK TABLE + DROP TABLE bug mysql-test/t/lock_multi.test: Test for LOCK TABLE + DROP TABLE bug mysys/thr_lock.c: Added function to abort a lock for a specific thread sql/handler.cc: Indentation cleanup sql/lock.cc: Added function to abort a lock for a specific thread sql/mysql_priv.h: Added function to abort a lock for a specific thread sql/mysqld.cc: Use automatic recover even with --safe --- sql/handler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index fb33888e91e..52ec910dd01 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -473,7 +473,8 @@ int handler::ha_open(const char *name, int mode, int test_if_locked) int error; DBUG_ENTER("handler::open"); DBUG_PRINT("enter",("name: %s db_type: %d db_stat: %d mode: %d lock_test: %d", - name, table->db_type, table->db_stat, mode, test_if_locked)); + name, table->db_type, table->db_stat, mode, + test_if_locked)); if ((error=open(name,mode,test_if_locked))) { -- cgit v1.2.1