codership / galera

Synchronous multi-master replication library
GNU General Public License v2.0
451 stars 176 forks source link

Galera connection monitor service #662

Open janlindstrom opened 3 months ago

janlindstrom commented 3 months ago

Description

Keep track of connections created inside a galera library and report them to server. Ideally we should gather remote_uuid, connection scheme and remote address for both created connections as well as disconnected connections.

High-level implementation

Create a new connection monitor service API on wsrep-API and implement this API on galera library. To know remote UUID we should track gcmcast::Proto object lifetimes. Connections can be tracked in AsioTcpStreamEngine and AsioSslStreamEngine objects.

Idea is to use connection monitor service update callback when connection is connected. After we know UUID for remote node we use connection monitor service update callback again with updated information. Finally, when connection is disconnected we use same connection monitor service update callback to notify server.

Implementation

Implementation requires updaring wsrep-API submodule, wsrep-lib submodule and Galera library code. To show this information to user this needs adding a INFORMATION_SCHEMA plugin to server code where current Galera library connections are cached on in-memory object that is updated by connection monitor service update callback.

Reference

Ref: https://jira.mariadb.org/browse/MDEV-26851 : Provide means to verify Galera using TLS from SQL level