List:Internals« Previous MessageNext Message »
From:Jan Lindstrom Date:September 27 2005 1:23pm
Subject:bk commit into 5.0 tree (jan:1.1996) BUG#12669
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jan. When jan does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1996 05/09/27 14:23:40 jan@stripped +3 -0
  Fixed a bug checksum table locks the InnoDB table and does not use a
  consistent read (Bug #12669).

  sql/ha_innodb.cc
    1.262 05/09/27 14:23:30 jan@stripped +12 -2
    Use consistent read for checksum table and convert lock type to TL_READ,
    because at the moment MySQL uses TL_READ_NO_INSERT which is too strict.

  mysql-test/t/innodb.test
    1.112 05/09/27 14:23:30 jan@stripped +40 -0
    Added test case for checksum bug #12669.

  mysql-test/r/innodb.result
    1.138 05/09/27 14:23:30 jan@stripped +28 -0
    Added results for checksum test case.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jan
# Host:	hundin.mysql.fi
# Root:	/home/jan/mysql-5.0

--- 1.137/mysql-test/r/innodb.result	2005-09-23 16:44:23 +03:00
+++ 1.138/mysql-test/r/innodb.result	2005-09-27 14:23:30 +03:00
@@ -2616,3 +2616,31 @@
 INSERT INTO t2 VALUES(3);
 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`,
CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
 DROP TABLE t2;
+create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into test_checksum values (1),(2);
+set autocommit=0;
+checksum table test_checksum;
+Table	Checksum
+test.test_checksum	1531596814
+insert into test_checksum values(3);
+checksum table test_checksum;
+Table	Checksum
+test.test_checksum	1531596814
+commit;
+checksum table test_checksum;
+Table	Checksum
+test.test_checksum	2050879373
+commit;
+drop table test_checksum;
+create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into test_checksum values (1),(2);
+set autocommit=1;
+checksum table test_checksum;
+Table	Checksum
+test.test_checksum	1531596814
+set autocommit=1;
+insert into test_checksum values(3);
+checksum table test_checksum;
+Table	Checksum
+test.test_checksum	2050879373
+drop table test_checksum;

--- 1.111/mysql-test/t/innodb.test	2005-09-23 16:44:23 +03:00
+++ 1.112/mysql-test/t/innodb.test	2005-09-27 14:23:30 +03:00
@@ -1564,3 +1564,43 @@
 INSERT INTO t2 VALUES(3);
 
 DROP TABLE t2;
+
+#
+# Test that checksum table uses a consistent read Bug #12669
+#
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into test_checksum values (1),(2);
+set autocommit=0;
+checksum table test_checksum;
+connection b;
+insert into test_checksum values(3);
+connection a;
+#
+# Here checksum should not see insert
+#
+checksum table test_checksum;
+connection a;
+commit;
+checksum table test_checksum;
+commit;
+drop table test_checksum;
+#
+# autocommit = 1
+#
+connection a;
+create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into test_checksum values (1),(2);
+set autocommit=1;
+checksum table test_checksum;
+connection b;
+set autocommit=1;
+insert into test_checksum values(3);
+connection a;
+#
+# Here checksum sees insert
+#
+checksum table test_checksum;
+drop table test_checksum;

--- 1.261/sql/ha_innodb.cc	2005-09-23 16:40:54 +03:00
+++ 1.262/sql/ha_innodb.cc	2005-09-27 14:23:30 +03:00
@@ -6689,8 +6689,18 @@
 			prebuilt->select_lock_type = LOCK_NONE;
 			prebuilt->stored_select_lock_type = LOCK_NONE;
 		} else {
-			prebuilt->select_lock_type = LOCK_S;
-			prebuilt->stored_select_lock_type = LOCK_S;
+
+			if (thd->lex->sql_command == SQLCOM_CHECKSUM) {
+				/* Use consistent read for checksum table and 
+				convert lock type to TL_READ */
+
+				prebuilt->select_lock_type = LOCK_NONE;
+				prebuilt->stored_select_lock_type = LOCK_NONE;
+				lock.type = TL_READ;
+			} else {
+				prebuilt->select_lock_type = LOCK_S;
+				prebuilt->stored_select_lock_type = LOCK_S;
+			}
 		}
 
 	} else if (lock_type != TL_IGNORE) {
Thread
bk commit into 5.0 tree (jan:1.1996) BUG#12669Jan Lindstrom27 Sep