Bug #115563 Group replication conflict resolutions seem inconsistent
Submitted: 11 Jul 2024 7:54 Modified: 16 Jul 2024 6:52
Reporter: Przemyslaw Malkowski Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Group Replication Severity:S3 (Non-critical)
Version:8.0.38 OS:Any
Assigned to: CPU Architecture:Any
Tags: group replication

[11 Jul 2024 7:54] Przemyslaw Malkowski
Description:
There are two a bit different scenarios in a multi-primary mode where local transactions get rollback due to conflicts.
In one, when a local transaction started but was committed after an already remote conflicting transaction was received (no replication lag). 
The second is when there is a replication lag (conflicting trx already in the queue) and auto-commit DML happens for the conflicting rows.

For some reason, the first scenario does not increment COUNT_TRANSACTIONS_LOCAL_ROLLBACK and COUNT_CONFLICTS_DETECTED (performance_schema.replication_group_member_stats) but the other does.

How to repeat:
Scenario 1:

node3 > begin; update sbtest.sbtest1 set k=@@port where id=100;
Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

node1 > update sbtest.sbtest1 set k=@@port where id=100;
Query OK, 1 row affected (0.08 sec)
Rows matched: 1  Changed: 1  Warnings: 0

node3 > commit;
ERROR 1180 (HY000): Got error 149 - 'Lock deadlock; Retry transaction' during COMMIT

COUNT_CONFLICTS_DETECTED / COUNT_TRANSACTIONS_LOCAL_ROLLBACK do not change

Scenario 1:

Sysbench run on node1:
$ group_msb_8_0_38/node1/sysbench_ready run
...
(wait a few seconds)

And run DML on node3:

node3 > update sbtest.sbtest1 set k=k+1 limit 100;
ERROR 3101 (40000): Plugin instructed the server to rollback the current transaction.

COUNT_CONFLICTS_DETECTED / COUNT_TRANSACTIONS_LOCAL_ROLLBACK do increment!

Suggested fix:
Make the first scenario also increment the conflict/rollback counters.
Elaborate in the documentation why there are two different error messages for both types of rollback.
[16 Jul 2024 6:52] MySQL Verification Team
Hello Przemyslaw,

Thank you for the report and feedback. 

Thanks,
Umesh