Bug #80395 semi-sync: incorrect crash recovery handling
Submitted: 16 Feb 2016 12:54 Modified: 13 Apr 2020 8:36
Reporter: Matthew Lord Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.7.11 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[16 Feb 2016 12:54] Matthew Lord
Description:
When mysqld is killed while an open semi-sync replication transaction is waiting for the master timeout, that prepared *but uncommitted* transaction is NOT property rolled back when the master performs its subsequent automated crash recovery.

This was verified on OL 7.2 x86_64, using MySQL 5.7.11-community. 

How to repeat:
mkdir /tmp/bug
chown mysql:mysql /tmp/bug

mysqld --no-defaults --initialize-insecure --datadir=/tmp/bug --user=mysql  

mysqld --no-defaults --user=mysql --port=3399 --socket=/tmp/bug/mysql.sock --datadir=/tmp/bug --log-bin --server-id=1 &

mysql --no-defaults --socket=/tmp/bug/mysql.sock

create database bug;
use bug;
create table ssbug (id int not null primary key, name varchar(100));

INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
SET GLOBAL rpl_semi_sync_master_enabled=ON;
show global variables like "rpl%";

# open a second shell, get the pid of this running mysqld process 
# prepare kill -9 <pid> to execute after the following INSERT statement 

insert into ssbug (id, name) values (1, "matt");

# while this is waiting for the master timeout
# execute the kill -9 <pid> 

mysqld --no-defaults --user=mysql --port=3399 --socket=/tmp/bug/mysql.sock --datadir=/tmp/bug --log-bin --server-id=1 &

mysql --no-defaults --socket=/tmp/bug/mysql.sock

select * from bug.ssbug;

# examine the MySQL error log 

Suggested fix:
This uncommitted transaction needs to be rolled back during crash recovery.
[20 Sep 2016 3:41] anup bharti
This cannot be a bug .As soon as time out occurs Semi sync will switch to async replication mode and hence will not care about slave ack or slave running and will simply go and Commit the transaction if not committed during the time will commit while Recovery.
[13 Mar 2020 8:36] MySQL Verification Team
Older bug re-open without comment why. It`s a valid to keep it open?.
[14 Apr 2020 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".