In some cases it is necessary to replay binlogs to a MySQL server so that duplicate-key or no-key-found errors are ignored. Even though there is the slave_exec_mode global system variable which provides this behavior when its value is set to 'IDEMPOTENT', it is sometimes convenient to be able to temporarily turn on the IDEMPOTENT mode for a particular binlog without affecting global system variables.

This patch changes slave_exec_mode to a session variable and adds a new command line option to mysqlbinlog called –slave-exec-idempotent. When the option is enabled, mysqlbinlog prepends its output with ”SET LOCAL slave_exec_mode='IDEMPOTENT';” so that all subsequent row events are applied in the idempotent mode. The option is disabled by default.

Version Specific Information

Percona Server Version Comments
release-5.1.52-12-rnt Full functionality available.

Other Information

Author/Origin Alexey Kopytov

System variables

The patch changes the scope of the slave_exec_mode system variable from global to session.

Command line options


General Description:
Utility mysqlbinlog
Command Line Yes
Config File Yes
Permitted Values:
Type Boolean
Default Value off

Implementation Details

percona-server/features/special/mysqlbinlog_slave_exec_idempotent.txt · Last modified: 2015/08/05 15:37 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Contact Us 24 Hours A Day
SupportContact us 24×7
Emergency? Contact us for help now!
Sales North America(888) 316-9775 or
(208) 473-2904
+44-208-133-0309 (UK)
0-800-051-8984 (UK)
0-800-181-0665 (GER)
Training(855) 55TRAIN or
(925) 271-5054


Share This
]]> ]]>