Could not execute Delete_rows event on table, Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND

Execute:
SHOW SLAVE STATUS\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 104.248.92.132
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: master1.001788
          Read_Master_Log_Pos: 70309940
               Relay_Log_File: 414176e18a16-relay-bin.003635
                Relay_Log_Pos: 1385660
        Relay_Master_Log_File: master1.001784
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1032
                   Last_Error: Could not execute Update_rows event on table zabbix.trends_uint; Can't find record in 'trends_uint', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master1.001784, end_log_pos 1385796
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1385449
              Relay_Log_Space: 189577035
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 1032
               Last_SQL_Error: Could not execute Update_rows event on table zabbix.trends_uint; Can't find record in 'trends_uint', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master1.001784, end_log_pos 1385796
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
                  Master_UUID: ca9855c0-bbb6-11eb-819f-0242ac110002
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: 
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 211202 22:49:50
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: ca9855c0-bbb6-11eb-819f-0242ac110002:197380-10319748
            Executed_Gtid_Set: 624165d1-3049-11ec-b122-0242ac110004:1-17,
ca9855c0-bbb6-11eb-819f-0242ac110002:1-10154782
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.01 sec)
mysql -e "show slave status\G" | grep Log
It will show:
Master_Log_File: master1.001788
          Read_Master_Log_Pos: 70601244
               Relay_Log_File: 414176e18a16-relay-bin.003635
                Relay_Log_Pos: 1385660
        Relay_Master_Log_File: master1.001784
          Exec_Master_Log_Pos: 1385449
              Relay_Log_Space: 189868339
               Until_Log_File: 
                Until_Log_Pos: 0
'Relay_Log_Pos' and 'Exec_Master_Log_Pos' will not go on.

Solution:
SET GTID_NEXT='ca9855c0-bbb6-11eb-819f-0242ac110002:10154783';
BEGIN; COMMIT; SET GTID_NEXT='AUTOMATIC';
START SLAVE;
Source:
https://dbsysupgrade.com/error_code-1032-handler-error-ha_err_key_not_found/

No comments: