[MDEV-14705] systemd: EXTEND_TIMEOUT_USEC= to avoid startup and shutdown timeouts Created: 2017-12-19 Updated: 2020-03-25 Resolved: 2018-04-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | 10.1.33, 10.2.15, 10.3.6 |
| Type: | Task | Priority: | Critical |
| Reporter: | Daniel Black | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | contribution, foundation, patch | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | 10.3.6-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Since https://github.com/systemd/systemd/commit/a327431bd168b2f327f3cd422379e213c643f2a5 released in system v236 Type=notify service can now advice to the systemd service manager they are still working to avoid the service timing out. The use of EXTEND_TIMEOUT_USEC= on older services has no effect and is therefore compatible. This needs to be included in (feel free to correct/extend):
I was planning on making the 15 seconds of recv_sys_t->report() more general with respect to interval, and use a define INNODB_REPORT_INTERVAL (include/univ.i?) as the basis for this form of watchdog. I'd send notify messages of INNODB_REPORT_INTERVAL * 2 as an acceptable margin. Anywhere else or other suggestions marko, jplindst?
Any other server/engine slow points to account for? Target 10.3 and then look at a backport? |
| Comments |
| Comment by Sergey Vojtovich [ 2018-03-13 ] | ||||||||||||||||
|
Overdue PR. | ||||||||||||||||
| Comment by Marko Mäkelä [ 2018-03-14 ] | ||||||||||||||||
|
Startup and shutdown are quite different. I would consider them separately. StartupFor startup, the biggest time consumers should be redo log apply and the buffer pool load. For the redo log apply, we cannot know in advance how much work there is to be done. Undo recovery (rolling back incomplete transactions) takes place in a background thread. Starting with ShutdownIn shutdown, there have been multiple hangs. Most recently, I fixed There are different innodb_fast_shutdown modes. By default (innodb_fast_shutdown=1, a fast shutdown is done: all dirty pages are flushed to the buffer pool and a log checkpoint is created. Some progress reporting for the flush phase would be nice. We know exactly how many dirty pages there are, so the progress measure would be linear. There is also the crash-like innodb_fast_shutdown=2 which is supposed to complete instantly. The slowest shutdown is innodb_fast_shutdown=0. It will:
Only after these tasks, it becomes feasible to flush the dirty pages into the data files and to create the final redo log checkpoint. | ||||||||||||||||
| Comment by Daniel Black [ 2018-03-14 ] | ||||||||||||||||
|
quick note - for the purpose of systemd timing startup start from process creation and ends just before accepting the first connection.
On startup I haven't included the buffer pool load because as I understand it it continues in the background while the server is processing queries. I have included the buffer pool save on shutdown too. Exact time need not be known. Only that a loop iteration can progress within a estimated maximium time. | ||||||||||||||||
| Comment by Rick Pizzi [ 2018-03-20 ] | ||||||||||||||||
|
@marko the startup has to consider Galera SST time - can be hours on larger datasets | ||||||||||||||||
| Comment by Daniel Black [ 2018-03-20 ] | ||||||||||||||||
|
rpizzi, SST scripts will be able to communicate just as easily as the server. The tricky bit is identifying the lower bits of the SST and enacting on it. Like for rsync I was thinking of enabling a progress monitoring and getting a subfunction that takes any output on stdout and issues EXTEND_TIMEOUT=... at that point. something like:
Edit: $NOTIFY_SOCKET is a unix socket or an abstract socket. Probably best just to use systemd-notify and check if $NOTIFY_SOCKET is set Assistance in identifying other slow SST components and how to identify progress would be much appreciated. | ||||||||||||||||
| Comment by Rick Pizzi [ 2018-03-21 ] | ||||||||||||||||
|
I believe the script wsrep_sst_xtrabackup-v2 (or mariabackup equivalent) is just spawned via fork/exec, in this case in the parent process, run the loop you have mentioned until the child process completes. | ||||||||||||||||
| Comment by Rick Pizzi [ 2018-03-21 ] | ||||||||||||||||
|
Looks like this SST issue isn't new, just overlooked. | ||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-06 ] | ||||||||||||||||
|
Some cleanup, and testing | ||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-06 ] | ||||||||||||||||
|
rpizzi, I added the timeout extension to InnoDB and XtraDB. Please file a separate ticket for the Galera snapshot transfer, maybe linked to | ||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-08 ] | ||||||||||||||||
|
rpizzi, fraggeln in | ||||||||||||||||
| Comment by Rick Pizzi [ 2018-04-11 ] | ||||||||||||||||
|
"Please file a separate ticket for the Galera snapshot transfer" | ||||||||||||||||
| Comment by Marko Mäkelä [ 2020-03-25 ] | ||||||||||||||||
|
It looks like the Galera issues were ultimately fixed in |