| Bug #99935 | innodb_doublewrite_files is not correct when innodb_buffer_pool_size > 1G | ||
|---|---|---|---|
| Submitted: | 19 Jun 2020 2:42 | Modified: | 19 Jun 2020 9:12 |
| Reporter: | Satya Bodapati (OCA) | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
| Version: | 8.0.20 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[19 Jun 2020 2:48]
Satya Bodapati
https://github.com/mysql/mysql-server/pull/300
[19 Jun 2020 8:30]
Satya Bodapati
mtr testcase
Attachment: dblwr_file_count.test (application/octet-stream, text), 486 bytes.
[19 Jun 2020 8:30]
Satya Bodapati
mtr testcase
Attachment: dblwr_file_count-master.opt (application/octet-stream, text), 29 bytes.
[19 Jun 2020 8:46]
MySQL Verification Team
Hello Satya, Thank you for the report and feedback! regards, Umesh
[19 Jun 2020 9:12]
Satya Bodapati
Thanks for verifying the bug Umesh! Request the dev who handles this bug to take patch from github
[19 Jun 2020 9:27]
MySQL Verification Team
Sure thing, I'll let the developer know about this. Alternatively, you can attach the patch here using "Contributions" tab. Thank you! Sincerely, Umesh
[19 Jun 2020 13:45]
OCA Admin
Contribution submitted via Github - Bug#99935 : innodb_doublewrite_files is not correct when innodb_buffe… (*) Contribution by Satya Bodapati (Github satya-bodapati, mysql-server/pull/300#issuecomment-646479428): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: git_patch_436857599.txt (text/plain), 3.42 KiB.

Description: According to documentation, default value of innodb_doublewrite_files is innodb_buffer_pool_instances * 2 But when you start InnoDB with buffer pool size > 1G (the number of instances is 8), it still creates 2 files only. Expected files is 16 (8*2). How to repeat: Steps to repro: mysqld --no-defaults --innodb_buffer_pool_size=2G --datadir=./data ls -l data/ -> show two .dblwr files total 177380 -rw-r----- 1 satya satya 56 Jun 18 19:34 auto.cnf -rw-r----- 1 satya satya 179 Jun 18 20:24 binlog.000001 -rw-r----- 1 satya satya 179 Jun 19 07:40 binlog.000002 -rw-r----- 1 satya satya 179 Jun 19 07:42 binlog.000003 -rw-r----- 1 satya satya 179 Jun 19 08:00 binlog.000004 -rw-r----- 1 satya satya 179 Jun 19 08:01 binlog.000005 -rw-r----- 1 satya satya 179 Jun 19 08:02 binlog.000006 -rw-r----- 1 satya satya 179 Jun 19 08:04 binlog.000007 -rw-r----- 1 satya satya 156 Jun 19 08:09 binlog.000008 -rw-r----- 1 satya satya 128 Jun 19 08:09 binlog.index -rw------- 1 satya satya 1680 Jun 18 19:34 ca-key.pem -rw-r--r-- 1 satya satya 1112 Jun 18 19:34 ca.pem -rw-r--r-- 1 satya satya 1112 Jun 18 19:34 client-cert.pem -rw------- 1 satya satya 1676 Jun 18 19:34 client-key.pem -rw-r----- 1 satya satya 589824 Jun 19 08:09 '#ib_16384_0.dblwr' -rw-r----- 1 satya satya 8978432 Jun 19 08:09 '#ib_16384_1.dblwr' -rw-r----- 1 satya satya 3370 Jun 19 08:04 ib_buffer_pool -rw-r----- 1 satya satya 12582912 Jun 19 08:09 ibdata1 -rw-r----- 1 satya satya 50331648 Jun 19 08:09 ib_logfile0 -rw-r----- 1 satya satya 50331648 Jun 18 19:33 ib_logfile1 -rw-r----- 1 satya satya 12582912 Jun 19 08:09 ibtmp1 drwxr-x--- 2 satya satya 4096 Jun 19 08:09 '#innodb_temp' drwxr-x--- 2 satya satya 4096 Jun 18 19:34 mysql -rw-r----- 1 satya satya 25165824 Jun 19 08:09 mysql.ibd drwxr-x--- 2 satya satya 4096 Jun 18 19:34 performance_schema -rw------- 1 satya satya 1676 Jun 18 19:34 private_key.pem -rw-r--r-- 1 satya satya 452 Jun 18 19:34 public_key.pem -rw-r----- 1 satya satya 6 Jun 19 08:09 satya-lenovo-yoga-920.pid -rw-r--r-- 1 satya satya 1112 Jun 18 19:34 server-cert.pem -rw------- 1 satya satya 1680 Jun 18 19:34 server-key.pem drwxr-x--- 2 satya satya 4096 Jun 18 19:34 sys -rw-r----- 1 satya satya 10485760 Jun 19 08:09 undo_001 -rw-r----- 1 satya satya 10485760 Jun 19 08:09 undo_002 Suggested fix: diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 45fe60f126d..2242f2674a6 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -1721,7 +1721,9 @@ dberr_t dblwr::open(bool create_new_db) noexcept { uint32_t segments_per_file{}; if (dblwr::n_files == 0) { - dblwr::n_files = 2; + dblwr::n_files = std::max(2UL, srv_buf_pool_instances * 2); + } else if (dblwr::n_files > (srv_buf_pool_instances * 2)) { + dblwr::n_files = srv_buf_pool_instances * 2; } ib::info(ER_IB_MSG_DBLWR_1324) @@ -1734,7 +1736,7 @@ dberr_t dblwr::open(bool create_new_db) noexcept { ib::info(ER_IB_MSG_DBLWR_1323) << "Double write buffer pages per instance: " << dblwr::n_pages; - if (Double_write::s_n_instances < dblwr::n_files) { + if (Double_write::s_n_instances <= dblwr::n_files) { segments_per_file = 1; Double_write::s_files.resize(Double_write::s_n_instances); } else {