Crash safe slave with gtid + less durable settings
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
||||
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Invalid
|
Undecided
|
Unassigned | |||
5.6 |
Triaged
|
High
|
Vlad Lesin | |||
5.7 |
Triaged
|
High
|
Vlad Lesin |
Bug Description
When using GTID with less durable settings (sync_binlog != 1 and innodb_
1) The slave loses transactions if slave's binary log is ahead innodb (binary log has N transactions that are not persisted in InnoDB => N transactions are lost)
2) The slave stops with duplicate key error if binary log is behind innodb (InnoDB has N transactions that are not persisted in binary log)
Without gtid, both cases do not cause problems because slave can continue replication based on slave_relay_
How to repeat:
Set master/slave replication with gtid enabled, and set less durable settings.
sync-binlog=0
innodb-
log-bin
log-slave-updates
gtid-mode=on
enforce-
relay_log_
relay_log_
master> create table t1 (id int primary key) engine=innodb;
master> insert into t1 values (1);
1) Losing transaction
Attach slave's mysqld process via gdb, then set breakpoint on trx_commit_
master> insert into t1 values (2);
-- hit breakpoint on the slave
-- binlog on the slave should have "insert into t1 values (2)"
kill -9 slave's mysqld
restart slave mysqld, restart replication
master> insert into t1 values (3);
slave has only 1 and 3. It misses 2.
2) Duplicate key error
slave> select @@global.
copy slave's binary log somewhere --> (a)
master> insert into t1 values (2,2,2);
slave> select @@global.
kill -9 slave's mysqld_safe and mysqld
restore slave's binary log taken at (a) (simulating "transactions are persisted in InnoDB but not in binary log")
restarting slave, restarting replication
=> slave stops with duplicate key error
select @@global.
so slave tries to start replication from gtid x, so apparently it fails by duplicate key error.
Changed in percona-server: | |
status: | New → Confirmed |
tags: | added: upstream |
tags: | added: i51438 |
https:/ /github. com/facebook/ mysql-5. 6/commit/ e8cbe774670d0fd c7437b5dcaa0801 0964e4f4b1