List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:February 13 2009 1:26pm
Subject:bzr commit into mysql-6.0 branch (vvaintroub:3000)
View as plain text  
#At file:///G:/bzr/mysql-6.0-falcon/ based on revid:vvaintroub@stripped

 3000 Vladislav Vaintroub	2009-02-13 [merge]
      merge from main
      added:
        mysql-test/suite/falcon/r/falcon_bug_41688.result
        mysql-test/suite/falcon/r/falcon_bug_42069.result
        mysql-test/suite/falcon/t/falcon_bug_41688.test
        mysql-test/suite/falcon/t/falcon_bug_42069.test
      modified:
        .bzr-mysql/default.conf
        mysql-test/lib/v1/mtr_report.pl
        mysql-test/mysql-test-run.pl
        mysys/thr_lock.c
        storage/falcon/ha_falcon.cpp

=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2009-02-10 22:07:35 +0000
+++ b/.bzr-mysql/default.conf	2009-02-11 18:23:17 +0000
@@ -1,5 +1,5 @@
 [MYSQL]
-tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-falcon
+tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0
 post_commit_to = commits@stripped
 post_push_to = commits@stripped
-tree_name = mysql-6.0-falcon
+tree_name = mysql-6.0

=== modified file 'mysql-test/lib/v1/mtr_report.pl'
--- a/mysql-test/lib/v1/mtr_report.pl	2008-11-14 08:45:32 +0000
+++ b/mysql-test/lib/v1/mtr_report.pl	2009-02-05 08:59:29 +0000
@@ -235,6 +235,7 @@ sub mtr_report_stats ($) {
       # We report different types of problems in order
       foreach my $pattern ( "^Warning:",
 			    "\\[Warning\\]",
+			    "^Warning at",
 			    "\\[ERROR\\]",
 			    "^Error:", "^==.* at 0x",
 			    "InnoDB: Warning",

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-02-10 22:07:35 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-02-11 18:23:17 +0000
@@ -3485,6 +3485,7 @@ sub extract_warning_lines ($) {
      # qr/^Warning:|mysqld: Warning|\[Warning\]/,
      # qr/^Error:|\[ERROR\]/,
      qr/^Warning:|mysqld: Warning/,
+     qr/^Warning at/,
      qr/^Error:/,
      qr/^==.* at 0x/,
      qr/InnoDB: Warning|InnoDB: Error/,

=== added file 'mysql-test/suite/falcon/r/falcon_bug_41688.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_41688.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_41688.result	2009-02-05 08:59:29 +0000
@@ -0,0 +1,68 @@
+#
+# Bug #41688: Foreign keys: lock warnings
+#
+# The combination of facts that Falcon was not downgrading
+# TL_READ_NO_INSERT and that SQL-layer impoperly handled
+# handled locking for combination of TL_READ_NO_INSERT and
+# TL_WRITE_ALLOW_WRITE locks let to warnings appearing in
+# error log.
+SET @@storage_engine = 'Falcon';
+drop table if exists t1;
+create table t1 (s1 int);
+insert into t1 values (1);
+select get_lock("bug41688_lock_1", 100);
+get_lock("bug41688_lock_1", 100)
+1
+Switching to connection 'addcon3'
+select get_lock("bug41688_lock_2", 100);
+get_lock("bug41688_lock_2", 100)
+1
+# First part of the test. Before fix in this situation
+# TL_READ_NO_INSERT was acquired even although another
+# was holding TL_WRITE_ALLOW_WRITE lock.
+Switching to connection 'addcon1'
+insert into t1 values (get_lock("bug41688_lock_1", 100));;
+Switching to connection 'default'
+# This statement should not get blocked or produce warnings in error log
+insert into t1 select * from t1;
+# Allow statement in 'addcon1' to proceed
+select release_lock("bug41688_lock_1");
+release_lock("bug41688_lock_1")
+1
+Switching to connection 'addcon1'
+select release_lock("bug41688_lock_1");
+release_lock("bug41688_lock_1")
+1
+# Second part of the test. Before fix in this situation
+# TL_WRITE_ALLOW_WRITE was acquired even although another
+# thread was holding TL_WRITE_ALLOW_WRITE and TL_READ_NO_INSERT
+# on the table.
+Switching to connection 'default'
+select get_lock("bug41688_lock_1", 100);
+get_lock("bug41688_lock_1", 100)
+1
+Switching to connection 'addcon1'
+insert into t1 select count(*) * get_lock("bug41688_lock_1", 100) from t1;;
+Switching to connection 'addcon2'
+# This statement should not get blocked or produce warnings in error log
+insert into t1 values (get_lock("bug41688_lock_2", 100));;
+Switching to connection 'default'
+# Allow statement in 'addcon1' to proceed
+select release_lock("bug41688_lock_1");
+release_lock("bug41688_lock_1")
+1
+Switching to connection 'addcon1'
+select release_lock("bug41688_lock_1");
+release_lock("bug41688_lock_1")
+1
+Switching to connection 'addcon3'
+# Allow statement in 'addcon2' to proceed
+select release_lock("bug41688_lock_2");
+release_lock("bug41688_lock_2")
+1
+Switching to connection 'addcon2'
+select release_lock("bug41688_lock_2");
+release_lock("bug41688_lock_2")
+1
+Switching to connection 'default'
+drop table t1;

=== added file 'mysql-test/suite/falcon/r/falcon_bug_42069.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_42069.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_42069.result	2009-02-05 08:59:29 +0000
@@ -0,0 +1,33 @@
+#
+# Bug #42069: Foreign keys: hang if two connections
+#
+# The fact that Falcon was not downgrading TL_READ_NO_INSERT
+# lock led to possibility of deadlocks involving SQL-layer
+# table locks even for statements which used only Falcon
+# tables.
+SET @@storage_engine = 'Falcon';
+drop tables if exists t1, t2;
+create table t1 (s1 int primary key);
+create table t2 (s1 int primary key);
+insert into t1 values (1);
+insert into t2 values (1);
+set @@autocommit= 0;
+# Start transaction which will put row-level "lock" on t1
+begin;
+update t1 set s1= s1 + 1;
+Switching to connection 'addcon'
+# Execute statement which will wait on this row-level "lock"
+# and which by default acquires TL_READ_NO_INSERT on t2.
+insert into t1 values (1) on duplicate key update s1= 1 + (select count(*) from t2);;
+Switching to connection 'default'
+# Wait till the above statement will start executing
+# This statement should not deadlock as there should be no
+# TL_READ_NO_INSERT lock on t2.
+insert into t2 values (2);
+# Rollback transaction to avoid "Record has changed since last read"
+# error in 'addcon' connection
+rollback;
+Switching to connection 'addcon'
+Switching to connection 'default'
+set @@autocommit= 1;
+drop tables t1, t2;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_41688.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_41688.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_41688.test	2009-02-05 08:59:29 +0000
@@ -0,0 +1,121 @@
+# We need normal server as we use several connections in this test.
+# We also need binary log enabled as only in this case TL_READ_NO_INSERT
+# locks are acquired for tables participating in subqueries.
+--source include/have_falcon.inc
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--echo #
+--echo # Bug #41688: Foreign keys: lock warnings
+--echo #
+--echo # The combination of facts that Falcon was not downgrading
+--echo # TL_READ_NO_INSERT and that SQL-layer impoperly handled
+--echo # handled locking for combination of TL_READ_NO_INSERT and
+--echo # TL_WRITE_ALLOW_WRITE locks let to warnings appearing in
+--echo # error log.
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+connect (addcon1, localhost, root,,);
+connect (addcon2, localhost, root,,);
+connect (addcon3, localhost, root,,);
+connection default;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (s1 int);
+insert into t1 values (1);
+select get_lock("bug41688_lock_1", 100);
+--echo Switching to connection 'addcon3'
+connection addcon3;
+select get_lock("bug41688_lock_2", 100);
+
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+--echo # First part of the test. Before fix in this situation
+--echo # TL_READ_NO_INSERT was acquired even although another
+--echo # was holding TL_WRITE_ALLOW_WRITE lock.
+--echo Switching to connection 'addcon1'
+connection addcon1;
+--send insert into t1 values (get_lock("bug41688_lock_1", 100));
+
+--echo Switching to connection 'default'
+connection default;
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "User lock" and info = 'insert into t1 values (get_lock("bug41688_lock_1", 100))';
+--source include/wait_condition.inc
+
+--echo # This statement should not get blocked or produce warnings in error log
+insert into t1 select * from t1;
+
+--echo # Allow statement in 'addcon1' to proceed
+select release_lock("bug41688_lock_1");
+
+--echo Switching to connection 'addcon1'
+connection addcon1;
+--reap
+select release_lock("bug41688_lock_1");
+
+--echo # Second part of the test. Before fix in this situation
+--echo # TL_WRITE_ALLOW_WRITE was acquired even although another
+--echo # thread was holding TL_WRITE_ALLOW_WRITE and TL_READ_NO_INSERT
+--echo # on the table.
+--echo Switching to connection 'default'
+connection default;
+select get_lock("bug41688_lock_1", 100);
+
+--echo Switching to connection 'addcon1'
+connection addcon1;
+--send insert into t1 select count(*) * get_lock("bug41688_lock_1", 100) from t1;
+
+--echo Switching to connection 'addcon2'
+connection addcon2;
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "User lock" and info = 'insert into t1 select count(*) * get_lock("bug41688_lock_1", 100) from t1';
+--source include/wait_condition.inc
+
+--echo # This statement should not get blocked or produce warnings in error log
+--send insert into t1 values (get_lock("bug41688_lock_2", 100));
+
+--echo Switching to connection 'default'
+connection default;
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "User lock" and info = 'insert into t1 values (get_lock("bug41688_lock_2", 100))';
+--source include/wait_condition.inc
+
+--echo # Allow statement in 'addcon1' to proceed
+select release_lock("bug41688_lock_1");
+
+--echo Switching to connection 'addcon1'
+connection addcon1;
+--reap
+select release_lock("bug41688_lock_1");
+
+--echo Switching to connection 'addcon3'
+connection addcon3;
+--echo # Allow statement in 'addcon2' to proceed
+select release_lock("bug41688_lock_2");
+
+--echo Switching to connection 'addcon2'
+connection addcon2;
+--reap
+select release_lock("bug41688_lock_2");
+                             
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+--echo Switching to connection 'default'
+connection default;
+drop table t1;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_42069.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_42069.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_42069.test	2009-02-05 08:59:29 +0000
@@ -0,0 +1,72 @@
+# We need normal server as we use several connections in this test.
+# We also need binary log enabled as only in this case TL_READ_NO_INSERT
+# locks are acquired for tables participating in subqueries.
+--source include/have_falcon.inc
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--echo #
+--echo # Bug #42069: Foreign keys: hang if two connections
+--echo #
+--echo # The fact that Falcon was not downgrading TL_READ_NO_INSERT
+--echo # lock led to possibility of deadlocks involving SQL-layer
+--echo # table locks even for statements which used only Falcon
+--echo # tables.
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+connect (addcon, localhost, root,,);
+connection default;
+
+--disable_warnings
+drop tables if exists t1, t2;
+--enable_warnings
+create table t1 (s1 int primary key);
+create table t2 (s1 int primary key);
+insert into t1 values (1);
+insert into t2 values (1);
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+set @@autocommit= 0;
+--echo # Start transaction which will put row-level "lock" on t1
+begin;
+update t1 set s1= s1 + 1;
+
+--echo Switching to connection 'addcon'
+connection addcon;
+--echo # Execute statement which will wait on this row-level "lock"
+--echo # and which by default acquires TL_READ_NO_INSERT on t2.
+--send insert into t1 values (1) on duplicate key update s1= 1 + (select count(*) from t2);
+
+--echo Switching to connection 'default'
+connection default;
+--echo # Wait till the above statement will start executing
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Update" and info = "insert into t1 values (1) on duplicate key update s1= 1 + (select count(*) from t2)";
+--source include/wait_condition.inc
+
+--echo # This statement should not deadlock as there should be no
+--echo # TL_READ_NO_INSERT lock on t2.
+insert into t2 values (2);
+--echo # Rollback transaction to avoid "Record has changed since last read"
+--echo # error in 'addcon' connection
+rollback;
+
+--echo Switching to connection 'addcon'
+connection addcon;
+--reap
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+--echo Switching to connection 'default'
+connection default;
+set @@autocommit= 1;
+drop tables t1, t2;

=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c	2009-01-16 11:53:32 +0000
+++ b/mysys/thr_lock.c	2009-02-05 08:59:29 +0000
@@ -321,6 +321,7 @@ static void check_locks(THR_LOCK *lock, 
     }
     if (found_errors != old_found_errors)
     {
+      fflush(stderr);
       DBUG_PRINT("error",("Found wrong lock"));
     }
   }

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2009-02-05 09:00:35 +0000
+++ b/storage/falcon/ha_falcon.cpp	2009-02-11 18:23:17 +0000
@@ -1014,18 +1014,17 @@ THR_LOCK_DATA **StorageInterface::store_
 			lock_type = TL_WRITE_ALLOW_WRITE;
 
 		/*
-		  In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
-		  MySQL would use the lock TL_READ_NO_INSERT on t2, and that
-		  would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
-		  to t2. Convert the lock to a normal read lock to allow
-		  concurrent inserts to t2.
+                  In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
+                  MySQL would use the lock TL_READ_NO_INSERT on t2 to prevent
+                  concurrent inserts into this table. Since Falcon can handle
+                  concurrent changes using own mechanisms and this type of
+                  lock conflicts with TL_WRITE_ALLOW_WRITE we convert it to
+                  a normal read lock to allow concurrent changes.
 		*/
 
-		#ifdef XXX_TALK_TO_SERGEI
-		if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd))
-			lock_type = TL_READ;
-		#endif
-
+		if (lock_type == TL_READ_NO_INSERT &&
+                    !(thd_in_lock_tables(thd) && sql_command == SQLCOM_LOCK_TABLES))
+                       lock_type = TL_READ;
 
 		lockData.type = lock_type;
 		}

Thread
bzr commit into mysql-6.0 branch (vvaintroub:3000)Vladislav Vaintroub13 Feb