[MDEV-13869] MariaDB slow start Created: 2017-09-22 Updated: 2019-03-09 Resolved: 2018-02-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2.2, 10.3.0 |
| Fix Version/s: | 10.2.13, 10.3.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dan Rimal | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | performance, startup | ||
| Environment: |
ovz container, 2.6.32-042stab120.6, CentOS release 6.7 (Final) |
||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
This DB has about 30GB and a lot of tables in many databases:
Start takes more than 5 minutes with heavy IO load made by mysql process:
During the startup, strace shows this:
Full strace:
I found the very same problem (https://jira.mariadb.org/browse/MDEV-12610) closed as solved in 10.2.7. This is 10.2.8 and looks like problem appears again. This db was 10.0.xx upgraded to 10.1.xx and finally to 10.2.8. Can make this upgrade this issue? |
| Comments |
| Comment by Marko Mäkelä [ 2018-01-16 ] | |||||||||||||
|
In MariaDB 10.2.2, we seem to always open all .ibd files on startup, even when no crash recovery is involved. (When crash recovery is involved, we do this on purpose, as noted in This mistake was made in the merge of MySQL 5.7.9 into MariaDB 10.2.2. The assignment validate=true in dict_check_sys_tables() causes InnoDB to read every single .ibd file at startup, even when no crash recovery is needed. | |||||||||||||
| Comment by Marko Mäkelä [ 2018-01-17 ] | |||||||||||||
|
As far as I can tell, the purpose of the parameter bool validate of fil_ibd_open() is to perform some extra checks in case any inconsistencies were caused by the implementation of DATA DIRECTORY, which was originally introduced in MySQL 5.6 and MariaDB 10.0.
With the above patch, we would skip reading the files in fil_ibd_open() at database startup, but then we would also fail to detect some corruption, because the tests innodb.table_flags and innodb.log_file_name would start to fail. I think that we must try to implement some checks in fil_node_open_file() when first_time_open holds, so that we would always validate the data file when we open it for the very first time. That is a little tricky, because we will not have the dict_table_t available in that context. | |||||||||||||
| Comment by Michael Caplan [ 2018-01-31 ] | |||||||||||||
|
Not a work around, but if you are hitting this issue and on a systemd, you might need to tweak the service settings. If TimeoutStartSec is hit when systemd is trying to start up mariadb, it will kill the process. /etc/systemd/system/mariadb.service.d/tweak.conf [Service] My MariaDB startup time is now weighing in at 36 minutes, which by default would hit the TimeoutStartSec threshold making startup impossible. Even at 7200 seconds (2 hours), I got into trouble when upgrading from 10.2.11 to 10.2.12. The update process has another tax on restart (which I assume is similar to this recorded issue), that had the restart on upgrade hitting TimeoutStartSec. Not sure what would be an acceptable value for TimeoutStartSec. | |||||||||||||
| Comment by Michael Caplan [ 2018-01-31 ] | |||||||||||||
|
@marko are there any workarounds for this issue for Maria 10.2? Or is a rollback to 10.1 the best bet? | |||||||||||||
| Comment by Michael Caplan [ 2018-01-31 ] | |||||||||||||
|
FYI, my 36 minute start time is for a DB roughly 290GB and roughly 991K tables | |||||||||||||
| Comment by Daniel Black [ 2018-02-01 ] | |||||||||||||
|
michaelcaplan FYI - working on getting co-operation between mariadb and systemd regarding startup/shutdown timings. https://github.com/MariaDB/server/pull/576 . Unfortunately requires systemd v236. So I'm really watching this to make sure I have some idea of which slow points in startup/shutdown can't be prevented. | |||||||||||||
| Comment by Marko Mäkelä [ 2018-02-16 ] | |||||||||||||
|
Sorry, but it turns out that there is one more cause of reading all .ibd files at startup. That one was added in MySQL 5.7, which was first merged to MariaDB 10.2.2. See |