# Crash-Resistant Replication working wrong?

**URL:** <https://forums.percona.com/t/crash-resistant-replication-working-wrong/1768>\
**Category:** Other MySQL® Questions\
**Created:** [February 21, 2012, 5:00am UTC](https://forums.percona.com/t/crash-resistant-replication-working-wrong/1768 "2012-02-21T05:00:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![airo](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@airo](https://forums.percona.com/u/airo)\
**Post date:** [February 21, 2012, 5:00am UTC](https://forums.percona.com/t/crash-resistant-replication-working-wrong/1768/1 "2012-02-21T05:00:06Z")

</div>

After read about this feature in [http://www.percona.com/doc/percona-server/5.5/reliability/in](http://www.percona.com/doc/percona-server/5.5/reliability/in) nodb\_recovery\_update\_relay\_log.html#crash-resistant-replicat ion ,

innodb\_overwrite\_relay\_log\_info

i wanted test this.

What i do?

checking with percona server 5.5.20 and 5.1.59. both case running replication capacity about 100 qps.

set safe variables

sync\_binlog = 1innodb\_flush\_log\_at\_trx\_commit = 1innodb\_overwrite\_relay\_log\_info = 1 or innodb\_recovery\_update\_relay\_log = 1skip-slave-start

need anything else for this test?

i do emulation power failure over SysRq-B.

echo 1 \> /proc/sys/kernel/sysrqecho b \> /proc/sysrq-trigger

after server rebooted, see info files.

[root@db40 airo]# cat /local/mysql/data/master.info 15log-bin.01388886886857210.x.xx.xxreplicationreplication33066000[root@db40 airo]# cat /local/mysql/data/relay-log.info /local/mysql/relaylog/relay-bin.000687868868715log-bin.0138888688685722

then start mysql server, seen log after recovery

InnoDB: relay-log.info is detected.InnoDB: relay log: position 868868715, file name /local/mysql/relaylog/relay-bin.000687InnoDB: master log: position 868868572, file name log-bin.013888InnoDB: The InnoDB memory heap is disabled…InnoDB: Apply batch completedInnoDB: In a MySQL replication slave the last master binlog fileInnoDB: position 0 869698571, file name log-bin.013888InnoDB: and relay log fileInnoDB: position 0 869698714, file name /local/mysql/relaylog/relay-bin.000687InnoDB: Last MySQL binlog file position 0 1071255772, file name /local/mysql/binlog/log-bin.000404120221 13:15:20 InnoDB: Restoring buffer pool pages from ib\_lru\_dump120221 13:15:20 Percona XtraDB ([http://www.percona.com](http://www.percona.com)) 1.0.17-12.5 started; log sequence number 483548337856InnoDB: relay-log.info was overwritten.120221 13:15:21 [Note] Recovering after a crash using /local/mysql/binlog/log-bin120221 13:17:19 [Note] Starting crash recovery…120221 13:17:19 [Note] Crash recovery finished.

recovery done is fine, replication not started because set option skip this action.

10.8.60.40-(none)-13:19:13\> show slave status\G\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Slave\_IO\_State: Master\_Host: 10.x.xx.xx Master\_User: replication Master\_Port: 3306 Connect\_Retry: 60 Master\_Log\_File: log-bin.013888 Read\_Master\_Log\_Pos: 868868572 Relay\_Log\_File: relay-bin.000687 Relay\_Log\_Pos: 869698714 Relay\_Master\_Log\_File: log-bin.013888 Slave\_IO\_Running: No Slave\_SQL\_Running: No Replicate\_Do\_DB: Replicate\_Ignore\_DB: Replicate\_Do\_Table: Replicate\_Ignore\_Table: Replicate\_Wild\_Do\_Table: Replicate\_Wild\_Ignore\_Table: Last\_Errno: 0 Last\_Error: Skip\_Counter: 0 Exec\_Master\_Log\_Pos: 869698571 Relay\_Log\_Space: 864055592 Until\_Condition: None Until\_Log\_File: Until\_Log\_Pos: 0 Master\_SSL\_Allowed: No Master\_SSL\_CA\_File: Master\_SSL\_CA\_Path: Master\_SSL\_Cert: Master\_SSL\_Cipher: Master\_SSL\_Key: Seconds\_Behind\_Master: NULLMaster\_SSL\_Verify\_Server\_Cert: No Last\_IO\_Errno: 0 Last\_IO\_Error: Last\_SQL\_Errno: 0 Last\_SQL\_Error: 1 row in set (0.00 sec)

Can be seen that Exec\_Master\_Log\_Pos get from binlog, and differs from master.info. from binlog is bigger pos, than master.info and this position is right.

Okey, everything looks great.

Start replication. And get error - Duplicate entry.

10.8.60.40-(none)-13:21:04\> show slave status\G\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Slave\_IO\_State: Waiting for master to send event Master\_Host: 10.x.xx.xx Master\_User: replication Master\_Port: 3306 Connect\_Retry: 60 Master\_Log\_File: log-bin.013888 Read\_Master\_Log\_Pos: 988421748 Relay\_Log\_File: relay-bin.000689 Relay\_Log\_Pos: 249 Relay\_Master\_Log\_File: log-bin.013888 Slave\_IO\_Running: Yes Slave\_SQL\_Running: No Replicate\_Do\_DB: Replicate\_Ignore\_DB: Replicate\_Do\_Table: Replicate\_Ignore\_Table: Replicate\_Wild\_Do\_Table: Replicate\_Wild\_Ignore\_Table: Last\_Errno: 1062 Last\_Error: Error ‘Duplicate entry ‘15043868’ for key ‘PRIMARY’’ on query. Default database: … [skip this part] Skip\_Counter: 0 Exec\_Master\_Log\_Pos: 868868572 Relay\_Log\_Space: 119553574 Until\_Condition: None Until\_Log\_File: Until\_Log\_Pos: 0 Master\_SSL\_Allowed: No Master\_SSL\_CA\_File: Master\_SSL\_CA\_Path: Master\_SSL\_Cert: Master\_SSL\_Cipher: Master\_SSL\_Key: Seconds\_Behind\_Master: NULLMaster\_SSL\_Verify\_Server\_Cert: No Last\_IO\_Errno: 0 Last\_IO\_Error: Last\_SQL\_Errno: 1062 Last\_SQL\_Error: Error ‘Duplicate entry ‘15043868’ for key ‘PRIMARY’’ on query. Default database: … [skip this part]

We see that Exec position jump back from 869698571 to 868868572. This position replication get from mysql.info.

I’m doing something wrong? or believed that after crash, replication must be fixed by hand? (i mean “change master to” position got from log.err)

---

<div class="post-metadata">

**Author:** ![xaprb](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@xaprb](https://forums.percona.com/u/xaprb)\
**Post date:** [February 21, 2012, 8:45am UTC](https://forums.percona.com/t/crash-resistant-replication-working-wrong/1768/2 "2012-02-21T08:45:41Z")

</div>

This looks like a bug. Please file it on Launchpad.

---

<div class="post-metadata">

**Author:** ![airo](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@airo](https://forums.percona.com/u/airo)\
**Post date:** [February 22, 2012, 3:35am UTC](https://forums.percona.com/t/crash-resistant-replication-working-wrong/1768/3 "2012-02-22T03:35:26Z")

</div>

okey, [URL][https://bugs.launchpad.net/percona-server/+bug/937852[/URL]](https://bugs.launchpad.net/percona-server/+bug/937852%5B/URL%5D)
