[MDEV-30813] RESTART statement Created: 2023-03-08  Updated: 2024-01-30

Status: Open
Project: MariaDB Server
Component/s: Server
Fix Version/s: None

Type: Task Priority: Major
Reporter: Ian Gilfillan Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: beginner-friendly, compat80

Attachments: File MDEV-30813.patch    
Issue Links:
PartOf
is part of MDEV-28906 MySQL 8.0 desired compatibility Open

 Description   

MySQL 8 has the RESTART statement. It would be useful to add to MariaDB for compatibility purposes, and is useful in its own right as a relative of the SHUTDOWN statement.

See https://dev.mysql.com/doc/refman/8.0/en/restart.html



 Comments   
Comment by Nikita Malyavin [ 2023-04-17 ]

Should a replica be restarted as well?

Comment by Siavosh Kasravi [ 2024-01-05 ]

I would like to do this.

Comment by Siavosh Kasravi [ 2024-01-11 ]

In progress...

Comment by Siavosh Kasravi [ 2024-01-12 ]

Syntax is like SHUTDOWN. So it also supports WAIT FOR ALL SLAVES. It will exit with status code 16 so that monitoring/parent process can detect a restart request. Code logic checks to see if MARIADBD_PARENT_PID env is set and corresponding process is alive (linux only) before shutdown. It is compatible with mysql RESTART except that the name of the env has MARIADBD_ as the prefix instead of MYSQLD_.

Comment by Sergei Golubchik [ 2024-01-12 ]

Could you implement restart completely within the server executable, why does it need support from the calling process?

Comment by Siavosh Kasravi [ 2024-01-13 ]

It is the way MySQL and MaxScale work and was discussed in its zuli thread.

Comment by Sergei Golubchik [ 2024-01-30 ]

So, two approaches. Simply exit with a special return code or exec itself instead.

Pro exit:

  • MySQL and MaxScale do it this way
  • allows to measure the uptime since the last restart
  • restores resources better (environment and file descriptors, although the server uses O_CLOEXEC anyway)

Pro exec:

  • just works, on itself, does not require support in external tools (e.g. mariadbd-safe, systemd, or k8s)
  • doesn't restart the container
Comment by Sergei Golubchik [ 2024-01-30 ]

Okay, let's do exit(16) then

Generated at Thu Feb 08 10:19:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.