mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-16421 Make system tables crash safe
Make all system tables in mysql directory of type engine=Aria Privilege tables are using transactional=1 Statistical tables are using transactional=0, to allow them to be quickly updated with low overhead. Help tables are also using transactional=0 as these are only updated at init time. Other changes: - Aria store engine is now a required engine - Update comment for Aria tables to reflect their new usage - Fixed that _ma_reset_trn_for_table() removes unlocked table from transaction table list. This was needed to allow one to lock and unlock system tables separately from other tables, for example when reading a procedure from mysql.proc - Don't give a warning when using transactional=1 for engines that is using transactions. This is both logical and also to avoid warnings/errors when doing an alter of a privilege table to InnoDB. - Don't abort on warnings from ALTER TABLE for changes that would be accepted by CREATE TABLE. - New created Aria transactional tables are marked as not movable (as they include create_rename_lsn). - bootstrap.test was changed to kill orignal server, as one can't anymore have two servers started at same time on same data directory and data files. - Disable maria.small_blocksize as one can't anymore change aria block size after system tables are created. - Speed up creation of help tables by using lock tables. - wsrep_sst_resync now also copies Aria redo logs.
This commit is contained in:
@@ -79,7 +79,7 @@ a
|
||||
9
|
||||
connection server_1;
|
||||
DROP TABLE t1;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET GLOBAL gtid_strict_mode= @old_gtid_strict_mode;
|
||||
SET debug_sync = "reset";
|
||||
connection server_2;
|
||||
|
@@ -3,7 +3,7 @@ include/master-slave.inc
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
SET sql_log_bin=0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET sql_log_bin=1;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
|
@@ -159,7 +159,7 @@ a
|
||||
8
|
||||
9
|
||||
SET sql_log_bin= 0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET sql_log_bin= 1;
|
||||
include/start_slave.inc
|
||||
connection server_1;
|
||||
|
@@ -46,6 +46,6 @@ SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
SET GLOBAL max_relay_log_size= @old_max_relay;
|
||||
include/start_slave.inc
|
||||
connection server_1;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
DROP TABLE t1;
|
||||
include/rpl_end.inc
|
||||
|
@@ -49,7 +49,7 @@ a
|
||||
1
|
||||
include/stop_slave.inc
|
||||
SET sql_log_bin=0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
|
||||
ALTER TABLE mysql.gtid_slave_pos_innodb ENGINE=InnoDB;
|
||||
INSERT INTO mysql.gtid_slave_pos_innodb SELECT * FROM mysql.gtid_slave_pos;
|
||||
@@ -77,7 +77,7 @@ SELECT table_name, engine FROM information_schema.tables
|
||||
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
||||
ORDER BY table_name;
|
||||
table_name engine
|
||||
gtid_slave_pos MyISAM
|
||||
gtid_slave_pos Aria
|
||||
gtid_slave_pos_innodb InnoDB
|
||||
SELECT @@gtid_pos_auto_engines;
|
||||
@@gtid_pos_auto_engines
|
||||
@@ -122,7 +122,7 @@ table_name engine
|
||||
gtid_slave_pos InnoDB
|
||||
include/stop_slave.inc
|
||||
SET sql_log_bin=0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET sql_log_bin=1;
|
||||
connection server_1;
|
||||
INSERT INTO t1 VALUES (5);
|
||||
@@ -157,7 +157,7 @@ SELECT lower(table_name), engine FROM information_schema.tables
|
||||
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
||||
ORDER BY table_name;
|
||||
lower(table_name) engine
|
||||
gtid_slave_pos MyISAM
|
||||
gtid_slave_pos Aria
|
||||
gtid_slave_pos_innodb InnoDB
|
||||
include/stop_slave.inc
|
||||
SET sql_log_bin=0;
|
||||
@@ -202,7 +202,7 @@ SELECT table_name, engine FROM information_schema.tables
|
||||
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
||||
ORDER BY table_name;
|
||||
table_name engine
|
||||
gtid_slave_pos MyISAM
|
||||
gtid_slave_pos Aria
|
||||
SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
|
||||
domain_id max(seq_no)
|
||||
0 11
|
||||
@@ -250,7 +250,7 @@ SELECT lower(table_name), engine FROM information_schema.tables
|
||||
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
||||
ORDER BY table_name;
|
||||
lower(table_name) engine
|
||||
gtid_slave_pos MyISAM
|
||||
gtid_slave_pos Aria
|
||||
gtid_slave_pos_innodb InnoDB
|
||||
SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
|
||||
domain_id max(seq_no)
|
||||
|
@@ -19,11 +19,16 @@ abandons
|
||||
connection slave;
|
||||
stop slave;
|
||||
connection master;
|
||||
create temporary table tmp select * from mysql.user where host="localhost" and user="root";
|
||||
set password for root@"localhost" = password('foo');
|
||||
connection slave;
|
||||
start slave;
|
||||
connection master;
|
||||
set password for root@"localhost" = password('');
|
||||
replace into mysql.user select * from tmp;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave
|
||||
drop temporary table tmp;
|
||||
flush privileges;
|
||||
create table t3(n int);
|
||||
insert into t3 values(1),(2);
|
||||
connection slave;
|
||||
|
@@ -129,7 +129,7 @@ SELECT * FROM t1 ORDER BY a;
|
||||
# Clean up.
|
||||
--connection server_1
|
||||
DROP TABLE t1;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET GLOBAL gtid_strict_mode= @old_gtid_strict_mode;
|
||||
SET debug_sync = "reset";
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
# back). So fix it to make sure we are consistent, in case an earlier test case
|
||||
# left it as InnoDB.
|
||||
SET sql_log_bin=0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET sql_log_bin=1;
|
||||
--source include/start_slave.inc
|
||||
|
||||
|
@@ -230,7 +230,7 @@ EOF
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
SET sql_log_bin= 0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET sql_log_bin= 1;
|
||||
# Do a second restart to get the mysql.gtid_slave_pos table loaded with
|
||||
# the right engine.
|
||||
|
@@ -99,7 +99,7 @@ SET GLOBAL max_relay_log_size= @old_max_relay;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection server_1
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
DROP TABLE t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
@@ -44,7 +44,7 @@ SELECT * FROM t1 ORDER BY a;
|
||||
SET sql_log_bin=0;
|
||||
# Reset storage engine for mysql.gtid_slave_pos in case an earlier test
|
||||
# might have changed it to InnoDB.
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
|
||||
ALTER TABLE mysql.gtid_slave_pos_innodb ENGINE=InnoDB;
|
||||
INSERT INTO mysql.gtid_slave_pos_innodb SELECT * FROM mysql.gtid_slave_pos;
|
||||
@@ -128,7 +128,7 @@ SELECT table_name, engine FROM information_schema.tables
|
||||
|
||||
--source include/stop_slave.inc
|
||||
SET sql_log_bin=0;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
|
||||
SET sql_log_bin=1;
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||
|
@@ -19,6 +19,7 @@ select * from t1 limit 10;
|
||||
sync_slave_with_master;
|
||||
stop slave;
|
||||
connection master;
|
||||
create temporary table tmp select * from mysql.user where host="localhost" and user="root";
|
||||
set password for root@"localhost" = password('foo');
|
||||
connection slave;
|
||||
start slave;
|
||||
@@ -27,7 +28,9 @@ connection master;
|
||||
# Give slave time to do at last one failed connect retry
|
||||
# This one must be short so that the slave will not stop retrying
|
||||
real_sleep 2;
|
||||
set password for root@"localhost" = password('');
|
||||
replace into mysql.user select * from tmp;
|
||||
drop temporary table tmp;
|
||||
flush privileges;
|
||||
# Give slave time to connect (will retry every second)
|
||||
sleep 2;
|
||||
|
||||
|
Reference in New Issue
Block a user