WL#12861: Support the current mysql-server-mock features for x-protocol.

Affects: Server-8.0   —   Status: Complete


mysql_server_mock is used for the component tests of MySQL Router.

It allows accepting the connections and takes a trace (json) file (that maps the SQL queries to expected results) as a parameter to mock the client server communication.

Currently it only supports the classic protocol. For the new features that MySQLRouter is adding (GR notifications via XPlugin etc.) we also need it to speak the x-protocol.


The goal of this WL is to have similar functionality that we currently have for the classic port to extend it further later on (CRUD, Notices, etc) with another WL.

Functional Requirements:

mysql_server_mock MUST accept xproto connections via its own port.
xproto port of mysql_server_mock MUST be configurable via the command-line
mysql_server_mock MUST authenticate connections via the xproto port using the libmysqlxclient's authentication methods.
statements in the JSON-trace-files MUST work for xproto connections.
(To satisfy FR3, FR4) mysql_server_mock MUST support the at least the xproto messages from the client: CON_CAPABILITIES_SET, SESS_AUTHENTICATE_START, SESS_AUTHENTICATE_CONTINUE, SQL_STMT_EXECUTE

To run the mysql_server_mock with X-protocol server support:

$ mysql_server_mock --xport=1234 --filename=/home/areliga/dev/server/mysql/router/tests/component/data/my_port.js

It binds to TCP port 1234 and handles xproto connections.

Connections from client that speaks xproto (mysqlxtest, mysqlShell) can authenticate. SQL statements received by the client which match the statements in the in *.js file will receive the resultset as a X-protocol messages.