List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:January 4 2006 2:06pm
Subject:bk commit into 5.0 tree (aelkin:1.2011)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of elkin. When elkin 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.2011 06/01/04 16:06:24 aelkin@stripped +2 -0
  re

  mysql-test/r/rpl_grant_ignore.result
    1.1 06/01/04 16:06:18 aelkin@stripped +56 -0
    New BitKeeper file ``mysql-test/r/rpl_grant_ignore.result''

  mysql-test/r/rpl_grant_ignore.result
    1.0 06/01/04 16:06:18 aelkin@stripped +0 -0
    BitKeeper file /usr_rh9/home/elkin.rh9/MySQL/mysql-5.0-bug9483/mysql-test/r/rpl_grant_ignore.result

  mysql-test/t/rpl_grant_ignore.test
    1.2 06/01/04 16:06:17 aelkin@stripped +29 -17
     small refinements in the test case regarding to sycnronization between master and slave connections

# 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:	aelkin
# Host:	dsl-hkigw8-fe02f800-41.dhcp.inet.fi
# Root:	/usr_rh9/home/elkin.rh9/MySQL/mysql-5.0-bug9483
--- New file ---
+++ mysql-test/r/rpl_grant_ignore.result	06/01/04 16:06:18
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo';
select_priv
N
drop table if exists sync;
create table sync (i int);
reset master;
reset slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo';
select_priv
N
drop table if exists sync;
create table sync (i int);
slave start;
use test;
use test;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* master:must be Y */;
select_priv
Y
insert into sync values (1);
set @max_wait=10;
select (1 - count(*)) from sync /* slave:must be 0 */;
(1 - count(*))
0
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
select_priv
N
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
select_priv
Y
revoke select on *.* from 'user_foo';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
select_priv
N
insert into sync values(2);
set @max_wait=10;
select (2 - count(*)) from sync /* slave:must be 0 */;
(2 - count(*))
0
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
select_priv
Y
drop table sync;
revoke select on *.* FROM 'user_foo';


--- 1.1/mysql-test/t/rpl_grant_ignore.test	2006-01-04 01:32:03 +02:00
+++ 1.2/mysql-test/t/rpl_grant_ignore.test	2006-01-04 16:06:17 +02:00
@@ -37,9 +37,9 @@
 revoke select on *.* from 'user_foo'@'%';
 select select_priv from mysql.user where user='user_foo';
 --disable_warnings
-drop table if exists dummy;
+drop table if exists sync;
 --enable_warnings
-create table dummy (i int);
+create table sync (i int);
 reset master;
 
 connection slave;
@@ -48,9 +48,9 @@
 revoke select on *.* from 'user_foo'@'%';
 select select_priv from mysql.user where user='user_foo';
 --disable_warnings
-drop table if exists dummy;
+drop table if exists sync;
 --enable_warnings
-create table dummy (i int);
+create table sync (i int);
 slave start;
 
 
@@ -71,27 +71,36 @@
 grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
 select select_priv from mysql.user where user='user_foo' /* master:must be Y */;
 
-# The following can be a general solution to avoid race condition
-# between master and slave connections.
-# master does insert
-# and slave waits in the loop for the last time inserted record. 
+# Of course, master and slave syncronizaton can be approached with
+# simple --sleep $max_wait
+# But doing that would a. slow down tests, b. leave it still unreliable
+# while there is a general solution, that is in
+# to create a sync table
+#   master does insert into sync
+#   and slave waits in the loop for the inserted record. 
 # Loop has termination on timeout of $max_wait as well.
+# On the leave from the loop a guard checked wheather slave catched the insert
 
-insert into dummy values(1);
-connection slave;
-
+#### sync pattern
+# connection master
+insert into sync values (1);
 
+connection slave;
 let $not_in_sync=1;
 eval set @max_wait=$max_wait;
 while ($not_in_sync)
 {
-   let $not_in_sync = `select (1 - count(*))*@max_wait from dummy`;
+   let $not_in_sync = `select (1 - count(*))*@max_wait from sync`;
+--disable_query_log
    eval set @max_wait=@max_wait-1;
+--enable_query_log
    --sleep 1
 }
+# to guard wheather we got the record from master
+select (1 - count(*)) from sync /* slave:must be 0 */;
+#### end of sync pattern
 
-
-select select_priv from mysql.user where user='user_foo' /* slave:empty */;
+select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
 
 ## 2. Revoke
 #connection slave;
@@ -102,23 +111,26 @@
 connection master;
 revoke select on *.* from 'user_foo';
 select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-insert into dummy values(2);
+insert into sync values(2);
 
 connection slave;
 let $not_in_sync=1;
 eval set @max_wait=$max_wait;
 while ($not_in_sync)
 {
-   let $not_in_sync = `select (2 - count(*))*@max_wait from dummy`;
+   let $not_in_sync = `select (2 - count(*))*@max_wait from sync`;
+--disable_query_log
    eval set @max_wait=@max_wait-1;
+--enable_query_log
    --sleep 1
 }
+select (2 - count(*)) from sync /* slave:must be 0 */;
 select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
 
 ### CLEAN-UP
 
 connection master;
-drop table dummy;
+drop table sync;
 
 connection slave;
 --disable_abort_on_error
Thread
bk commit into 5.0 tree (aelkin:1.2011)Andrei Elkin4 Jan