Below is the list of changes that have just been committed into a local
5.1 repository of ramil. When ramil 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@stripped, 2008-04-07 13:34:55+05:00, ramil@stripped +3 -0
Fix for bug #35732: read-only blocks SELECT statements in InnoDB
Problem: SELECTs prohibited for a transactional SE in autocommit mode
if read_only is set.
Fix: allow them.
mysql-test/r/read_only_innodb.result@stripped, 2008-04-07 13:34:53+05:00, ramil@stripped +12
-0
Fix for bug #35732: read-only blocks SELECT statements in InnoDB
- test result.
mysql-test/t/read_only_innodb.test@stripped, 2008-04-07 13:34:53+05:00, ramil@stripped +22
-0
Fix for bug #35732: read-only blocks SELECT statements in InnoDB
- test case.
sql/handler.cc@stripped, 2008-04-07 13:34:53+05:00, ramil@stripped +4 -5
Fix for bug #35732: read-only blocks SELECT statements in InnoDB
- in autocommit mode thd->transaction.all list is empty thus
is_real_trans set to TRUE for any SELECTs, so using it in the
"read_only" check is wrong. Use 'all' flag which means "explicit
commit issued by user, or an implicit commit issued by a DDL"
instead.
diff -Nrup a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result
--- a/mysql-test/r/read_only_innodb.result 2006-11-21 07:40:31 +04:00
+++ b/mysql-test/r/read_only_innodb.result 2008-04-07 13:34:53 +05:00
@@ -16,3 +16,15 @@ ERROR HY000: The MySQL server is running
set global read_only=0;
drop table table_11733 ;
drop user test@localhost;
+GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
+CREATE TABLE t1(a INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (0), (1);
+SET GLOBAL read_only=1;
+SELECT * FROM t1;
+a
+0
+1
+SET GLOBAL read_only=0;
+DROP TABLE t1;
+DROP USER test@localhost;
+echo End of 5.1 tests
diff -Nrup a/mysql-test/t/read_only_innodb.test b/mysql-test/t/read_only_innodb.test
--- a/mysql-test/t/read_only_innodb.test 2006-11-21 07:40:31 +04:00
+++ b/mysql-test/t/read_only_innodb.test 2008-04-07 13:34:53 +05:00
@@ -36,8 +36,30 @@ select * from table_11733 ;
-- error ER_OPTION_PREVENTS_STATEMENT
COMMIT;
+disconnect con1;
+
connection default;
set global read_only=0;
drop table table_11733 ;
drop user test@localhost;
+#
+# Bug #35732: read-only blocks SELECT statements in InnoDB
+#
+GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
+CREATE TABLE t1(a INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (0), (1);
+SET GLOBAL read_only=1;
+
+connect(con1, localhost, test, , test);
+connection con1;
+SELECT * FROM t1;
+
+disconnect con1;
+
+connection default;
+SET GLOBAL read_only=0;
+DROP TABLE t1;
+DROP USER test@localhost;
+
+--echo echo End of 5.1 tests
diff -Nrup a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc 2008-03-12 12:13:19 +04:00
+++ b/sql/handler.cc 2008-04-07 13:34:53 +05:00
@@ -1071,11 +1071,10 @@ int ha_commit_trans(THD *thd, bool all)
DBUG_RETURN(1);
}
- if ( is_real_trans
- && opt_readonly
- && ! (thd->security_ctx->master_access & SUPER_ACL)
- && ! thd->slave_thread
- )
+ if (all &&
+ opt_readonly &&
+ !(thd->security_ctx->master_access & SUPER_ACL) &&
+ !thd->slave_thread)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
ha_rollback_trans(thd, all);