mirror of
https://github.com/MariaDB/server.git
synced 2025-07-24 19:42:23 +03:00
MDEV-22683: Ensure system tables are correctly upgraded in MariaDB 10.4
Running mysql_upgrade should end up with the exact same system tables as fresh installations have after running mysql_install_db. To ensure the upgrade is correct and complete: - Remove the redundant modification of thread_id`. On 5.5 version, the `general_log` table was created as `CREATE TABLE IF NOT EXISTS general_log (..., thread_id INTEGER NOT NULL, ...)`, and starting from 10.0+, the table is created as `CREATE TABLE IF NOT EXISTS general_log (..., thread_id BIGINT(21) UNSIGNED NOT NULL, ...)`, but mysql_upgrade is not properly upgrading the table. It modifies the `thread_id` twice in one query, which could leave the table not modified and lead to other potential error when upgrading from MariaDB 5.5 or older. - Update `servers` to ensure `Host` and `User` has correct data type if upgrading from 10.1 or older. On versions 10.0 and 10.1, the `servers` table was created as `CREATE TABLE IF NOT EXISTS servers (..., Host char(64) NOT NULL DEFAULT , ..., Owner char(64) NOT NULL DEFAULT , ...)`, and starting from 10.2, the table is created as `CREATE TABLE IF NOT EXISTS servers (..., Host varchar(2048) NOT NULL DEFAULT , ..., Owner varchar(512) NOT NULL DEFAULT , ...)`. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
@ -239,7 +239,6 @@ SET GLOBAL general_log = 'OFF';
|
||||
ALTER TABLE general_log
|
||||
MODIFY event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
MODIFY user_host MEDIUMTEXT NOT NULL,
|
||||
MODIFY thread_id INTEGER NOT NULL,
|
||||
MODIFY server_id INTEGER UNSIGNED NOT NULL,
|
||||
MODIFY command_type VARCHAR(64) NOT NULL,
|
||||
MODIFY argument MEDIUMTEXT NOT NULL,
|
||||
@ -841,3 +840,8 @@ IF 1 = (SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def
|
||||
END IF//
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
# MDEV-22683 - upgrade Host and Owner of servers
|
||||
ALTER TABLE servers
|
||||
MODIFY Host varchar(2048) NOT NULL DEFAULT '',
|
||||
MODIFY Owner varchar(512) NOT NULL DEFAULT '';
|
||||
|
Reference in New Issue
Block a user