Commit 5a2d9853 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

New upstream version 10.1.31

parent de111ba6
#
# Test Galera as a slave to a MariaDB master using GTIDs
#
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
#
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
#
--source include/big_test.inc
--source include/have_innodb.inc
# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
--echo #Connection 2
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1,master_use_gtid=slave_pos;
--enable_query_log
START SLAVE;
--sleep 1
--echo #Connection 1
--connection node_1
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB;
INSERT INTO t2 VALUES(1,11);
INSERT INTO t2 VALUES(2,22);
INSERT INTO t2 VALUES(3,33);
SELECT @@global.gtid_binlog_state;
--source include/save_master_gtid.inc
--echo #Connection 2
--connection node_2
--source include/sync_with_master_gtid.inc
SELECT @@global.gtid_binlog_state;
INSERT INTO t2 VALUES(4,44);
INSERT INTO t2 VALUES(5,55);
INSERT INTO t2 VALUES(6,66);
SELECT @@global.gtid_binlog_state;
--echo #Connection 3
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM t2;
--source include/wait_condition.inc
INSERT INTO t2 VALUES(7,77);
INSERT INTO t2 VALUES(8,88);
SELECT @@global.gtid_binlog_state;
#Perform SST
--echo #Connection 1
--connection node_1
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
--source include/save_master_gtid.inc
--echo #Connection 2
--connection node_2
--source include/sync_with_master_gtid.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
--echo #Connection 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
--let $node_1= node_2
--let $node_2= node_3
--source include/auto_increment_offset_save.inc
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
COMMIT;
--echo #Connection 3
--connection node_3
--echo Starting server ...
--source include/start_mysqld.inc
--source include/wait_until_ready.inc
--source include/auto_increment_offset_restore.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node3_committed_after');
INSERT INTO t1 VALUES ('node3_committed_after');
COMMIT;
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
--source include/wait_condition.inc
Select * from t1 order by f1;
--echo #Connection 3
--connection node_3
Select * from t1 order by f1;
#SST Done
--sleep 1
--echo #Connection 2
--connection node_2
SELECT @@global.gtid_binlog_state;
--echo #Connection 3
--connection node_3
SELECT @@global.gtid_binlog_state;
--echo #Connection 1
--connection node_1
SET AUTOCOMMIT=ON;
#drop table t1;
#CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
--echo #Connection 2
--connection node_2
SET AUTOCOMMIT=ON;
--echo #Connection 3
--connection node_3
SET AUTOCOMMIT=ON;
#
#stop slave on node 2
--echo #Connection 2
--connection node_2
STOP slave;
--sleep 1
INSERT INTO t1 VALUES ('node2_slave_stoped');
--echo #Connection 1
--connection node_1
INSERT INTO t1 VALUES ('node1_normal_entry');
--source include/save_master_gtid.inc
#start slave
--echo #Connection 2
--connection node_2
INSERT INTO t1 VALUES ('node2_slave_stoped_inserted');
start slave;
--source include/sync_with_master_gtid.inc
INSERT INTO t1 VALUES ('node2_slave_started');
SELECT count(*) from t1;
SELECT @@global.gtid_binlog_state;
--echo #Connection 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 12 FROM t1;
--source include/wait_condition.inc
SELECT count(*) from t1;
SELECT @@global.gtid_binlog_state;
--echo #Connection 1
--connection node_1
DROP TABLE t2,t1;
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
# warning is also reported by MTR, which is also weird.
#
--sleep 3
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
--echo #Connection 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--echo #Connection 2
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
reset master;
--echo #Connection 3
--connection node_3
reset master;
--echo #Connection 1
--connection node_1
reset master;
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld]
log-bin
log-slave-updates
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
wsrep-on=1
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
# wsrep-causal-reads=ON
# wsrep-sync-wait=15
[mysqld.1]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep-cluster-address='gcomm://'
wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
[mysqld.3]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
[mysqld.4]
wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep-cluster-address='gcomm://'
wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
[mysqld.5]
wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port'
wsrep_provider_options='base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port'
[mysqld.6]
wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port'
wsrep_provider_options='base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port'
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
NODE_MYPORT_2= @mysqld.2.port
NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket
NODE_MYPORT_5= @mysqld.5.port
NODE_MYSOCK_5= @mysqld.5.socket
NODE_MYPORT_6= @mysqld.6.port
NODE_MYSOCK_6= @mysqld.6.socket
NODE_GALERAPORT_1= @mysqld.1.#galera_port
NODE_GALERAPORT_2= @mysqld.2.#galera_port
NODE_GALERAPORT_3= @mysqld.3.#galera_port
NODE_GALERAPORT_4= @mysqld.4.#galera_port
NODE_GALERAPORT_5= @mysqld.5.#galera_port
NODE_GALERAPORT_6= @mysqld.6.#galera_port
NODE_SSTPORT_1= @mysqld.1.#sst_port
NODE_SSTPORT_2= @mysqld.2.#sst_port
NODE_SSTPORT_3= @mysqld.3.#sst_port
NODE_SSTPORT_4= @mysqld.4.#sst_port
NODE_SSTPORT_5= @mysqld.5.#sst_port
NODE_SSTPORT_6= @mysqld.6.#sst_port
# Check if ipv6 is available.
#
--disable_query_log
--disable_result_log
connect (checkcon123456789,::1,root,,test);
if($mysql_errno)
{
skip No IPv6 support;
}
connection default;
disconnect checkcon123456789;
--enable_result_log
--enable_query_log
# end check
cluster 1 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 1 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 1 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 2 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 2 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 2 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
cluster 1 node 1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 1
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
select * from t1;
cluster_domain_id node_server_id seq_no
1 11 2
2 21 1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 1
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
drop table t1;
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
cluster 2 node 1
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
reset master;
reset master;
reset master;
reset master;
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
cluster 1 node 1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 1
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
select * from t1;
cluster_domain_id node_server_id seq_no
1 11 2
2 21 1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 1
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
drop table t1;
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
cluster 2 node 1
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
reset master;
reset master;
reset master;
reset master;
# We need a dedicated .cnf file, even if empty, in order to force this test to run
# alone on a freshly started cluster. Otherwise there are adverse interactions with
# following tests such as galera_3nodes.galera_var_dirty_reads2
!include ../galera_2x3nodes.cnf
[mysqld.1]
wsrep_gtid_domain_id=1
server-id=11
[mysqld.2]
wsrep_gtid_domain_id=1
server-id=12
[mysqld.3]
wsrep_gtid_domain_id=1
server-id=13
[mysqld.4]
wsrep_gtid_domain_id=2
server-id=21
[mysqld.5]
wsrep_gtid_domain_id=2
server-id=22
[mysqld.6]
wsrep_gtid_domain_id=2
server-id=23
#
# This test creates 2x 3 nodes galera cluster.
# The whole test case
# A <-> B <-> C {Galera cluster 1}
# | {Circular Async replication}
# D <-> E <-> F {Galera cluster 2}
# We will write on any random node to see if gtid is consitent or not
# Then we will kill node D and set up the replication between A and E
# To see whether fail over works or not.
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--connection node_1
--echo cluster 1 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
--connection node_2
--echo cluster 1 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--echo cluster 1 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
--connection node_4
--echo cluster 2 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5
--connection node_5
--echo cluster 2 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6
--connection node_6
--echo cluster 2 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
#--disable_parsing
--connection node_1
--replace_result $NODE_MYPORT_4 NODE_MYPORT_4
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--connection node_4
--replace_result $NODE_MYPORT_1 NODE_MYPORT_1
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--echo cluster 1 node 1
--connection node_1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 1
--connection node_4
select @@gtid_binlog_state;
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
select * from t1;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 2
--connection node_2
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 3
--connection node_3
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 2
--connection node_5
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 3
--connection node_6
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 1
--connection node_1
select @@gtid_binlog_state;
drop table t1;
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--sleep 2
--echo cluster 2 node 1
--connection node_4
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--connection node_2
reset master;
--connection node_3
reset master;
--connection node_5
reset master;
--connection node_6
reset master;
#--enable_parsing
#
# This test creates 2x 3 nodes galera cluster.
# The whole test case
# A <-> B <-> C {Galera cluster 1}
# \ /
# \ /
# / {C->D, F->A , Async normal slave repl}
# / \
# | \
# D <-> E <-> F {Galera cluster 2}
# We will write on any random node to see if gtid is consitent or not
# Then we will kill node D and set up the replication between A and E
# To see whether fail over works or not.
--connection node_1
--replace_result $NODE_MYPORT_6 NODE_MYPORT_6
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--connection node_4
--replace_result $NODE_MYPORT_3 NODE_MYPORT_3
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--echo cluster 1 node 1
--connection node_1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--sleep 2
--echo cluster 2 node 1
--connection node_4
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
select * from t1;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 2
--connection node_2
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 3
--connection node_3
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 2
--connection node_5
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 3
--connection node_6
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 1
--connection node_1
select @@gtid_binlog_state;
drop table t1;
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--echo cluster 2 node 1
--connection node_4
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--connection node_2
reset master;
--connection node_3
reset master;
--connection node_5
reset master;
--connection node_6
reset master;
...@@ -16,7 +16,7 @@ SELECT COUNT(*) = 10 FROM t1; ...@@ -16,7 +16,7 @@ SELECT COUNT(*) = 10 FROM t1;
--exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log --exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log
--exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log --exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log
--source include/kill_galera.inc --source ../galera/include/kill_galera.inc
--sleep 1 --sleep 1
--connection node_1 --connection node_1
......
...@@ -108,7 +108,7 @@ SET SESSION wsrep_on = OFF; ...@@ -108,7 +108,7 @@ SET SESSION wsrep_on = OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc --source include/wait_condition.inc
--source include/kill_galera.inc --source ../galera/include/kill_galera.inc
# #
# Only node #1 should have safe_to_bootstrap: 1 # Only node #1 should have safe_to_bootstrap: 1
......
...@@ -426,6 +426,22 @@ ERROR 42000: Duplicate key name 'c2h' ...@@ -426,6 +426,22 @@ ERROR 42000: Duplicate key name 'c2h'
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
SET GLOBAL innodb_monitor_disable = module_ddl; SET GLOBAL innodb_monitor_disable = module_ddl;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
#
CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
ALTER TABLE t1 ADD UNIQUE(c);
SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
BEGIN;
INSERT INTO t1 VALUES('bar'),('bar');
SET DEBUG_SYNC = 'now SIGNAL dup_done';
ERROR 23000: Duplicate entry 'bar' for key 'c'
SET DEBUG_SYNC = 'RESET';
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE t2,t1;
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_enable = default;
SET GLOBAL innodb_monitor_disable = default; SET GLOBAL innodb_monitor_disable = default;
call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool");
SET @saved_debug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_lru_force_no_free_page";
CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB;
BEGIN;
INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
COMMIT;
SET debug_dbug = @saved_debug;
DROP TABLE t1;
FOUND /InnoDB: Difficult to find free blocks / in mysqld.1.err
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb; key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34); insert into t1 values (14, 24, 34);
set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; set @old_dbug= @@session.debug_dbug;
set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34); replace into t1 values (14, 25, 34);
select * from t1; select * from t1;
f1 f2 f3 f1 f2 f3
14 25 34 14 25 34
drop table t1; drop table t1;
set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; set debug_dbug = @old_dbug;
create temporary table t (a char(1) character set filename) engine=innodb;
drop temporary table t;
set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest; drop database if exists mysqltest;
...@@ -3144,3 +3146,83 @@ show status like "handler_read_key"; ...@@ -3144,3 +3146,83 @@ show status like "handler_read_key";
Variable_name Value Variable_name Value
Handler_read_key 0 Handler_read_key 0
drop table t1; drop table t1;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(0);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
ROLLBACK;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
INSERT INTO t2 VALUES(1);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
COMMIT;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1
1
3
DROP TABLE t2;
CREATE TEMPORARY TABLE t2 (
c1 INT AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
ROLLBACK;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1 c2
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
COMMIT;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1 c2
4 1
7 1
5 2
8 2
6 3
9 3
DROP TABLE t1;
DROP TABLE t2;
set names utf8;
SET UNIQUE_CHECKS=0;
CREATE TABLE corrupt_bit_test_ā(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100),
c INT,
z INT,
INDEX idx(b))
ENGINE=InnoDB;
INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1);
CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b);
CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b);
SELECT * FROM corrupt_bit_test_ā;
a b c z a b c z
1 x 1 1 1 x 1 1
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā;
count(*) count(*)
2 2
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,dict_set_index_corrupted';
check table corrupt_bit_test_ā;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt test.corrupt_bit_test_ā check error Corrupt
SET debug_dbug = @save_dbug;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
ERROR HY000: Index "idx" is corrupted ERROR HY000: Index "idx" is corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
ERROR HY000: Index "idx" is corrupted ERROR HY000: Index "idx" is corrupted
select c from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
show warnings;
Level Code Message Level Code Message
Warning 180 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted Warning 180 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted
Error 1712 Index corrupt_bit_test_ā is corrupted Error 1712 Index corrupt_bit_test_ā is corrupted
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
select * from corrupt_bit_test_ā use index(primary) where a = 10001;
a b c z a b c z
10001 a 20001 20001 10001 a 20001 20001
begin;
insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002);
delete from corrupt_bit_test_ā where a = 10001;
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
rollback;
drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt test.corrupt_bit_test_ā check error Corrupt
set names utf8;
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
show create table corrupt_bit_test_ā;
Table Create Table Table Create Table
corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
`a` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL AUTO_INCREMENT,
...@@ -31,8 +67,12 @@ corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( ...@@ -31,8 +67,12 @@ corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
UNIQUE KEY `idxē` (`z`,`b`), UNIQUE KEY `idxē` (`z`,`b`),
KEY `idx` (`b`) KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
drop index idxē on corrupt_bit_test_ā;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
ERROR HY000: Index "idx" is corrupted ERROR HY000: Index "idx" is corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
ERROR HY000: Index "idx" is corrupted ERROR HY000: Index "idx" is corrupted
show create table corrupt_bit_test_ā;
Table Create Table Table Create Table
corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
`a` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL AUTO_INCREMENT,
...@@ -42,7 +82,12 @@ corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( ...@@ -42,7 +82,12 @@ corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `idx` (`b`) KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
drop index idx on corrupt_bit_test_ā;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
select z from corrupt_bit_test_ā limit 10;
z z
20001 20001
1 1
2 2
drop table corrupt_bit_test_ā;
...@@ -457,8 +457,6 @@ connection default; ...@@ -457,8 +457,6 @@ connection default;
reap; reap;
--enable_parsing --enable_parsing
#remove below con1 disconnect if above test case is enabled #remove below con1 disconnect if above test case is enabled
connection con1;
disconnect con1;
connection default; connection default;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -474,6 +472,31 @@ SET GLOBAL innodb_monitor_disable = module_ddl; ...@@ -474,6 +472,31 @@ SET GLOBAL innodb_monitor_disable = module_ddl;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
--echo #
CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
send ALTER TABLE t1 ADD UNIQUE(c);
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
BEGIN;
INSERT INTO t1 VALUES('bar'),('bar');
SET DEBUG_SYNC = 'now SIGNAL dup_done';
connection default;
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC = 'RESET';
disconnect con1;
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
DROP TABLE t2,t1;
# Check that all connections opened by test cases in this file are really # Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence. # gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
......
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/not_embedded.inc
call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool");
SET @saved_debug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_lru_force_no_free_page";
CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB;
BEGIN;
INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
COMMIT;
SET debug_dbug = @saved_debug;
DROP TABLE t1;
#
# There should be only one message
#
let SEARCH_RANGE= -50000;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--let SEARCH_PATTERN=InnoDB: Difficult to find free blocks
--source include/search_pattern_in_file.inc
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
--default-storage-engine=MyISAM --default-storage-engine=MyISAM
--innodb-strict-mode=0 --innodb-strict-mode=0
--innodb-file-per-table=0 --innodb-file-per-table=0
--loose-innodb-track-changed-pages
--loose-innodb-log-archive
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb; key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34); insert into t1 values (14, 24, 34);
set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; set @old_dbug= @@session.debug_dbug;
set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34); replace into t1 values (14, 25, 34);
select * from t1; select * from t1;
drop table t1; drop table t1;
set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; set debug_dbug = @old_dbug;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
# These files are to be modified ONLY BY INNOBASE guys. #
# #
# Use innodb_mysql.[test|result] files instead. #
# #
# If nevertheless you need to make some changes here, please, forward #
# your commit message #
# To: innodb_dev_ww@oracle.com #
# Cc: dev-innodb@mysql.com #
# (otherwise your changes may be erased). #
# #
#######################################################################
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_innodb_16k.inc -- source include/have_innodb_16k.inc
...@@ -20,6 +5,10 @@ let $MYSQLD_DATADIR= `select @@datadir`; ...@@ -20,6 +5,10 @@ let $MYSQLD_DATADIR= `select @@datadir`;
let collation=utf8_unicode_ci; let collation=utf8_unicode_ci;
--source include/have_collation.inc --source include/have_collation.inc
create temporary table t (a char(1) character set filename) engine=innodb;
drop temporary table t;
set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
# Save the original values of some variables in order to be able to # Save the original values of some variables in order to be able to
...@@ -2530,17 +2519,73 @@ select f1 from t1; ...@@ -2530,17 +2519,73 @@ select f1 from t1;
show status like "handler_read_key"; show status like "handler_read_key";
drop table t1; drop table t1;
####################################################################### #
# # # Test handling of writes to TEMPORARY tables for read-only transactions
# Please, DO NOT TOUCH this file as well as the innodb.result file. # #
# These files are to be modified ONLY BY INNOBASE guys. # CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
# # CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
# Use innodb_mysql.[test|result] files instead. #
# # # Check that the rollback works
# If nevertheless you need to make some changes here, please, forward # START TRANSACTION READ ONLY;
# your commit message # INSERT INTO t2 VALUES(0);
# To: innodb_dev_ww@oracle.com # --error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
# Cc: dev-innodb@mysql.com # INSERT INTO t1 VALUES(0);
# (otherwise your changes may be erased). # ROLLBACK;
# #
####################################################################### SELECT * FROM t1;
SELECT * FROM t2;
START TRANSACTION READ ONLY;
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(1);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
COMMIT;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t2;
# This time with some indexes
CREATE TEMPORARY TABLE t2 (
c1 INT AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
SHOW CREATE TABLE t2;
# Check that the rollback works
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
ROLLBACK;
SELECT * FROM t1;
SELECT * FROM t2;
START TRANSACTION READ ONLY;
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
COMMIT;
SHOW CREATE TABLE t2;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
-- source include/have_debug.inc -- source include/have_debug.inc
-- disable_query_log -- disable_query_log
call mtr.add_suppression("Flagged corruption of idx.*in"); call mtr.add_suppression("Flagged corruption of idx.*in ");
-- enable_query_log
set names utf8; set names utf8;
...@@ -37,9 +38,10 @@ INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; ...@@ -37,9 +38,10 @@ INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā;
# This will flag all secondary indexes corrupted # This will flag all secondary indexes corrupted
SET SESSION debug_dbug="+d,dict_set_index_corrupted"; SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,dict_set_index_corrupted';
check table corrupt_bit_test_ā; check table corrupt_bit_test_ā;
SET SESSION debug_dbug=""; SET debug_dbug = @save_dbug;
# Cannot create new indexes while corrupted indexes exist # Cannot create new indexes while corrupted indexes exist
--error ER_INDEX_CORRUPT --error ER_INDEX_CORRUPT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment