WL#12673: Move the SYS schema sources into the mysql server tree

Affects: Server-8.0   —   Status: Complete

Currently the SYS schema sits in its own git repo. And files are reused across mysql server versions. Then there's a complex merge procedure into the current mysql source tree.

This worklog is about retiring the standalone sys schema repo and making the mysql git repo the "source of truth" for SYS.

This will be required to: 1. streamline and simplify the SYS development 2. allow fixing bugs like BUG#91072 that require different values for different server versions.

Functional Requirements

Apart from minor bug fixes (listed in Docs Notes), this task does not introduce any changes to the SYS schema functionality.

F-1 Verify that SYS.VERSION has increased.

F-1.1 For 5.7, the SYS.VERSION changes from 1.5.1 to 1.5.2
F-1.2 For 8.0, the SYS.VERSION changes from 2.1.0 to 2.1.1

To simplify maintenance of the SYS schema scripts, the init-file option now accepts an expanded query format (in 8.0 only, 5.7 is unchanged).

F-2 In 8.0, the init-file option must support scripts containing any or all of the following elements:

F-2.1 "DELIMITER ;"
F-2.2 "DELIMITER $$"
F-2.3 Multi line queries
F-2.4 "#" style comments
F-2.5 "--" style comments
F-2.6 "/* ... */" style comments (including multi-line)
F-2.7 Multi line single quoted literals
F-2.8 Multi line double quoted literals
F-2.9 Several statements on the same line

Contents


Changes for MySQL 8.0

8.0 SYS_SCHEMA SQL scripts

SQL scripts for 8.0 from the SYS git repository are checked in the server git repository. The file location is scripts/sys_schema.

SQL files are to be changed so that:

  • COMMENT text no longer contains white space padding, to remove post processing of COMMENT.
  • DEFINER clauses are changed to 'mysql.sys'@'localhost', to remove post processing to do the same.
  • File names are renamed to remove any "_57", "_80" suffix.
  • A SQL file is added for privileges, to remove hard coded SQL clauses injected in post processing.
  • Conditional version comments (/*!50600 code */) are removed.

8.0 comp_sql build tool

The 'comp_sql' utility is improved:

  • "DELIMITER ;" is supported.
  • "DELIMITER $$" is supported.
  • Multi line queries are supported.
  • "#" style comments are supported.
  • "--" style comments are supported.
  • "/* ... */" style comments are supported, including multi-line.
  • Multi line single quoted literals are supported.
  • Multi line double quoted literals are supported.
  • Several statements on the same line are supported.

With these new capabilities, comp_sql can consume SYS_SCHEMA SQL scripts as is, removing the need to post process the source and degrade the format.

8.0 mysqld --initialize option

Functionality is unchanged. Engineering change: code is re factored.

8.0 mysqld --init-file option

The --init-file and comp_sql implementation are shared, so the --init-file parser benefits from improvements done in comp_sql.

As a result, the --init-file format is improved:

  • "DELIMITER ;" is supported.
  • "DELIMITER $$" is supported.
  • Multi line queries are supported.
  • "#" style comments are supported.
  • "--" style comments are supported.
  • "/* ... */" style comments are supported, including multi-line.
  • Multi line single quoted literals are supported.
  • Multi line double quoted literals are supported.
  • Several statements on the same line are supported.

8.0 CMAKE build

Compiling SYS_SCHEMA SQL scripts into the server binary is fully integrated in CMake.

No manual steps are necessary.

File scripts/mysql_sys_schema.sql is abandoned, and removed in git.

8.0 Assign SYS.VERSION to the MySQL server version

The SYS schema will be maintained as part of the MySQL server codebase and therefore associated with the MySQL server version. A separate version for the SYS schema is no longer necessary.

The view SYS.VERSION will be retained to accommodate applications that may rely upon it, however, it will be deprecated and eventually removed in a future release.

Changes for MySQL 5.7

The changes in 5.7 are minimal, to achieve the following goals:

  • The SYS_SCHEMA source is maintained in the server git repository.
  • The mysqld server code is untouched, to reduce risks.

When changing the SYS_SCHEMA source, a manual step is required to build, similar to the existing manual step in 5.7.

5.7 SYS_SCHEMA SQL scripts

SQL scripts for 5.7 from the SYS git repository are checked in the server git repository. The file location is scripts/sys_schema.

SQL files are to be changed so that:

  • COMMENT text no longer contains white space padding, to remove post processing of COMMENT.
  • DEFINER clauses are changed to 'mysql.sys'@'localhost', to remove post processing to do the same.
  • File names are renamed to remove any "_57", "_80" suffix.
  • A SQL file is added for privileges, to remove hard coded SQL clauses injected in post processing.
  • Conditional version comments (/*!50600 code */) are removed.

These changes are identical to the changes done for 8.0.

The goal is to have clean source code in 5.7 and 8.0, that can be merged naturally.

5.7 comp_sql build tool

None.

The limitations of comp_sql will remain in 5.7.

5.7 mysqld --initialize option

None.

5.7 mysqld --init-file option

None.

The limitations of --init-file will remain in 5.7.

5.7 CMAKE build

None.

The build is not integrated with CMAKE, and is unchanged in 5.7.

5.7 Assign SYS.VERSION to the MySQL server version

The SYS schema will be maintained as part of the MySQL server codebase and therefore associated with the MySQL server version. A separate version for the SYS schema is no longer necessary.

The SYS.VERSION view will be retained to accommodate applications that may rely upon it.

5.7 Developer build

A developer script must be executed each time a commit changes the SYS_SCHEMA source code, to generate the file scripts/mysql_sys_schema.sql from source.

This file is checked in, as before in 5.7.

Changes for MySQL 5.6 and earlier

None.

The SYS_SCHEMA is not included in MySQL 5.6.

Changes for the SYS git repository

This repository is abandoned.

SYS_SCHEMA code will be shipped as part of:

  • MySQL 5.7
  • MySQL 8.0 and later.

The SYS_SCHEMA code will no longer be delivered independently.