Bug #118322 Result of `show master status` is not correct !!!
Submitted: 1 Jun 4:47 Modified: 19 Jul 16:32
Reporter: Eric Sun Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:8.0.20 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:x86
Tags: binlog, replication

[1 Jun 4:47] Eric Sun
Description:
When I test large transaction by sysbench.
--------------------------------------------------------------
| binlog.000031 | 961964090 | xxx        |                  | 360b55f2-01c4-11f0-8c7c-6e4f425f1652:1-420941769,
f1433e82-ce72-11ef-b3be-f19619bc62b8:1-27 |

Terminal 1
--------------------------------------------------------------
set autocommit=0;
update sbtest1 set c=reverse(c),pad=reverse(pad);
....
update sbtest8 set c=reverse(c),pad=reverse(pad);
....
---->  commit;

Terminal 2
--------------------------------------------------------------
show master status;
.... BLOCKED

# When COMMIT done, the result display like below:

| binlog.000031 | 8987608155 | xxx        |                  | 360b55f2-01c4-11f0-8c7c-6e4f425f1652:1-420941769,
f1433e82-ce72-11ef-b3be-f19619bc62b8:1-27 |

show master status;
# The result is correct, and I repeat query it again, the result display like below:

| binlog.000032 |      196 | xxx        |                  | 360b55f2-01c4-11f0-8c7c-6e4f425f1652:1-420941770,
f1433e82-ce72-11ef-b3be-f19619bc62b8:1-27 |

How to repeat:
Firstly, record the result `show master status`
Secondly, mock large transaction like Description
Finally, execute `show master status` more one times and check the result

Suggested fix:
This bug will affect Replication.
[17 Jun 7:09] MySQL Verification Team
Hi,
I'm not sure what you think is "not correct" here?

You executed large transaction, on the end of that transaction before binlog was rotated you got info about that position, then binlog is rotated and you get new position. What is "not correct" here? Can you please help us understand what is the assumed problem here?

Thanks
[17 Jun 7:59] Eric Sun
Step 1. show master status;
---------------------------------------------------------------------------------------------------------------------------------------
| binlog.000031 | 961964090 | xxx | xxx | 360b55f2-01c4-11f0-8c7c-6e4f425f1652:1-420941769, f1433e82-ce72-11ef-b3be-f19619bc62b8:1-27 |
---------------------------------------------------------------------------------------------------------------------------------------
Note: Keep in mind that the binlog file is binlog.000031, binlog position is 961964090 and GTID set is like above!!!

Step 2. Open two terminals

    2.1 Open new session1 on Terminal-1
    --------------------------------------------------------------
    > set autocommit=0;
    > update sbtest1 set c=reverse(c),pad=reverse(pad);
    > update sbtest2 set c=reverse(c),pad=reverse(pad);
    > update sbtest3 set c=reverse(c),pad=reverse(pad);
    > update sbtest4 set c=reverse(c),pad=reverse(pad);
    > update sbtest5 set c=reverse(c),pad=reverse(pad);
    > update sbtest6 set c=reverse(c),pad=reverse(pad);
    > update sbtest7 set c=reverse(c),pad=reverse(pad);
    > update sbtest8 set c=reverse(c),pad=reverse(pad);
    > commit;

    Note: Try to update sbtest1-8 (each table contains 2000000 rows)

    2.2. Open new session2 on Terminal-2
    --------------------------------------------------------------
    > show master status;
    .... BLOCKED....

Step 3. When session1 COMMIT done, the result of session2 display like below:
---------------------------------------------------------------------------------------------------------------------------------------
| binlog.000031 | 8987608155 | xxx | xxx | 360b55f2-01c4-11f0-8c7c-6e4f425f1652:1-420941769,f1433e82-ce72-11ef-b3be-f19619bc62b8:1-27 |
---------------------------------------------------------------------------------------------------------------------------------------

Important things need to be repeated for 3 times:
Focus here 1 time ==> Why binlog position rollback to 8987608155??? and GTID Set not changed??
Focus here 2 time ==> Why binlog position rollback to 8987608155??? and GTID Set not changed??
Focus here 3 time ==> Why binlog position rollback to 8987608155??? and GTID Set not changed??

Step 4. show master status;
--------------------------------------------------------------------------------------------------------------------------------------
| binlog.000032 |       196 | xxx | xxx | 360b55f2-01c4-11f0-8c7c-6e4f425f1652:1-420941770,f1433e82-ce72-11ef-b3be-f19619bc62b8:1-27 |
--------------------------------------------------------------------------------------------------------------------------------------
Note: I try to show master status again, the result display like above :)
It seem to work fine. Because the binlog file has rotated from binlog.000031 to binlog.000032 and binlog position forward to 196.
[19 Jun 16:31] MySQL Verification Team
Have you tried this on 8.0.42 ?
I tried and I cannot reproduce this on 8.0.42.

If I understand correctly your problem is invalid "show master" for few seconds after transaction is committed? 

Can you retest this on 8.0.42 because I created 10 tables with 200k rows each and did the query and I did not reproduce this.

Thanks
[20 Jul 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".