Skip to content
Permalink
Browse files
Fix switch case statement in trx_flush_log_if_needed_low()
In commit 2e814d4 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.
  • Loading branch information
sidhujagdeep authored and dr-m committed Jul 20, 2021
1 parent 1cfcf32 commit 5f8651a
Showing 1 changed file with 1 addition and 1 deletion.
@@ -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;

0 comments on commit 5f8651a

Please sign in to comment.