File: rpl_drop.test

package info (click to toggle)
mysql-5.1 5.1.73-1%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 197,132 kB
  • ctags: 93,377
  • sloc: cpp: 579,952; ansic: 429,462; perl: 49,053; sh: 21,692; pascal: 21,272; yacc: 12,801; makefile: 4,545; xml: 4,114; sql: 3,297; lex: 1,265; asm: 1,023
file content (66 lines) | stat: -rw-r--r-- 2,026 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Testcase for BUG#4552 (DROP on two tables, one of which does not
# exist, must be binlogged with a non-zero error code)
source include/master-slave.inc;
source include/have_innodb.inc;

create table t1 (a int);
--error 1051
drop table t1, t2;
--sync_slave_with_master

# End of 4.1 tests

# BUG#55625 RBR breaks on failing 'CREATE TABLE'
# A CREATE...SELECT that fails is written to the binary log if a non-transactional
# statement is updated. If the logging format is ROW, the CREATE statement and the
# changes are written to the binary log as distinct events and by consequence the
# created table is not rolled back in the slave.
# To fix the problem, we do not write a CREATE...SELECT that fails to the binary
# log. Howerver, the changes to non-transactional tables are not replicated and
# thus the slave goes out of sync. This should be fixed after BUG#47899.
#
# In the test case, we verify if the binary log contains no information for a
# CREATE...SELECT that fails.
connection slave;

--source include/stop_slave.inc
SET @old_binlog_format= @@global.binlog_format;
SET GLOBAL binlog_format = ROW;
--source include/start_slave.inc

connection master;
SET @old_binlog_format= @@global.binlog_format;
SET binlog_format = ROW;

CREATE TABLE t2(a INT) ENGINE=MYISAM;
CREATE TABLE t3(a INT) ENGINE=INNODB;

delimiter |;
CREATE FUNCTION f1() RETURNS INT
BEGIN
  insert into t2 values(1);
  insert into t3 values(1);
  return 1;
END|
delimiter ;|

let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1);

--error 1062
CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1();
--error 1062
CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1();

--source include/show_binlog_events.inc

DROP FUNCTION f1;
DROP TABLE t2, t3;
SET @@global.binlog_format= @old_binlog_format;

--sync_slave_with_master
SET @@global.binlog_format= @old_binlog_format;

# End of 5.1 tests

--source include/rpl_end.inc