| 1 |
# |
| 2 |
# MDEV-15923 option to control who can set session @@timestamp |
| 3 |
# |
| 4 |
source include/have_binlog_format_statement.inc; |
| 5 |
source include/master-slave.inc; |
| 6 |
|
| 7 |
connection slave; |
| 8 |
select @@secure_timestamp; |
| 9 |
|
| 10 |
--echo ### ALL PRIVILEGES |
| 11 |
disable_abort_on_error; |
| 12 |
set timestamp=1234567890.101112; |
| 13 |
enable_abort_on_error; |
| 14 |
select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'ALL PRIVILEGES'; |
| 15 |
set timestamp=default; |
| 16 |
|
| 17 |
--echo ### SUPER |
| 18 |
create user [email protected]; |
| 19 |
grant super on *.* TO `foo`@`127.0.0.1`; |
| 20 |
connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; |
| 21 |
disable_abort_on_error; |
| 22 |
set timestamp=1234567890.101112; |
| 23 |
enable_abort_on_error; |
| 24 |
select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER'; |
| 25 |
disconnect con2; |
| 26 |
connection slave; |
| 27 |
drop user [email protected]; |
| 28 |
set timestamp=default; |
| 29 |
|
| 30 |
--echo ### BINLOG REPLAY |
| 31 |
create user [email protected]; |
| 32 |
grant binlog replay on *.* TO `foo`@`127.0.0.1`; |
| 33 |
connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; |
| 34 |
disable_abort_on_error; |
| 35 |
set timestamp=1234567890.101112; |
| 36 |
enable_abort_on_error; |
| 37 |
select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'BINLOG REPLAY'; |
| 38 |
disconnect con2; |
| 39 |
connection slave; |
| 40 |
drop user [email protected]; |
| 41 |
set timestamp=default; |
| 42 |
|
| 43 |
--echo ### non-privileged user |
| 44 |
create user [email protected]; |
| 45 |
connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; |
| 46 |
disable_abort_on_error; |
| 47 |
set timestamp=1234567890.101112; |
| 48 |
enable_abort_on_error; |
| 49 |
select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged'; |
| 50 |
disconnect con2; |
| 51 |
connection slave; |
| 52 |
drop user [email protected]; |
| 53 |
set timestamp=default; |
| 54 |
|
| 55 |
### replication |
| 56 |
connection master; |
| 57 |
set time_zone='+00:00'; |
| 58 |
set timestamp=1234567890.101112; |
| 59 |
select @@timestamp, now(6); |
| 60 |
|
| 61 |
create table t1 (b varchar(20), a timestamp(6) default current_timestamp(6)) charset=latin1; |
| 62 |
insert t1 (b) values ('replicated'); |
| 63 |
sync_slave_with_master; |
| 64 |
create trigger t1rbr before insert on t1 for each row set new.a=now(6); |
| 65 |
set @@global.slave_run_triggers_for_rbr= yes; |
| 66 |
binlog 'LQfqWg8BAAAA/AAAAAABAAABAAQAMTAuMy42LU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtB+paEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEEwQADQgICAoKCgFlBcaR'; |
| 67 |
binlog '0gKWSRMBAAAAMQAAAHQDAAAAAB8AAAAAAAEABHRlc3QAAnQxAAIPEQMUAAYBQFUzwA==0gKWSRcBAAAAMAAAAKQDAAAAAB8AAAAAAAEAAv/8BmJpbmxvZ0mWAtIBivg3mwo+'; |
| 68 |
set @@global.slave_run_triggers_for_rbr= default; |
| 69 |
select b, if(a > 20100101, 'READONLY', 'EDITABLE') as 'REPLICATION' from t1; |
| 70 |
connection master; |
| 71 |
#set binlog_format=row; |
| 72 |
#insert t1 (b) values ('binlog'); |
| 73 |
#let datadir=`select @@datadir`; |
| 74 |
#exec $MYSQL_BINLOG $datadir/master-bin.000001; |
| 75 |
drop table t1; |
| 76 |
|
| 77 |
source include/rpl_end.inc; |