Extra lines in relay-log.info

Bug #1470273 reported by Sveta Smirnova
6
This bug affects 1 person
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.1
Won't Fix
High
Unassigned
5.5
Triaged
High
Unassigned
5.6
Triaged
High
Unassigned
5.7
Triaged
High
Unassigned

Bug Description

Currently relay-log.info file should have at most 7 lines, but if run test from upstream bug #25713 (http://bugs.mysql.com/bug.php?id=25713) it is possible to get relay-log.info with more lines.

How to repeat.

Follow instructions from http://bugs.mysql.com/bug.php?id=25713:

1. Start replication
2. On master create a procedure:

mysql> \d |
mysql> create procedure p1()
    -> BEGIN
    -> DECLARE id INT;
    -> set id=0;
    -> while id<1000000 do
    -> INSERT INTO test.tt VALUES (id);
    -> set id=id+1;
    -> end while;
    -> END
    -> |
Query OK, 0 rows affected (0.00 sec)

3. Run procedure few times:

call p1();

4. Create bash file:

#!/bin/bash

while [ 1 ]
do
cat /PATH/TO/ps-5.6/mysql-test/var/mysqld.2/data/relay-log.info |awk 'begin{line=0}{line++}{if(line==4)print;if(line==5) print}'
sleep 1
done

5. Run bash file

6. I don't see described corruption of line 4 as in original bug, but relay-log.info occasionally has 10 lines:

mysql> \! cat var/mysqld.2/data/relay-log.info
7
./slave-relay-bin.000007
69814314
master-bin.000009
69814150
0
0
1
0
1
mysql> \! cat var/mysqld.2/data/relay-log.info | wc -l
10

Having that relay-log.info can have extra lines there is possibility it can be corrupted in worst way. Customer saw it corrupted binary log file name and position.

no longer affects: percona-server/upstream-5.0
no longer affects: percona-server/upstream-5.1
no longer affects: percona-server/upstream-5.5
no longer affects: percona-server/upstream-5.6
tags: added: upstream
Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

This is easdy to confirm, there is no problem to see more than 7 lines in the relay-log.info on slave (I've used PS 5.6.25 and MySQL Sandbox) while procedure is running:

[openxs@chief node1]$ cat data/relay-log.info | wc -l
8
[openxs@chief node1]$ cat data/relay-log.info
7
./mysql_sandbox21691-relay-bin.000002
451444
mysql-bin.000001
451281
0
0
1
[openxs@chief node1]$ cat data/relay-log.info | wc -l
8

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Ups, seems I was too fast. Actually my relay log content is OK. Waiting for some more time...

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Relay log is a plain text file. Its contents updated in memory first (8k buffer) and then flushed to file. MySQL opens file for write, seek to the beginning of file and writes the buffer to the file. If contents of the buffer is shorter than current contents of relay-log.info (for example, slave switched to the next relay log and position become 2-digits instead of 10-digits), then extra garbage at the end of relay-log.info appear.

This however should not lead to corruption of relay-log.info, because does not read the garbage at the end of relay-log.info.

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

I didn't see 4th line corrupted and I haven't find a reason for such corruption by code review.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-912

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.