I have two MySQL servers. Server A is doing statement based logging. Server B is doing row based logging. B is replicating from A.

Does B change the statement based SQL to row based SQL, execute the row based SQL and then log this row based SQL in its binary log, or does it execute the statement based SQL and then translates it to row based SQL before logging it?


The logs will be applied in the format which they are consumed, so on Server B statement based execution is applied.

Whether or not Server B even produces binary logs depends on whether or not binary logging is enabled on Server B. https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_log_bin It is not required if the server is only to be a slave.

Even then, Server B will only produce binary logs related to the updates it receives from Server A if log_slave_updates is set https://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#option_mysqld_log-slave-updates

The resulting log format from the slave updates depends only on what binlog_format is set as on the slave https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_binlog-format

Keep in mind that Server A(statement format) to Server B(row/mixed format) will work fine, but Server A(row/mixed format) to Server B (statement format) will fail. See this question for further explanation https://dba.stackexchange.com/a/159905/129765

To answer your question tersely, Server B executes the statement based SQL and then translates it to row based SQL which it outputs to the binary logs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.