Bug #95389 slave_rows_search_algorithms='INDEX_SCAN,HASH_SCAN' lead to 'record not foun'
Submitted: 16 May 2019 9:04 Modified: 5 Jul 2019 20:41
Reporter: chengqing hu Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S3 (Non-critical)
Version:5.7.21 OS:Linux
Assigned to: MySQL Verification Team CPU Architecture:x86

[16 May 2019 9:04] chengqing hu
Description:
In the case where the master-slave data is consistent, the slave sql thread reports that the record cannot be found.

the error info:
Worker 1 failed executing transaction '96b91fd7-bd68-11e8-b2c0-b083fecd29fa:1797272' at master log mysql-bin.000146, end_log_pos 141967282; Could not execute Update_rows event on table tt.t1; Can't find record in 't1', Error_code: 1032; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000146, end_log_pos 141967282

How to repeat:
On slave:
set global slave_rows_search_algorithms='INDEX_SCAN,HASH_SCAN';

On master:

1. CREATE TABLE t1 ( 
  A INT UNIQUE KEY, 
  B INT 
); 
insert into t1 values (1,2); 

2. replace into t1 values (1,3),(1,4); 

3. Then there will be an error on the slave

4. On slave:
set global slave_rows_search_algorithms='INDEX_SCAN,HASH_SCAN';
start slave;

5. The error will be resolved

Suggested fix:
The explanation on the reference manual is:

Do not use the combination TABLE_SCAN,HASH_SCAN. This setting forces hashing for all searches. It has no advantage over INDEX_SCAN,HASH_SCAN, and it can lead to “record not found” errors or duplicate key errors in the case of a single event containing multiple updates to the same row, or updates that are order-dependent.

I think it's a bug.
[16 May 2019 9:08] chengqing hu
edit synopsis
[5 Jun 2019 20:41] MySQL Verification Team
Hi,

Can you elaborate why you think this is a bug as the quoted documentation is warning that you will have exactly the issue you are having?!
[6 Jul 2019 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".
[26 Jul 2021 18:55] Venkatesh Duggirala
I believe the reporter is referring to hash_scan bug 
that might be related to bug support@oracle team is referring. 
https://support.oracle.com/knowledge/Oracle%20Database%20Products/2473168_1.html

For this support.oracle link, Is there a separate bug that talks about Hash_scan bug?