mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
null-merge from perfschema-5.6 merge tree
(only new files and small style changes are accepted)
This commit is contained in:
188
mysql-test/suite/perfschema/include/binlog_edge_common.inc
Normal file
188
mysql-test/suite/perfschema/include/binlog_edge_common.inc
Normal file
@ -0,0 +1,188 @@
|
||||
# Test replication, when using special non-replicated tables.
|
||||
#
|
||||
# This test involve special statements that use non-replicated tables.
|
||||
# Changes affecting non replicated tables are never written to the binlog.
|
||||
# Executing these statements may or may not work, as the statements involved
|
||||
# are edge cases.
|
||||
# In MIXED or ROW binlog format, execution should succeed,
|
||||
# and only partial data (the rows affecting replicated tables only)
|
||||
# should be written to the binlog.
|
||||
# In STATEMENT binlog format, execution should
|
||||
# raise a warning (ER_BINLOG_UNSAFE_STATEMENT) if a non replicated table is
|
||||
# only read from, or fail with an error (ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES)
|
||||
# if a non replicated table is written to.
|
||||
#
|
||||
# SHOW ERRORS will print in the
|
||||
# test .result file the exact outcome.
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists my_replicated_db;
|
||||
--enable_warnings
|
||||
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
create database my_replicated_db;
|
||||
|
||||
create table my_replicated_db.my_tx_table(a bigint) engine = innodb;
|
||||
create table my_replicated_db.my_non_tx_table(a bigint) engine = myisam;
|
||||
create table my_replicated_db.my_bh_table(a bigint) engine = blackhole;
|
||||
|
||||
use test;
|
||||
drop table if exists marker_start;
|
||||
|
||||
use my_replicated_db;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
values (1000), (2000), (3000);
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
values (1000), (2000), (3000);
|
||||
|
||||
insert into my_bh_table(a)
|
||||
values (1000), (2000), (3000);
|
||||
|
||||
use test;
|
||||
drop table if exists marker_insert_select;
|
||||
|
||||
use my_replicated_db;
|
||||
|
||||
# Note:
|
||||
# The queries used here do not make any sense (no semantic).
|
||||
# What this test is interrested in, is check the behavior
|
||||
# when replicating queries that mix both:
|
||||
# - non replicated tables
|
||||
# - replicated tables
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select thread_id from performance_schema.threads;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select thread_id from performance_schema.threads;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select thread_id from performance_schema.threads;
|
||||
|
||||
# For the information_schema,
|
||||
# no error is enforced yet.
|
||||
# Documenting the current behavior
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select id from information_schema.processlist;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select id from information_schema.processlist;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select id from information_schema.processlist;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select thread_id from mysql.general_log;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select thread_id from mysql.general_log;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select thread_id from mysql.general_log;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select thread_id from mysql.slow_log;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select thread_id from mysql.slow_log;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select thread_id from mysql.slow_log;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_relay_log_info;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_relay_log_info;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select Relay_log_pos from mysql.slave_relay_log_info;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select Master_log_pos from mysql.slave_master_info;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select Master_log_pos from mysql.slave_master_info;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select Master_log_pos from mysql.slave_master_info;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_worker_info;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_worker_info;
|
||||
|
||||
insert into my_bh_table(a)
|
||||
select Relay_log_pos from mysql.slave_worker_info;
|
||||
|
||||
use test;
|
||||
drop table if exists marker_multi_update;
|
||||
|
||||
use my_replicated_db;
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
update my_tx_table, performance_schema.setup_instruments
|
||||
set my_tx_table.a = my_tx_table.a + 1,
|
||||
performance_schema.setup_instruments.timed= 'NO';
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
update my_non_tx_table, performance_schema.setup_instruments
|
||||
set my_non_tx_table.a = my_non_tx_table.a + 1,
|
||||
performance_schema.setup_instruments.timed= 'NO';
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
update my_bh_table, performance_schema.setup_instruments
|
||||
set my_bh_table.a = my_bh_table.a + 1,
|
||||
performance_schema.setup_instruments.timed= 'NO';
|
||||
|
||||
use test;
|
||||
drop table if exists marker_multi_delete;
|
||||
|
||||
use my_replicated_db;
|
||||
|
||||
insert into performance_schema.setup_actors
|
||||
values ('FOO', 'FOO', 'FOO');
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
delete my_tx_table.*, performance_schema.setup_actors.*
|
||||
from my_tx_table, performance_schema.setup_actors
|
||||
where my_tx_table.a != 1000
|
||||
or performance_schema.setup_actors.role='FOO';
|
||||
|
||||
insert into performance_schema.setup_actors
|
||||
values ('BAR', 'BAR', 'BAR');
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
delete my_non_tx_table.*, performance_schema.setup_actors.*
|
||||
from my_non_tx_table, performance_schema.setup_actors
|
||||
where my_non_tx_table.a != 1000
|
||||
or performance_schema.setup_actors.role='BAR';
|
||||
|
||||
insert into performance_schema.setup_actors
|
||||
values ('BAZ', 'BAZ', 'BAZ');
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
delete my_bh_table.*, performance_schema.setup_actors.*
|
||||
from my_bh_table, performance_schema.setup_actors
|
||||
where my_bh_table.a != 1000
|
||||
or performance_schema.setup_actors.role='BAZ';
|
||||
|
||||
use test;
|
||||
drop table if exists marker_end;
|
||||
|
||||
drop database my_replicated_db;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# Restore performance_schema.setup_actors, damaged by this script
|
||||
|
||||
truncate table performance_schema.setup_actors;
|
||||
insert into performance_schema.setup_actors values ('%', '%', '%');
|
||||
|
146
mysql-test/suite/perfschema/include/binlog_ok_common.inc
Normal file
146
mysql-test/suite/perfschema/include/binlog_ok_common.inc
Normal file
@ -0,0 +1,146 @@
|
||||
# Test replication, when using special non-replicated tables.
|
||||
#
|
||||
# This test involve special statements that use non-replicated tables.
|
||||
# Changes affecting non replicated tables are never written to the binlog.
|
||||
# Executing these statements should work nicely with replication in all cases:
|
||||
# - STATEMENT binlog format
|
||||
# - MIXED binlog format
|
||||
# - ROW binlog format.
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists my_local_db;
|
||||
--enable_warnings
|
||||
|
||||
create database my_local_db;
|
||||
|
||||
create table my_local_db.my_tx_table(a bigint) engine = innodb;
|
||||
create table my_local_db.my_non_tx_table(a bigint) engine = myisam;
|
||||
|
||||
use test;
|
||||
drop table if exists marker_start;
|
||||
|
||||
# --binlog-ignore-db only works with the current database.
|
||||
use my_local_db;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
values (1000), (2000), (3000);
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
values (1000), (2000), (3000);
|
||||
|
||||
use test;
|
||||
drop table if exists marker_truncate;
|
||||
|
||||
use performance_schema;
|
||||
truncate table events_waits_history;
|
||||
truncate table events_waits_history_long;
|
||||
|
||||
use test;
|
||||
truncate table performance_schema.events_statements_history_long;
|
||||
truncate table performance_schema.host_cache;
|
||||
|
||||
use test;
|
||||
drop table if exists marker_update;
|
||||
|
||||
use performance_schema;
|
||||
update setup_instruments set enabled='NO';
|
||||
update setup_instruments set timed='NO';
|
||||
use test;
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES';
|
||||
update performance_schema.threads set instrumented='YES';
|
||||
|
||||
use test;
|
||||
drop table if exists marker_insert;
|
||||
|
||||
insert into performance_schema.setup_actors(`user`, `host`, `role`)
|
||||
values ('XXX', 'XXX', 'XXX'),
|
||||
('YYY', 'YYY', 'YYY'),
|
||||
('ZZZ', 'ZZZ', 'ZZZ');
|
||||
|
||||
select * from performance_schema.setup_actors
|
||||
where user in ('XXX', 'YYY', 'ZZZ') order by user;
|
||||
|
||||
insert into performance_schema.setup_objects
|
||||
(object_type, object_schema, object_name, enabled, timed)
|
||||
values ('TABLE', 'DB1', 'AAA', 'YES', 'YES'),
|
||||
('TABLE', 'DB1', 'BBB', 'NO', 'NO'),
|
||||
('TABLE', 'DB2', 'CCC', 'YES', 'NO'),
|
||||
('TABLE', 'DB2', 'DDD', 'NO', 'YES');
|
||||
|
||||
select * from performance_schema.setup_objects
|
||||
where object_schema like 'DB%' order by object_name;
|
||||
|
||||
use test;
|
||||
drop table if exists marker_insert_select;
|
||||
|
||||
# Note:
|
||||
# The queries used here do not make any sense (no semantic).
|
||||
# What this test is interrested in, is check the behavior
|
||||
# when replicating queries that mix both:
|
||||
# - non replicated tables
|
||||
# - replicated tables
|
||||
|
||||
use my_local_db;
|
||||
insert into my_tx_table(a)
|
||||
select thread_id from performance_schema.threads;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select thread_id from performance_schema.threads;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select id from information_schema.processlist;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select id from information_schema.processlist;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select thread_id from mysql.general_log;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select thread_id from mysql.general_log;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select thread_id from mysql.slow_log;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select thread_id from mysql.slow_log;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_relay_log_info;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_relay_log_info;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select Master_log_pos from mysql.slave_master_info;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select Master_log_pos from mysql.slave_master_info;
|
||||
|
||||
insert into my_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_worker_info;
|
||||
|
||||
insert into my_non_tx_table(a)
|
||||
select Relay_log_pos from mysql.slave_worker_info;
|
||||
|
||||
use test;
|
||||
drop table if exists marker_delete;
|
||||
|
||||
delete from performance_schema.setup_actors
|
||||
where user in ('XXX', 'YYY', 'ZZZ');
|
||||
|
||||
delete from performance_schema.setup_objects
|
||||
where object_schema like 'DB%';
|
||||
|
||||
use test;
|
||||
drop table if exists marker_end;
|
||||
|
||||
drop database my_local_db;
|
||||
|
||||
# The content of the binlog dumped in the result file
|
||||
# should not contain any references to non-replicated tables.
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
13
mysql-test/suite/perfschema/include/have_aligned_memory.inc
Normal file
13
mysql-test/suite/perfschema/include/have_aligned_memory.inc
Normal file
@ -0,0 +1,13 @@
|
||||
# The performance schema internal structures are compiled with PFS_ALIGN,
|
||||
# and the sizeof() structures is platform dependent.
|
||||
#
|
||||
# For tests sensitive to the internal sizes (show engine performance_schema
|
||||
# status), make sure we use a platform with aligned memory.
|
||||
|
||||
--disable_query_log
|
||||
let $aligned = `SELECT count(*) from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`;
|
||||
if (!$aligned)
|
||||
{
|
||||
skip Need a platform with aligned memory;
|
||||
}
|
||||
--enable_query_log
|
Reference in New Issue
Block a user