List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:January 3 2006 11:32pm
Subject:bk commit into 5.0 tree (aelkin:1.2010)
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.2010 06/01/04 01:32:09 aelkin@stripped +2 -0
  A test case for 9483/180 to ignore grant/revoke by the slave only if
  --replicate-wild-ignore-table=mysql.% 
  is provided.

  mysql-test/t/rpl_grant_ignore.test
    1.1 06/01/04 01:32:03 aelkin@stripped +126 -0
    New BitKeeper file ``mysql-test/t/rpl_grant_ignore.test''

  mysql-test/t/rpl_grant_ignore-slave.opt
    1.1 06/01/04 01:32:03 aelkin@stripped +1 -0
    options to start slave server in checking of grant_ignore

  mysql-test/t/rpl_grant_ignore.test
    1.0 06/01/04 01:32:03 aelkin@stripped +0 -0
    BitKeeper file /usr_rh9/home/elkin.rh9/MySQL/mysql-5.0-bug9483/mysql-test/t/rpl_grant_ignore.test

  mysql-test/t/rpl_grant_ignore-slave.opt
    1.0 06/01/04 01:32:03 aelkin@stripped +0 -0
    BitKeeper file /usr_rh9/home/elkin.rh9/MySQL/mysql-5.0-bug9483/mysql-test/t/rpl_grant_ignore-slave.opt

# 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/t/rpl_grant_ignore-slave.opt	06/01/04 01:32:03
--replicate-wild-ignore-table=mysql.%

--- New file ---
+++ mysql-test/t/rpl_grant_ignore.test	06/01/04 01:32:03
# GRANT/REVOKE must not be replicated when 
#        --replicate-wild-ignore-table=mysql.%      BUG#180
#
# There are two more possibilities to reject the queries which 
# I think is better to address in doc
#
# I suggest never use 
# --replicate-ignore-db=mysql for rejection to consider GRANT/REVOKE
# belonging to `cross-database updates' class
#
# The remaining case of BUG#9483 where
#        --replicate-{do-db,wild-do-table} rules list is not empty 
#         and  'mysql.%' is not in there
# is proposed to be an extension of `implicit' rules, namely
# to allow GRANT/REVOKE when the list is not empty and no
# explicit --replicate-wild-ignore-table=mysql.% was provided.

# Feature Request:   It would be nice to have START SLAVE with options
#                   meaning do/reject rules
#
# 
# NOTE: this test is supposed to have rpl_grant_ignore-slave.opt satellite.
#       The test is still runable without the opt file, 
#       to create possibly wrong result.


source include/master-slave.inc;

###  CLEAN-UP: manually duplicate account and a sync table to avoid race cond

connection slave;
stop slave;

connection master;
### --disable_abort_on_error does not work stably, some warn still pass thru
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';
--disable_warnings
drop table if exists dummy;
--enable_warnings
create table dummy (i int);
reset master;

connection slave;
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';
--disable_warnings
drop table if exists dummy;
--enable_warnings
create table dummy (i int);
slave start;


### INIT 

let $max_wait = 10;

connection master;
use test;

connection slave;
use test;

### TEST
## 1. Grant

connection master;
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. 
# Loop has termination on timeout of $max_wait as well.

insert into dummy 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`;
   eval set @max_wait=@max_wait-1;
   --sleep 1
}


select select_priv from mysql.user where user='user_foo' /* slave:empty */;

## 2. Revoke
#connection slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;


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);

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`;
   eval set @max_wait=@max_wait-1;
   --sleep 1
}
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;

### CLEAN-UP

connection master;
drop table dummy;

connection slave;
--disable_abort_on_error
revoke select on *.* FROM 'user_foo';
--enable_abort_on_error

Thread
bk commit into 5.0 tree (aelkin:1.2010)Andrei Elkin4 Jan