8

When using the MIXED format with the READ COMMITTED isolation level, am I safe?

The docs state (http://dev.mysql.com/doc/refman/5.5/en/set-transaction.html#isolevel_read-committed)

If you use READ COMMITTED or enable innodb_locks_unsafe_for_binlog, you must use row-based binary logging

In the list of When running in MIXED logging format, the server automatically switches from statement-based to row-based logging under the following conditions

.. the isolation level is not mentioned: http://dev.mysql.com/doc/refman/5.5/en/binary-log-mixed.html

Furthermore, the following bug from 2006/2007 talks about adding an warning or error message if the isolation level is used with the incompatible log format. See link to bug in the comment section

I have tested the combination in MySQL 5.5 and I don't get any warning. So I assume that the row format is used if the isolation is used. Am I right?

Update

The following suggests that it is safe (that ROW will be used when having MIXED). Link to manual in the comments (I can't post more than 2 links)

If you are using InnoDB tables and the transaction isolation level is READ COMMITTED or READ UNCOMMITTED, only row-based logging can be used. It is possible to change the logging format to STATEMENT, but doing so at runtime leads very rapidly to errors because InnoDB can no longer perform inserts.

asked Jan 10, 2016 at 17:10
3
  • Link to bug: bugs.mysql.com/bug.php?id=23051 Commented Jan 10, 2016 at 17:11
  • Why do you need "Read committed"? Commented Jan 11, 2016 at 2:48
  • 1
    I need it in order to prevent gap locking when using select .. for update. I select specific ids. Link to manual, quote from the update: dev.mysql.com/doc/refman/5.5/en/binary-log-setting.html Commented Jan 11, 2016 at 15:24

1 Answer 1

1

According to the MySQL Documentation : Mixed Binary Logging Format

A given storage engine can support either or both logging formats. The following table lists the formats supported by each engine.

In the table mentioned under that sentence on that page

+--------------+---------------------+----------------------------------+
|Storage Engine|Row Logging Supported|Statement Logging Supported |
+--------------+---------------------+----------------------------------+
|ARCHIVE |Yes |Yes |
+--------------+---------------------+----------------------------------+
|BLACKHOLE |Yes |Yes |
+--------------+---------------------+----------------------------------+
|CSV |Yes |Yes |
+--------------+---------------------+----------------------------------+
|EXAMPLE |Yes |No |
+--------------+---------------------+----------------------------------+
|FEDERATED |Yes |Yes |
+--------------+---------------------+----------------------------------+
|HEAP |Yes |Yes |
+--------------+---------------------+----------------------------------+
|InnoDB |Yes |Yes when the transaction |
| | |isolation level is REPEATABLE | <== NOTE THIS
| | |READ or SERIALIZABLE; No otherwise|
+--------------+---------------------+----------------------------------+
|MyISAM |Yes |Yes |
+--------------+---------------------+----------------------------------+
|MERGE |Yes |Yes |
+--------------+---------------------+----------------------------------+
|NDB |Yes |No |
+--------------+---------------------+----------------------------------+

Thus, binlog_format=MIXED is not supported for READ COMMITTED.

answered Apr 11, 2023 at 15:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.