WL#11040: X Protocol installed by default

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

Summary

MySQL Server must be available through X Protocol in default MySQL 8 installation.

In case the user wants to lock down the MySQL Server, it should stay possible to:

  • disable building the mysqlx plugin
  • disable loading the mysqlx plugin

Current Behaviour in 5.7

To build the mysqlx plugin, the user must:

  • get an version of MySQL Server that has X Plugin
  • build the MySQL Server without specifying -DWITH_RAPID=no or -DWITH_MYSQLX=no or -DMYSQLX_DISABLE=ON

To use the X Protocol, user must:

  • install X Plugin permanently by executing one of commands below:

    INSTALL PLUGIN 'mysqlx' SONAME "mysqlx.so";
    INSTALL PLUGIN 'mysqlx' SONAME "mysqlx.dll";
    
  • or start mysql-server with:

    mysqld --plugin-load-add="mysqlx=mysqlx.so"
    mysqld --plugin-load-add="mysqlx=mysqlx.dll"
    

Goal

The user should not have to explicitly install the mysqlx plugin to use the X Protocol. Instead it must be available by default.

To achieve that the plugin MUST not be removed from the sources when rapid sources are removed.

Notes

In WL#10992 a X Protocol password cache plugin was introduced. The new plugin is placed inside the same binary as mysqlx plugin. This means that "mysqlx.so" contains mysqlx and mysqlx_cache_cleaner plugins. The command to install new plugin is almost the same as of the old one:

INSTALL PLUGIN mysqlx_cache_cleaner SONAME 'mysqlx.so';

Merging of "mysqlx.so" adds two plugins into mysqld. The worklog focuses on "mysqlx" still the same rules apply to "mysqlx_cache_cleaner". For example it can be disabled by adding to cnf:

mysqlx_cache_cleaner=0

or cmd line:

--mysqlx_cache_cleaner=0

Functional Requirements

Source Level Requirements

SRC1
mysqlx plugin MUST not be a rapid plugin
SRC2
a user MUST be able to disable building mysqlx plugin

Startup Time Requirements

RUN1
a user MUST be able to disable loading mysqlx plugin at startup time
RUN2
user MUST be able to connect to MySQL Server by X Protocol after new database initialization with default values

Upgrade Requirements

UP1
a user running MySQL 5.7 that wasn't using mysqlx plugin MUST have mysqlx plugin enabled in 8.0 after upgrade
UP2
a user running MySQL 5.7 that was using mysqlx plugin MUST have mysqlx plugin enabled in 8.0 after upgrade
UP3
a user running MySQL 5.7 that had INSTALLed the mysqlx plugin, but disabled loading it with skip-mysqlx in the configuration, it MUST be disabled in 8.0 too

Implementation of Runtime Requirements

Multiple way exist to load the plugin by default:

  • install it at --initialize time and handle upgrade cases manually
  • linking the plugin into the mysqld binaries statically

Install plugin at --initialize

Cons:

  • changing setup/update scripts, which must install the plugin
  • requires two INSTALL PLUGINs calls load other mysql-plugins from the same .so (WL#10992)

Link plugin statically into the mysqld

Pros:

  • always enabled, with no changes to the setup scripts
  • simpler installation and upgrade handling

Decision

Linking X Plugin into mysqld is the easiest way of integration which is going to be implemented.

Implementation of Source Requirements

For SRC1, User must not be able to turn off the compilation of X Plugin by specifying "-DWITH_RAPID=OFF"

For SRC2,

  1. User must be able to turn off the compilation and installation of X Plugin by specifying "-DWITH_MYSQLX=OFF". Both cmake variables are auto-generated for every plugin by MySQL Servers cmake files.
  2. User must able to initialize new database when X Plugin isn't compiled
  3. User must able to start MySQL Server when X Plugin isn't compiled

Implementation of Startup Time Requirements

For RUN1, current plugin infrastructure allows user to disable a plugin using:

  1. From config file by adding mysqlx=0
  2. From command line by adding --mysqlx=0
  3. From command line by adding --skip-mysqlx

MTR tests

New component is going to be introduced to reset X Plugin status variables between MTR tests. To do the reset, the script needs to execute following SQL sequence:

INSTALL COMPONENT "file://component_mysqlx_global_reset";
SELECT mysqlx_reset_global_status_variables() != 1

It should be used only by tests.