maria:bb-11.1-danielblack-MDEV-25282-Auto-shutdown-on-idle-when-socket-activated-pkgtest

Last commit made on 2023-04-06
Get this branch:
git clone -b bb-11.1-danielblack-MDEV-25282-Auto-shutdown-on-idle-when-socket-activated-pkgtest https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-11.1-danielblack-MDEV-25282-Auto-shutdown-on-idle-when-socket-activated-pkgtest
Repository:
lp:maria

Recent commits

0608086... by Daniel Black

MDEV-25282 Auto-shutdown on idle when socket-activated

Adds max_idle_execution system variable that corresponds
to the time in seconds under which the mariadbd executable will
run in an idle state (since last query) with no connections.

Under systemd socket activation this variable will get a 10 minute
default value, otherwise 0, representing no timeout. This will
enable a service to be activated on connection and fall back to
a shutdown state after 10 minutes of no queries. The systemd
socket activation can restart the service on the next connection
transparently.

The maximum max_idle_execution is given by the following
factors given its dependence on the OS system calls.

Windows WaitForMultipleObjects takes a DWORD (unsigned)
measure in milliseconds. Poll takes a signed int milliseconds,
and negative values are treated as infinite so we can't overflow.
Select, the fall back if poll isn't there, takes a seconds value
in a timeval.time_t structure. As such the interface maximums are:
Windows: UINT_MAX / 1000
Poll: INT_MAX / 1000
Select: UINT_MAX (or higher)

As even the smallest value here, INT_MAX(32) / 1000 is ~25 days,
sufficient for the typical use case, its used in all environment for
simplicity of documentation and test cases.

A (non-exposed) global variable of server_last_activity is updated
on accepted connections (when max_idle_execution !=0)
and when the connection count (standard or extra) is down
to <= 1 to keep the number of updates on a single variable
low.

When the main accept loop times out on the max_idle_execution
seconds, and then the server_last_activity is checked along
with if current connection count (standard + extra) is 0
(in case a recently started connection hasn't finished
a query).

To make this neater, in non-Windows main accept loop moved
code to handle_new_socket_connection that encompasses accepting
a connection and the timeout mechanism has been separated too.

Changed when looping though possible connections, loop until
the end of the connection list and hereby assume two connection can
occur on the same poll/select call and both will be accepted.

The interactive_timeout and wait_timeout inherit the
max_idle_execution time (if set) compared to their previous defaults.

Thanks Sergei for the review.

2b61ff8... by Marko Mäkelä

Merge 11.0 into 11.1

5e01255... by Marko Mäkelä

Merge 10.11 into 11.0

d84a282... by Marko Mäkelä

Merge 10.10 into 10.11

191821f... by Marko Mäkelä

Merge 10.9 into 10.10

55e78eb... by Marko Mäkelä

Merge 10.8 into 10.9

dd2fe81... by Marko Mäkelä

Merge 10.6 into 10.8

0760ad3... by Marko Mäkelä

Merge 10.5 into 10.6

402f36d... by Marko Mäkelä

MDEV-30936 fixup

fil_space_t::~fil_space_t(): Invoke ut_free(name) because
doing so in the callers would trip MSAN_OPTIONS=poison_in_dtor=1

dfa9025... by Marko Mäkelä

MDEV-30936 clang 15.0.7 -fsanitize=memory fails massively

handle_slave_io(), handle_slave_sql(), os_thread_exit():
Remove a redundant pthread_exit(nullptr) call, because it
would cause SIGSEGV.

mysql_print_status(): Add MEM_MAKE_DEFINED() to work around
some missing instrumentation around mallinfo2().

que_graph_free_stat_list(): Invoke que_node_get_next(node) before
que_graph_free_recursive(node). That is the logical and
MSAN_OPTIONS=poison_in_dtor=1 compatible way of freeing memory.

ins_node_t::~ins_node_t(): Invoke mem_heap_free(entry_sys_heap).

que_graph_free_recursive(): Rely on ins_node_t::~ins_node_t().

fts_t::~fts_t(): Invoke mem_heap_free(fts_heap).

fts_free(): Replace with direct calls to fts_t::~fts_t().

The failures in free_root() due to MSAN_OPTIONS=poison_in_dtor=1
will be covered in MDEV-30942.