mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
775cba4d0f
- FLUSH GLOBAL STATUS now resets most global_status_vars. At this stage, this is mainly to be used for testing. - FLUSH SESSION STATUS added as an alias for FLUSH STATUS. - FLUSH STATUS does not require any privilege (before required RELOAD). - FLUSH GLOBAL STATUS requires RELOAD privilege. - All global status reset moved to FLUSH GLOBAL STATUS. - Replication semisync status variables are now reset by FLUSH GLOBAL STATUS. - In test cases, the only changes are: - Replace FLUSH STATUS with FLUSH GLOBAL STATUS - Replace FLUSH STATUS with FLUSH STATUS; FLUSH GLOBAL STATUS. This was only done in a few tests where the test was using SHOW STATUS for both local and global variables. - Uptime_since_flush_status is now always provided, independent if ENABLED_PROFILING is enabled when compiling MariaDB. - @@global.Uptime_since_flush_status is reset on FLUSH GLOBAL STATUS and @@session.Uptime_since_flush_status is reset on FLUSH SESSION STATUS. - When connected, @@session.Uptime_since_flush_status is set to 0.
204 lines
4.9 KiB
Text
204 lines
4.9 KiB
Text
source include/have_innodb.inc;
|
|
source include/have_log_bin.inc;
|
|
|
|
SET BINLOG_FORMAT=MIXED;
|
|
|
|
RESET MASTER;
|
|
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB;
|
|
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
|
BEGIN;
|
|
# Should be logged as statement
|
|
UPDATE t1 SET b = 2*a WHERE a > 1;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
BEGIN;
|
|
# Should be logged as rows
|
|
UPDATE t1 SET b = a * a WHERE a > 3;
|
|
COMMIT;
|
|
|
|
# Check that errors are generated when trying to use READ COMMITTED
|
|
# transaction isolation level in STATEMENT binlog mode.
|
|
|
|
SET BINLOG_FORMAT=STATEMENT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
BEGIN;
|
|
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
|
|
UPDATE t1 SET b = 1*a WHERE a > 1;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
BEGIN;
|
|
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
|
|
UPDATE t1 SET b = 2*a WHERE a > 2;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 3*a WHERE a > 3;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 4*a WHERE a > 4;
|
|
COMMIT;
|
|
|
|
SET BINLOG_FORMAT=MIXED;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 1*a WHERE a > 1;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 2*a WHERE a > 2;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 3*a WHERE a > 3;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 4*a WHERE a > 4;
|
|
COMMIT;
|
|
|
|
SET BINLOG_FORMAT=ROW;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 1*a WHERE a > 1;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 2*a WHERE a > 2;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 3*a WHERE a > 3;
|
|
COMMIT;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
|
BEGIN;
|
|
UPDATE t1 SET b = 4*a WHERE a > 4;
|
|
COMMIT;
|
|
|
|
source include/show_binlog_events.inc;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
#
|
|
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
|
|
# Actually this test has nothing to do with innodb per se, it just requires
|
|
# transactional table.
|
|
#
|
|
flush global status;
|
|
show status like "binlog_cache_use";
|
|
show status like "binlog_cache_disk_use";
|
|
|
|
create table t1 (a int) engine=innodb;
|
|
|
|
# Now we are going to create transaction which is long enough so its
|
|
# transaction binlog will be flushed to disk...
|
|
let $1=2000;
|
|
disable_query_log;
|
|
begin;
|
|
while ($1)
|
|
{
|
|
eval insert into t1 values( $1 );
|
|
dec $1;
|
|
}
|
|
commit;
|
|
enable_query_log;
|
|
show status like "binlog_cache_use";
|
|
show status like "binlog_cache_disk_use";
|
|
|
|
# Transaction which should not be flushed to disk and so should not
|
|
# increase binlog_cache_disk_use.
|
|
begin;
|
|
delete from t1;
|
|
commit;
|
|
show status like "binlog_cache_use";
|
|
show status like "binlog_cache_disk_use";
|
|
drop table t1;
|
|
|
|
#
|
|
# Bug#27716 multi-update did partially and has not binlogged
|
|
#
|
|
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL auto_increment,
|
|
`b` int(11) default NULL,
|
|
PRIMARY KEY (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
|
|
|
CREATE TABLE `t2` (
|
|
`a` int(11) NOT NULL auto_increment,
|
|
`b` int(11) default NULL,
|
|
PRIMARY KEY (`a`)
|
|
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
|
|
|
|
# A. testing multi_update::send_eof() execution branch
|
|
insert into t1 values (1,1),(2,2);
|
|
insert into t2 values (1,1),(4,4);
|
|
reset master;
|
|
--error ER_DUP_ENTRY
|
|
UPDATE t2,t1 SET t2.a=t1.a+2;
|
|
# check
|
|
select * from t2 /* must be (3,1), (4,4) */;
|
|
--echo # There must no UPDATE in binlog;
|
|
source include/show_binlog_events.inc;
|
|
|
|
# B. testing multi_update::send_error() execution branch
|
|
delete from t1;
|
|
delete from t2;
|
|
insert into t1 values (1,2),(3,4),(4,4);
|
|
insert into t2 values (1,2),(3,4),(4,4);
|
|
reset master;
|
|
--error ER_DUP_ENTRY
|
|
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
|
--echo # There must be no UPDATE query event;
|
|
source include/show_binlog_events.inc;
|
|
|
|
# cleanup bug#27716
|
|
drop table t1, t2;
|
|
|
|
--echo *** MDEV-11937: InnoDB flushes redo log too often ***
|
|
|
|
# Count number of log fsyncs reported by InnoDB per commit.
|
|
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
|
|
SET @old_flush = @@GLOBAL.innodb_flush_log_at_trx_commit;
|
|
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
|
|
|
--let $syncs1 = query_get_value(SHOW STATUS LIKE 'Innodb_data_fsyncs', Value, 1)
|
|
--let $ROWS = 100
|
|
--disable_query_log
|
|
let $count = $ROWS;
|
|
while ($count) {
|
|
eval INSERT INTO t1 VALUES ($count);
|
|
dec $count;
|
|
}
|
|
--let $syncs2 = query_get_value(SHOW STATUS LIKE 'Innodb_data_fsyncs', Value, 1)
|
|
eval SET @num_sync = $syncs2 - $syncs1;
|
|
--enable_query_log
|
|
|
|
# Allow a bit of slack, in case some background process or something
|
|
# is introducing a few more syncs.
|
|
eval SELECT IF(@num_sync < $ROWS*1.5, "OK",
|
|
CONCAT("ERROR: More than 1 fsync per commit (saw ", @num_sync/$ROWS, ")")) AS status;
|
|
|
|
DROP TABLE t1;
|
|
SET GLOBAL innodb_flush_log_at_trx_commit=@old_flush;
|
|
|
|
|
|
--echo End of tests
|