[MDEV-11937] InnoDB flushes redo log too often Created: 2017-01-29 Updated: 2021-12-23 Resolved: 2017-08-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication, Storage Engine - InnoDB |
| Affects Version/s: | 10.2.3 |
| Fix Version/s: | 10.2.8 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Axel Schwenke | Assignee: | Kristian Nielsen |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
When I did the benchmark tests for At higher thread counts the commit group size in MariaDB 10.2 increases as expected, but it stays well below the numbers I see for MariaDB 10.1 and MySQL 5.7. I suspect that InnoDB always does two fsyncs on the redo log when it should do only one. The effect gets visible with innodb_flush_log_at_trx_commit=1 and enabled binlog (log-bin = xxx) no matter if sync-binlog = 0 or sync-binlog = 1. Disabling the binlog puts everything back to normal. Another visible effect of the excessive flushing is reduced throughput in read/write OLTP benchmarks in comparison to MariaDB 10.1 and MySQL 5.7. The commit group size for the binlog is also smaller in MariaDB 10.2 (again in comparison to MariaDB 10.1 and MySQL 5.7). Another unexpected observation is this: the InnoDB redo log commit group size decreases, when going from sync_binlog=0 to sync_binlog=1. For the binlog commit group size it's the other way round: sync_binlog=1 gives bigger groups than sync_binlog=0. Also both numbers differ significantly. I had expected to see roughly the same commit group size for the binlog and the redo log. The indicator I used here is Binlog_commits in relation to Binlog_group_commits. I attach a spread sheet with my numbers. See also |
| Comments |
| Comment by Axel Schwenke [ 2017-01-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
the my.cnf used:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-02-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The following MySQL 5.7 change was not fully merged to MariaDB Server 10.2:
This added a Boolean parameter to the handlerton::flush_logs operation:
The merge from MySQL 5.7 to MariaDB Server 10.2 omitted these changes, and instead only added a dummy wrapper function to InnoDB:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2017-02-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I tried to avoid server changes when InnoDB 5.7 was merged to 10.2.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-03-15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Furthermore, in trx_commit_in_memory() in storage/innobase/trx/trx0trx.cc, MariaDB Server 10.2 is missing some code that exists in MySQL 5.7:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-03-15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I think that in addition to the already mentioned commit we also want to merge this change that adds MYSQL_BIN_LOG::prepare, THD::durability_property, and thd_requested_durability(), among other things. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-04-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
marko, I don't see how these changes in innobase_flush_logs() could possibly affect anything, MariaDB doesn't call flush_logs as often as MySQL does. This code in trx_commit_in_memory() seems to be presern in MariaDB. But I don't see how it could help either. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-06-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elkin, I hope you can investigate this. Related to this, I hope that you can import and adapt the public tests from MySQL 5.7 that you did when fixing MySQL Bug #12161 Xa recovery and client disconnection. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2017-06-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Marko, Sure, let me try to look at it from my end. A. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2017-07-03 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Maybe this mentioned code from MySQL 5.7 is their optimisation to avoid having to fsync the innodb redo log after binlog commit? MariaDB implements this in a different way, using binlog checkpoints. There is some info on that here: http://kristiannielsen.livejournal.com/16382.html It really is critical that these issues are properly dealt with before merging any new InnoDB code into MariaDB. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2017-08-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Just a note: Kristian has promised to take a look at this. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2017-08-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Patch: https://github.com/MariaDB/server/commit/c5aa11cbb9cba7807cdf77bb3e5223be2d7389de Mailing list thread: https://lists.launchpad.net/maria-developers/msg10832.html |