Commit 5f8651ac authored by Jagdeep Sidhu's avatar Jagdeep Sidhu Committed by Marko Mäkelä

Fix switch case statement in trx_flush_log_if_needed_low()

In commit 2e814d47 on MariaDB 10.2
the switch case statement in trx_flush_log_if_needed_low() regressed.

Since 10.2 this code was refactored to have switches in descending
order, so value of 3 for innodb_flush_log_at_trx_commit is behaving
the same as value of 2, that is no FSYNC is being enforced during
COMMIT phase. The switch should however not be empty and cases 2 and 3
should not have the identical contents.

As per documentation, setting innodb_flush_log_at_trx_commit to 3
should do FSYNC to disk if innodb_flush_log_at_trx_commit is set to 3.
This fixes the regression so that the switch statement again does
what users expect the setting should do.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
parent 1cfcf32c
......@@ -1559,12 +1559,12 @@ trx_flush_log_if_needed_low(
bool flush = srv_file_flush_method != SRV_NOSYNC;
switch (srv_flush_log_at_trx_commit) {
case 3:
case 2:
/* Write the log but do not flush it to disk */
flush = false;
/* fall through */
case 1:
case 3:
/* Write the log and optionally flush it to disk */
log_write_up_to(lsn, flush);
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment