File: ndb_binlog_discover_multi.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 (96 lines) | stat: -rw-r--r-- 3,006 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc

--echo #
--echo # Tests to test binlogging after mysqld restart
--echo # This file has tests for the following :
--echo # 1. WL#12731: Improve database synchronization during mysqld startup
--echo # 2. Bug#17250994 BAD BINLOG GENERATION AFTER MISMATCH TABLE DISCOVER
--echo #

--echo # Reset binlogging for test
-- connection server1
reset master;
-- connection server2
reset master;

--echo # Setup
# Setup for Bug#17250994
create table t1 (a int unsigned auto_increment not null primary key)
engine=ndbcluster;

--echo # Shutdown server 1
-- connection server1

# Ignore the warning generated by ndbcluster's binlog thread
# when mysqld is restarted
--disable_query_log ONCE
call mtr.add_suppression("mysqld startup An incident event has been written");

# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
wait
EOF
# Send shutdown to the connected server
--shutdown_server
# Wait until server is down.
--source include/wait_until_disconnected.inc

--echo # Run DDLs to be tested on Server1 startup
-- connection server2

--echo # Alter table while server 1 is down (To test Bug#17250994)
alter table t1 algorithm=inplace, add column b varchar(16);

--echo # Create databases when server 1 is down (To test WL#12731)
create database test_db;
create table test_db.t1(a int) engine ndb;

--echo # Startup server1
-- connection server1
# Write file to make mysql-test-run.pl start up the server again.
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
restart
EOF
# Turn on reconnect.
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again.
--source include/wait_until_connected_again.inc
# Turn off reconnect again.
--disable_reconnect

--echo # Check that the tables are all discovered
show tables;
show tables in test_db;
show create table t1;
show create table test_db.t1;

--echo # Insert into tables and check binlog
-- connection server2
insert into t1 (b) values('String to find');
--echo # Wait for the row to be committed to binlog
--source include/wait_for_ndb_committed_to_binlog.inc

insert into test_db.t1 values (1);
--echo # Wait for the row to be committed to binlog
--source include/wait_for_ndb_committed_to_binlog.inc

--connection server1
--echo # check that data went in ok
select * from t1;
select * from test_db.t1;

--echo # Verify the row was properly binlogged after alter table
FLUSH BINARY LOGS;
let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_regex /(.*\n)/REMOVE_LINE:\1/ /REMOVE_LINE:(.*@2='String to find'\n)/KEEP_LINE:\1/ /REMOVE_LINE:.*\n// /KEEP_LINE://
--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/binlog.000003

--echo # View binlog to verify that INSERTS were written properly
--let $binlog_file=$MYSQLD_DATADIR/binlog.000003
--source include/show_binlog_events.inc

--echo # Cleanup
drop database test_db;
drop table t1;