File: rpl_unsafe_statements_myisam.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (48 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download
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
################################################################################
# Bug#17047208 REPLICATION DIFFERENCE FOR MULTIPLE TRIGGERS
# Problem: If DML invokes a trigger or a stored function that inserts into an
# AUTO_INCREMENT column, that DML has to be marked as 'unsafe' statement. If the
# tables are locked in the transaction prior to DML statement (using LOCK
# TABLES), then the DML statement is not marked as 'unsafe' statement.

# Steps to reproduce the reported test case (BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS)
#
#  This test script adds test case to cover few other unsafe statements.
#    Case-1: BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST
################################################################################
--source include/force_myisam_default.inc
--source include/have_myisam.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc

# Case-1: BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST
#  INSERT into autoincrement field which is not the first part in the
#  composed primary key is unsafe
#
# Step-1.1: Create a table with auto increment column and a composed primary key
# (second column is auto increment column). Such a definition is allowed only
# with 'myisam' engine.
CREATE TABLE t1(i int, id INT AUTO_INCREMENT, PRIMARY KEY (i, id)) ENGINE=MYISAM;

# Step-1.2: Inserting into such a table is unsafe.
INSERT INTO t1 (i) values (1);

# Step-1.3: Repeat step 3.2, now with 'LOCK TABLES' logic.
START TRANSACTION;
LOCK TABLES t1 WRITE;
INSERT INTO t1 (i) values (2);
UNLOCK TABLES;
COMMIT;

# Step-1.4: Sync slave with master
--sync_slave_with_master

# Step-1.5: Diff master-slave tables to make sure everything is in sync.
--let $diff_tables=master:t1, slave:t1
--source include/diff_tables.inc

# Step-1.6: Cleanup
--connection master
DROP TABLE t1;

--source include/rpl_end.inc