List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:October 21 2010 7:24pm
Subject:bzr commit into mysql-5.5-runtime branch (kostja:3173) Bug#54673
View as plain text  
#At file:///opt/local/work/5.5-rt-stage/ based on revid:dmitry.lenev@stripped

 3173 Konstantin Osipov	2010-10-21
      Update comments (Bug#54673, code review)

    modified:
      mysql-test/include/check_ftwrl_compatible.inc
      mysql-test/include/check_ftwrl_incompatible.inc
      mysql-test/r/flush_read_lock.result
      mysql-test/t/flush_read_lock.test
=== modified file 'mysql-test/include/check_ftwrl_compatible.inc'
--- a/mysql-test/include/check_ftwrl_compatible.inc	2010-10-21 07:23:30 +0000
+++ b/mysql-test/include/check_ftwrl_compatible.inc	2010-10-21 19:24:20 +0000
@@ -5,10 +5,13 @@
 # PARAMETERS 
 #   $con_aux1     Name of the 1st aux connection to be used by this script.
 #   $con_aux2     Name of the 2nd aux connection to be used by this script.
-#   $statement    Statement to be checked.
-#   $cleanup_stmt Statement to be run in order to revert effects of
-#                 statement to be checked.
-#   $skip_3rd_chk Skip the 3rd stage of checking.
+#   $statement    The statement to be checked.
+#   $cleanup_stmt The statement to be run in order to revert effects of
+#                 the statement to be checked.
+#   $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
+#                 stage is to check that metadata locks taken by this
+#                 statement are compatible with metadata locks taken
+#                 by FTWRL.
 #
 # EXAMPLE
 #   flush_read_lock.test

=== modified file 'mysql-test/include/check_ftwrl_incompatible.inc'
--- a/mysql-test/include/check_ftwrl_incompatible.inc	2010-10-21 07:23:30 +0000
+++ b/mysql-test/include/check_ftwrl_incompatible.inc	2010-10-21 19:24:20 +0000
@@ -5,12 +5,15 @@
 # PARAMETERS 
 #   $con_aux1      Name of the 1st aux connection to be used by this script.
 #   $con_aux2      Name of the 2nd aux connection to be used by this script.
-#   $statement     Statement to be checked.
+#   $statement     The statement to be checked.
 #   $cleanup_stmt1 The 1st statement to be run in order to revert effects
 #                  of statement to be checked.
 #   $cleanup_stmt2 The 2nd statement to be run in order to revert effects
 #                  of statement to be checked.
-#   $skip_3rd_chk  Skip the 3rd stage of checking.
+#   $skip_3rd_chk  Skip the 3rd stage of checking. The purpose of the third
+#                  stage is to check that metadata locks taken by this
+#                  statement are incompatible with metadata locks taken
+#                  by FTWRL.
 #
 # EXAMPLE
 #   flush_read_lock.test
@@ -96,8 +99,8 @@ if (`SELECT "$cleanup_stmt2" <> ""`)
 if (`SELECT "$skip_3rd_check" = ""`)
 {
 #
-# Finally, let us check that FTWRL will succeed if this statement
-# is active but has already closed its tables.
+# Finally, let us check that FTWRL will not succeed if this
+# statement is active but has already closed its tables.
 #
 connection default;
 --eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';

=== modified file 'mysql-test/r/flush_read_lock.result'
--- a/mysql-test/r/flush_read_lock.result	2010-10-21 05:43:57 +0000
+++ b/mysql-test/r/flush_read_lock.result	2010-10-21 19:24:20 +0000
@@ -1,8 +1,55 @@
-# Use MyISAM engine for the most of test tables
-# in order to avoid implicit commit affecting
-# tests for DDL statements.
+# FTWRL takes two global metadata locks -- a global shared
+# metadata lock and the commit blocker lock.
+# The first lock prevents DDL from taking place.
+# Let's say that all DDL statements that take metadata
+# locks form class #1 -- incompatible with FTWRL because
+# take incompatible MDL table locks.
+# The first global lock doesn't, however, prevent standalone
+# COMMITs (or implicit COMMITs) from taking place, since a
+# COMMIT doesn't take table locks. It doesn't prevent
+# DDL on temporary tables either, since they don't
+# take any table locks either.
+# Most DDL statements do not perform an implicit commit
+# if operate on a temporary table. Examples are CREATE
+# TEMPORARY TABLE and DROP TEMPORARY TABLE. 
+# Thus, these DDL statements can go through in presence
+# of FTWRL. This is class #2 -- compatible because
+# do not take incompatible MDL locks and do not issue
+# implicit commit..
+# (Although these operations do not commit, their effects
+# cannot be rolled back either.)
+# ALTER TABLE, ANALYZE, OPTIMIZE and some others always
+# issue an implicit commit, even if its argument is a
+# temporary table. 
+# *Howewer* an implicit commit is a no-op if all engines
+# used since the start of transactiona are non-
+# transactional. Thus, for non-transactional engines,
+# these operations are not blocked by FTWRL.
+# This is class #3 -- compatible because do not take
+# MDL table locks and are non-transactional. 
+# On the contrary, for transactional engines, there
+# is always a commit, regardless of whether a table
+# is temporary or not. Thus, for example, ALTER TABLE
+# for a transactional engine will wait for FTWRL, 
+# even if the subject table is temporary.
+# Thus ALTER TABLE <temporary> is incompatible
+# with FTWRL. This is class #4 -- incompatible
+# becuase issue implicit COMMIT which is not a no-op.
+# Finally, there are administrative statements (such as 
+# RESET SLAVE) that do not take any locks and do not
+# issue COMMIT.
+# This is class #5.
+# The goal of this coverage is to test statements
+# of all classes.
+# @todo: documents the effects of @@autocommit,
+# DML and temporary transactional tables.
+# Use MyISAM engine for the most of the tables
+# used in this test in order to be able to 
+# check that DDL statements on temporary tables
+# are compatible with FTRWL. 
 drop tables if exists t1_base, t2_base, t3_trans;
 drop database if exists mysqltest1;
+# We're going to test ALTER DATABASE UPGRADE
 drop database if exists `#mysql50#mysqltest-2`;
 drop procedure if exists p1;
 drop function if exists f1;
@@ -54,7 +101,7 @@ Success: Was not able to run 'alter tabl
 Success: 'alter table t1_base add column c1 int' is blocked by FTWRL active in another connection.
 Success: FTWRL is blocked when 'alter table t1_base add column c1 int' is active in another connection.
 #
-# 1.1.b) For temporaty table should be compatible with FTWRL.
+# 1.1.b) For a temporary table should be compatible with FTWRL.
 #
 Success: Was able to run 'alter table t1_temp add column c1 int' under FTWRL.
 Success: Was able to run 'alter table t1_temp add column c1 int' with FTWRL active in another connection.
@@ -98,10 +145,12 @@ Success: 'alter event e1 comment 'test''
 Success: FTWRL is blocked when 'alter event e1 comment 'test'' is active in another connection.
 #
 # 1.x) The rest of ALTER statements are too special to
-#      to be tested here.
+#      be tested here.
 #
 #
 # 2) ANALYZE TABLE statement is compatible with FTWRL.
+# See Bug#43336 ANALYZE and OPTIMIZE do not honour
+#  --read-only for a discussion why.
 #
 Success: Was able to run 'analyze table t1_base' under FTWRL.
 Success: Was able to run 'analyze table t1_base' with FTWRL active in another connection.
@@ -128,8 +177,9 @@ rollback;
 # Similarly to ROLLBACK it is a no-op in this situation.
 commit;
 unlock tables;
-# Check that BEGIN/ROLLBACK are not and COMMIT is
-# blocked by active FTWRL in another connection
+# Check that BEGIN/ROLLBACK are not blocked and 
+# COMMIT is blocked by active FTWRL in another
+# connection.
 #
 # Switching to connection 'con1'.
 flush tables with read lock;
@@ -207,18 +257,18 @@ MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+
 '' is blocked by FTWRL active in another connection.
 #
 # 5) CALL statement. This statement uses resources in two
-#    ways through expressions used as parameters and through
+#    ways: through expressions used as parameters and through
 #    sub-statements. This test covers only usage through
 #    parameters as sub-statements do locking individually.
 #
-# 5.a) In simple case parameter expression should be compatible
-#      with FTWRL.
+# 5.a) In simple cases a parameter expression should be
+#      compatible with FTWRL.
 # Skip last part of compatibility testing as this statement
 # releases metadata locks in non-standard place.
 Success: Was able to run 'call p2((select count(*) from t1_base))' under FTWRL.
 Success: Was able to run 'call p2((select count(*) from t1_base))' with FTWRL active in another connection.
 #
-# 5.b) In case when expression uses function which updates
+# 5.b) In case when an expression uses function which updates
 #      base tables CALL should be incompatible with FTWRL.
 #
 # Skip last part of compatibility testing as this statement
@@ -282,12 +332,12 @@ Success: Was able to run 'create tempora
 Success: Was able to run FTWRL while 'create temporary table t3_temp select 1 as i' was active in another connection.
 # 8.2) CREATE INDEX statement.
 #
-# 8.2.a) CREATE TABLE is incompatible with FTWRL when
+# 8.2.a) CREATE INDEX is incompatible with FTWRL when
 #        applied to base table.
 Success: Was not able to run 'create index i on t1_base (i)' under FTWRL.
 Success: 'create index i on t1_base (i)' is blocked by FTWRL active in another connection.
 Success: FTWRL is blocked when 'create index i on t1_base (i)' is active in another connection.
-# 8.2.b) CREATE TABLE is compatible with FTWRL when
+# 8.2.b) CREATE INDEX is compatible with FTWRL when
 #        applied to temporary table.
 Success: Was able to run 'create index i on t1_temp (i)' under FTWRL.
 Success: Was able to run 'create index i on t1_temp (i)' with FTWRL active in another connection.
@@ -482,14 +532,14 @@ Success: Was able to run FTWRL while 'dr
 #
 # 13.2) DROP INDEX.
 #
-# 13.2.a) DROP INDEX for base table is incompatible with FTWRL.
+# 13.2.a) DROP INDEX on a base table is incompatible with FTWRL.
 create index i on t1_base (i);
 Success: Was not able to run 'drop index i on t1_base' under FTWRL.
 Success: 'drop index i on t1_base' is blocked by FTWRL active in another connection.
 Success: FTWRL is blocked when 'drop index i on t1_base' is active in another connection.
 drop index i on t1_base;
 #
-# 13.2.b) DROP INDEX for temporary table is compatible with FTWRL.
+# 13.2.b) DROP INDEX on a temporary table is compatible with FTWRL.
 create index i on t1_temp (i);
 Success: Was able to run 'drop index i on t1_temp' under FTWRL.
 Success: Was able to run 'drop index i on t1_temp' with FTWRL active in another connection.

=== modified file 'mysql-test/t/flush_read_lock.test'
--- a/mysql-test/t/flush_read_lock.test	2010-10-21 05:43:57 +0000
+++ b/mysql-test/t/flush_read_lock.test	2010-10-21 19:24:20 +0000
@@ -10,12 +10,60 @@
 # Save the initial number of concurrent sessions.
 --source include/count_sessions.inc
 
---echo # Use MyISAM engine for the most of test tables
---echo # in order to avoid implicit commit affecting
---echo # tests for DDL statements.
+--echo # FTWRL takes two global metadata locks -- a global shared
+--echo # metadata lock and the commit blocker lock.
+--echo # The first lock prevents DDL from taking place.
+--echo # Let's say that all DDL statements that take metadata
+--echo # locks form class #1 -- incompatible with FTWRL because
+--echo # take incompatible MDL table locks.
+--echo # The first global lock doesn't, however, prevent standalone
+--echo # COMMITs (or implicit COMMITs) from taking place, since a
+--echo # COMMIT doesn't take table locks. It doesn't prevent
+--echo # DDL on temporary tables either, since they don't
+--echo # take any table locks either.
+--echo # Most DDL statements do not perform an implicit commit
+--echo # if operate on a temporary table. Examples are CREATE
+--echo # TEMPORARY TABLE and DROP TEMPORARY TABLE. 
+--echo # Thus, these DDL statements can go through in presence
+--echo # of FTWRL. This is class #2 -- compatible because
+--echo # do not take incompatible MDL locks and do not issue
+--echo # implicit commit..
+--echo # (Although these operations do not commit, their effects
+--echo # cannot be rolled back either.)
+--echo # ALTER TABLE, ANALYZE, OPTIMIZE and some others always
+--echo # issue an implicit commit, even if its argument is a
+--echo # temporary table. 
+--echo # *Howewer* an implicit commit is a no-op if all engines
+--echo # used since the start of transactiona are non-
+--echo # transactional. Thus, for non-transactional engines,
+--echo # these operations are not blocked by FTWRL.
+--echo # This is class #3 -- compatible because do not take
+--echo # MDL table locks and are non-transactional. 
+--echo # On the contrary, for transactional engines, there
+--echo # is always a commit, regardless of whether a table
+--echo # is temporary or not. Thus, for example, ALTER TABLE
+--echo # for a transactional engine will wait for FTWRL, 
+--echo # even if the subject table is temporary.
+--echo # Thus ALTER TABLE <temporary> is incompatible
+--echo # with FTWRL. This is class #4 -- incompatible
+--echo # becuase issue implicit COMMIT which is not a no-op.
+--echo # Finally, there are administrative statements (such as 
+--echo # RESET SLAVE) that do not take any locks and do not
+--echo # issue COMMIT.
+--echo # This is class #5.
+--echo # The goal of this coverage is to test statements
+--echo # of all classes.
+--echo # @todo: documents the effects of @@autocommit,
+--echo # DML and temporary transactional tables.
+
+--echo # Use MyISAM engine for the most of the tables
+--echo # used in this test in order to be able to 
+--echo # check that DDL statements on temporary tables
+--echo # are compatible with FTRWL. 
 --disable_warnings
 drop tables if exists t1_base, t2_base, t3_trans;
 drop database if exists mysqltest1;
+--echo # We're going to test ALTER DATABASE UPGRADE
 drop database if exists `#mysql50#mysqltest-2`;
 drop procedure if exists p1;
 drop function if exists f1;
@@ -83,7 +131,7 @@ let $cleanup_stmt1= alter table t1_base 
 --source include/check_ftwrl_incompatible.inc
 
 --echo #
---echo # 1.1.b) For temporaty table should be compatible with FTWRL.
+--echo # 1.1.b) For a temporary table should be compatible with FTWRL.
 --echo #
 let $statement= alter table t1_temp add column c1 int;
 let $cleanup_stmt= alter table t1_temp drop column c1;
@@ -136,12 +184,14 @@ let $cleanup_stmt1= alter event e1 comme
 
 --echo #
 --echo # 1.x) The rest of ALTER statements are too special to
---echo #      to be tested here.
+--echo #      be tested here.
 --echo #
 
 
 --echo #
 --echo # 2) ANALYZE TABLE statement is compatible with FTWRL.
+--echo # See Bug#43336 ANALYZE and OPTIMIZE do not honour
+--echo #  --read-only for a discussion why.
 --echo #
 let $statement= analyze table t1_base;
 let $cleanup_stmt= ;
@@ -169,8 +219,9 @@ rollback;
 --echo # Similarly to ROLLBACK it is a no-op in this situation.
 commit;
 unlock tables;
---echo # Check that BEGIN/ROLLBACK are not and COMMIT is
---echo # blocked by active FTWRL in another connection
+--echo # Check that BEGIN/ROLLBACK are not blocked and 
+--echo # COMMIT is blocked by active FTWRL in another
+--echo # connection.
 --echo #
 --echo # Switching to connection '$con_aux1'.
 connection $con_aux1;
@@ -282,12 +333,12 @@ let $skip_3rd_check= ;
 
 --echo #
 --echo # 5) CALL statement. This statement uses resources in two
---echo #    ways through expressions used as parameters and through
+--echo #    ways: through expressions used as parameters and through
 --echo #    sub-statements. This test covers only usage through
 --echo #    parameters as sub-statements do locking individually.
 --echo #
---echo # 5.a) In simple case parameter expression should be compatible
---echo #      with FTWRL.
+--echo # 5.a) In simple cases a parameter expression should be
+--echo #      compatible with FTWRL.
 let $statement= call p2((select count(*) from t1_base));
 let $cleanup_stmt1= ;
 --echo # Skip last part of compatibility testing as this statement
@@ -297,7 +348,7 @@ let $skip_3rd_check= 1;
 let $skip_3rd_check= ;
 
 --echo #
---echo # 5.b) In case when expression uses function which updates
+--echo # 5.b) In case when an expression uses function which updates
 --echo #      base tables CALL should be incompatible with FTWRL.
 --echo #
 let $statement= call p2(f2_base());
@@ -380,13 +431,13 @@ let $cleanup_stmt= drop temporary table 
 
 --echo # 8.2) CREATE INDEX statement.
 --echo #
---echo # 8.2.a) CREATE TABLE is incompatible with FTWRL when
+--echo # 8.2.a) CREATE INDEX is incompatible with FTWRL when
 --echo #        applied to base table.
 let $statement= create index i on t1_base (i);
 let $cleanup_stmt1= drop index i on t1_base;
 --source include/check_ftwrl_incompatible.inc
 
---echo # 8.2.b) CREATE TABLE is compatible with FTWRL when
+--echo # 8.2.b) CREATE INDEX is compatible with FTWRL when
 --echo #        applied to temporary table.
 let $statement= create index i on t1_temp (i);
 let $cleanup_stmt= drop index i on t1_temp;
@@ -635,7 +686,7 @@ let $cleanup_stmt= create temporary tabl
 --echo #
 --echo # 13.2) DROP INDEX.
 --echo #
---echo # 13.2.a) DROP INDEX for base table is incompatible with FTWRL.
+--echo # 13.2.a) DROP INDEX on a base table is incompatible with FTWRL.
 create index i on t1_base (i);
 let $statement= drop index i on t1_base;
 let $cleanup_stmt1= create index i on t1_base (i);
@@ -643,7 +694,7 @@ let $cleanup_stmt1= create index i on t1
 drop index i on t1_base;
 
 --echo #
---echo # 13.2.b) DROP INDEX for temporary table is compatible with FTWRL.
+--echo # 13.2.b) DROP INDEX on a temporary table is compatible with FTWRL.
 create index i on t1_temp (i);
 let $statement= drop index i on t1_temp;
 let $cleanup_stmt= create index i on t1_temp (i);


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20101021192420-c56akqvrtist11oh.bundle
Thread
bzr commit into mysql-5.5-runtime branch (kostja:3173) Bug#54673Konstantin Osipov21 Oct