diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-01-30 22:13:36 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-01-30 22:13:36 +0300 |
commit | 0da16c7c2ab511b05270d2e779ef89077270a16e (patch) | |
tree | fa297f7fa59f84c3c05e83388795c51d18dd89a7 /mysql-test/extra/rpl_tests | |
parent | 5aa4c33e3233e2c1cac9f3bb0b17379a56503666 (diff) | |
parent | d9e9a73e8f1355a24b27d64d56d555d045ee0b4c (diff) | |
download | mariadb-git-0da16c7c2ab511b05270d2e779ef89077270a16e.tar.gz |
Manual merge from mysql-5.1-bugteam.
Conflicts:
- mysql-test/collections/default.experimental
- mysql-test/suite/rpl/r/rpl_binlog_grant.result
- mysql-test/suite/rpl/r/rpl_sp.result
- mysql-test/suite/rpl/t/rpl_binlog_grant.test
- mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
Diffstat (limited to 'mysql-test/extra/rpl_tests')
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_current_user.test | 127 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_set_null.test | 86 |
2 files changed, 213 insertions, 0 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_current_user.test b/mysql-test/extra/rpl_tests/rpl_current_user.test new file mode 100644 index 00000000000..7ec38e0c151 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_current_user.test @@ -0,0 +1,127 @@ +--let $count=1 +connection master; + +if (`SELECT '$diff_table' = ''`) +{ + let $diff_table= mysql.user; +} + +--echo +--echo +--echo +--echo TEST STATEMENT: '$statement' +--echo -------------------------------------------------------------------------- + +if (`SELECT '$diff_columns' = ''`) +{ + eval CREATE VIEW test.bug48321_v1 AS SELECT user FROM $diff_table + WHERE user LIKE 'bug48321%'; +} + +if (`SELECT '$diff_columns' <> ''`) +{ + eval CREATE VIEW test.bug48321_v1 AS SELECT user, $diff_columns + FROM $diff_table WHERE user LIKE 'bug48321%'; +} + +while (`SELECT $count < 6`) +{ + --echo + --echo TEST STATEMENT: '$statement' + --echo CASE $count: + --echo ------- + + let $user2= 'bug48321_2'@'localhost'; + let $user3= 'bug48321_3'@'localhost'; + + let $user1= CURRENT_USER(); + if (`SELECT '$action'='RENAME'`) + { + let $user1= $user1 TO 'bug48321_4'@'localhost'; + let $user2= $user2 TO 'bug48321_5'@'localhost'; + let $user3= $user3 TO 'bug48321_6'@'localhost'; + } + + if (`SELECT '$action'='GRANT'`) + { + let $user1= $user1 IDENTIFIED BY 'user1'; + let $user3= $user3 IDENTIFIED BY ''; + } + + if (`SELECT $count=1`) + { + --echo # Only CURRENT_USER() in the user list of the test statement. + let $users_list= $user1; + } + + if (`SELECT $count=2`) + { + --echo # Two users are in the test statement, CURRENT_USER is the first one. + let $users_list= $user1, $user2; + } + + if (`SELECT $count=3`) + { + --echo # Two users are in the test statement, CURRENT_USER is the last one. + let $users_list= $user2, $user1; + } + + if (`SELECT $count=4`) + { + --echo # Three users are in the test statement, CURRENT_USER is the second one. + let $users_list= $user2, $user1, $user3; + } + + if (`SELECT $count=5`) + { + --echo # CURRENT_USER is not in the test statement. + let $users_list= $user2, $user3; + } + + --echo users_list= $users_list + --echo + --echo # Connect to master with user1, so user1 always is the current user, + --echo # when test statement is runing. + eval GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1'@'localhost' + WITH GRANT OPTION; + eval CREATE USER 'bug48321_2'@'localhost', 'bug48321_3'@'localhost' + IDENTIFIED BY 'user3'; + + if (`SELECT '$action'='REVOKE'`) + { + --echo + --echo # Grant some privileges to users at first when testing + --echo # 'REVOKE ...' statement. + eval GRANT ALL PRIVILEGES ON *.* TO 'bug48321_2'@'localhost', + 'bug48321_3'@'localhost' WITH GRANT OPTION; + eval GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO 'bug48321_1'@'localhost', + 'bug48321_2'@'localhost', 'bug48321_3'@'localhost'; + } + + connect (conn1, 127.0.0.1, 'bug48321_1'@'localhost',,); + connection conn1; + --echo + let $temp= `SELECT "$statement"`; + eval $temp; + --echo + + disconnect conn1; + + connection master; + sync_slave_with_master; + + connection master; + let $diff_table_1= master:test.bug48321_v1; + let $diff_table_2= slave:test.bug48321_v1; + source include/diff_tables.inc; + --echo + + --echo # Delete all bug48321% users + connection master; + DELETE FROM mysql.user WHERE user LIKE 'bug48321%'; + DELETE FROM mysql.procs_priv WHERE user LIKE 'bug48321%'; + FLUSH PRIVILEGES; + + inc $count; +} +DROP VIEW test.bug48321_v1; diff --git a/mysql-test/extra/rpl_tests/rpl_set_null.test b/mysql-test/extra/rpl_tests/rpl_set_null.test new file mode 100644 index 00000000000..f2aba089279 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_set_null.test @@ -0,0 +1,86 @@ +# Both of the following tests check that comparison of binlog BI +# against SE record will not fail due to remains from previous values +# in the SE record (before a given field was set to null). +# +# In MIXED mode: +# - Insert and update are executed as statements +# - Delete is executed as a row event +# - Assertion: checks that comparison will not fail because the update +# statement will clear the record contents for the nulled +# field. If data was not cleared, some engines may keep +# the value and return it later as garbage - despite the +# fact that field is null. This may cause slave to +# falsely fail in the comparison (memcmp would fail +# because of "garbage" in record data). +# +# In ROW mode: +# - Insert, update and delete are executed as row events. +# - Assertion: checks that comparison will not fail because the update +# rows event will clear the record contents before +# feeding the new value to the SE. This protects against +# SEs that do not clear record contents when storing +# nulled fields. If the engine did not clear the data it +# would cause slave to falsely fail in the comparison +# (memcmp would fail because of "garbage" in record +# data). This scenario is pretty much the same described +# above in MIXED mode, but checks different execution +# path in the slave. + +# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on +# delete cant find record + +-- source include/master-slave-reset.inc + +-- connection master +-- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine +INSERT INTO `t1` VALUES ( 1, 1 ); +UPDATE t1 SET c1=NULL where c2=1; +-- sync_slave_with_master + +-- let $diff_table_1=master:test.t1 +-- let $diff_table_2=slave:test.t1 +-- source include/diff_tables.inc + +-- connection master +# triggers switch to row mode when on mixed +DELETE FROM t1 WHERE c2=1 LIMIT 1; +-- sync_slave_with_master + +-- let $diff_table_1=master:test.t1 +-- let $diff_table_2=slave:test.t1 +-- source include/diff_tables.inc + +-- connection master +DROP TABLE t1; +-- sync_slave_with_master + +-- source include/master-slave-reset.inc + +-- connection master + +# BUG#49482: RBR: Replication may break on deletes when MyISAM tables +# + char field are used + +-- eval CREATE TABLE t1 (c1 CHAR) Engine=$engine + +INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; +SELECT * FROM t1; +UPDATE t1 SET c1=NULL WHERE c1='w'; +-- sync_slave_with_master + +-- let $diff_table_1=master:test.t1 +-- let $diff_table_2=slave:test.t1 +-- source include/diff_tables.inc + +-- connection master +# triggers switch to row mode when on mixed +DELETE FROM t1 LIMIT 2; +-- sync_slave_with_master + +-- let $diff_table_1=master:test.t1 +-- let $diff_table_2=slave:test.t1 +-- source include/diff_tables.inc + +-- connection master +DROP TABLE t1; +-- sync_slave_with_master |