maria:bb-10.10-MDEV-16440

Last commit made on 2023-03-23
Get this branch:
git clone -b bb-10.10-MDEV-16440 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.10-MDEV-16440
Repository:
lp:maria

Recent commits

c16b242... by Nikita Malyavin

wake up from sleep

d8c908b... by Nikita Malyavin

APC: fix LOCK_global_system_variables contention

295689c... by Nikita Malyavin

APC: support waking up sleeping threads;

0d104ba... by Nikita Malyavin

set_var.cc: fix type conversion

613fe3d... by Nikita Malyavin

stress

dd77cd4... by Nikita Malyavin

fix async

9c57bbf... by Nikita Malyavin

APC tpool for *nix: Notifiable_work_zone

The problem we are solving here is support for this king of queries:

SELECT * FROM pfs.variables_by_thread;

It should read out all the thread's session variables.
This can be solved by wrapping all the connection's local variables access
with a mutex, which is highly unwanted because of the potential overhead.

So the solution of choice is inter-thread communication mechanism
asynchronous procedure call (APS) which by the way was already used for
SHOW PROCESSLIST, but displayed only acctive (i.e. long-running) processes.

The thing is that it's hard to say whether the connection is sleeping and
to wake it up with a guarantee of no signal lost/skipped.

Consider a thread pool here: a task may be inactive with a socket waiting
on epoll/kqueue/etc. To receive an APC response, we might want to, for
example, disable the epoll/kqueue event and dry-run the connection-task
once manually (or better in the worker thread).

It's hard to determine, when should we run the task manually, and when to
leave it to the active task.
What's worse, on linux epoll even doesn't say, whether the socket was
enabled for waiting or not! (i.e. there's no querying api).

The windows solution is elegant: CancelIoEx allows to mark a particular
socket (or file descriptor) as cancelled: if the task is in the poll,
it will be woken up with a "cancelled" state. if it's not in the poll,
the socket is marked as "cancelled", and will report it once the waiting
will occur. See the prev commit.

This commit introduces a new lock-free idiom Notifiable_work_zone:
an atomic bitset, that controls the state of the connection and also
resolves the resource management problem.

For a deeper problem setup and documentation see notifiable_work_zone.h.

913ab84... by Nikita Malyavin

Tweak thread pool on non-windows

Current inheritance tree for TP_conneciton is:
TP_connection // abstract
|-TP_connection_generic
--TP_connection_win // only on windows
The same applies to TP_pool tree, which maps one-to-one to the latter.

Suchwise, a polymorphic OO design was made specifically for windows
support.

This patch removes the overhead generated by virtual function calls by
providing a TP_connection_generic pointer in most places directly, through
a platform-dependent typedef.

As a result, such function like start_io, which can be very hot, is now
called without a pointer indirection.

6d0ac7f... by Vladislav Vaintroub

MDEV-16440 Implement a working Windows APC

75fc87b... by Nikita Malyavin

APC for tpool: infrastructure