Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.2.27, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
Some users are seeing duplicate key errors like the following when using the optimistic and aggressive modes of parallel replication:
MariaDB [(none)]> SHOW SLAVE STATUS\G
|
*************************** 1. row ***************************
|
Slave_IO_State: Waiting for master to send event
|
Master_Host: 172.30.0.154
|
Master_User: repl
|
Master_Port: 3306
|
Connect_Retry: 60
|
Master_Log_File: mariadb-bin.000055
|
Read_Master_Log_Pos: 593262418
|
Relay_Log_File: ip-172-30-0-228-relay-bin.000002
|
Relay_Log_Pos: 33725828
|
Relay_Master_Log_File: mariadb-bin.000039
|
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: 1062
|
Last_Error: Error 'Duplicate entry '...' for key 'name'' on query. Default database: 'sample3'. Query: 'INSERT INTO ...'
|
Skip_Counter: 0
|
Exec_Master_Log_Pos: 705697132
|
Relay_Log_Space: 17101184558
|
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: 1062
|
Last_SQL_Error: Error 'Duplicate entry '...' for key 'name'' on query. Default database: 'sample3'. Query: 'INSERT INTO ...'
|
Replicate_Ignore_Server_Ids:
|
Master_Server_Id: 1
|
Master_SSL_Crl:
|
Master_SSL_Crlpath:
|
Using_Gtid: Slave_Pos
|
Gtid_IO_Pos: 0-1-42163518
|
Replicate_Do_Domain_Ids:
|
Replicate_Ignore_Domain_Ids:
|
Parallel_Mode: aggressive
|
SQL_Delay: 0
|
SQL_Remaining_Delay: NULL
|
Slave_SQL_Running_State:
|
1 row in set (0.00 sec)
|
However, when the problem is analyzed, it is clear that the duplicate key should not occur.
The configuration:
[mariadb]
|
server_id=2
|
log_bin=mariadb-bin
|
log_slave_updates
|
binlog_format=MIXED
|
slave_parallel_threads=16
|
slave_parallel_max_queued=1048576
|
slave_parallel_mode=aggressive
|
The configuration with slave_parallel_mode=optimistic was identical.
Some observations:
- When the table is queried on the slave, the row does indeed exists, so it is clear that the duplicate key error is real.
- The SQL script contains an UPDATE and a DELETE before the INSERT, so the row should have been deleted, which should have prevented the duplicate key error.
- The row still exists, so it seems that the DELETE statement had no effect.
- The values in the existing row in the table are the old non-updated values, so it seems that the UPDATE statement also had no effect.
- The slave's binary log contains both the UPDATE and DELETE statements, which should indicate that the statements were successfully executed on the slave.
- I haven't yet been able to reproduce the problem when the master has binlog_format=ROW set, so row-based replication may be immune to the problem.
Attachments
Issue Links
- blocks
-
MDEV-17814 Server crashes in is_current_stmt_binlog_format_row
- Open
-
MDEV-30225 RR isolation violation with locking unique search
- Closed
- causes
-
MDEV-6860 Parallel async replication hangs on a Galera node
- Closed
-
MDEV-33802 Weird read view after ROLLBACK of other transactions.
- Closed
- is blocked by
-
MDEV-26206 gap lock is not set if implicit lock exists
- Closed
- is duplicated by
-
MDEV-28200 Rows just inserted sometimes not returned by select afterwards
- Closed
- relates to
-
MDEV-10962 Deadlock with 3 concurrent DELETEs by unique key
- Closed
-
MDEV-14589 InnoDB should not lock a delete-marked record
- Closed
-
MDEV-18648 slave_parallel_mode= optimistic default in 10.5
- Closed
-
MDEV-19544 Remove innodb_locks_unsafe_for_binlog
- Closed
-
MDEV-20628 If temporary error occurs with optimistic mode of parallel replication, error message has false information
- Closed
-
MDEV-24224 Gap lock on delete in 10.5 using READ COMMITTED
- Closed
-
MDEV-25757 Assertion `!lock->is_waiting()' in lock_discard_for_index
- Closed
-
MDEV-26475 InnoDB must not lock delete-marked records
- Open
-
MDEV-27557 InnoDB unnecessarily commits mtr during secondary index search to preserve clustered index latching order
- Closed
-
MDEV-28422 Page split breaks a gap lock
- Closed
-
MDEV-30010 Slave (additional info): Commit failed due to failure of an earlier commit on which this one depends Error_code: 1964
- Closed
-
MDEV-16208 [Draft] Assertion `lock_get_wait(other_lock)' failed in lock_rec_queue_validate
- Closed
-
MDEV-16406 Refactor the InnoDB record locks
- Open
-
MDEV-17843 Assertion `page_rec_is_leaf(rec)' failed in lock_rec_queue_validate upon SHOW ENGINE INNODB STATUS
- Closed
-
MDEV-18706 ER_LOCK_DEADLOCK on concurrent read and insert into already locked gap
- In Review
-
MDEV-20604 Duplicate key value is silently truncated to 64 characters in print_keydup_error
- Closed
-
MDEV-22634 Assertion `dict_index_is_clust(index) || !dict_index_is_online_ddl(index)' failed in lock_rec_create_low
- Closed
-
MDEV-23197 Assertion `(index)->is_clust() || !dict_index_is_online_ddl(index)' failed. in lock_rec_create_low
- Closed
-
MDEV-24224 Gap lock on delete in 10.5 using READ COMMITTED
- Closed
-
MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock
- Closed
-
MDEV-30777 InnoDB: Failing assertion: pcur->restore_position(BTR_MODIFY_TREE, mtr) == btr_pcur_t::SAME_ALL
- Closed
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...