diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-03-11 17:30:56 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-03-11 17:30:56 -0300 |
commit | c5bb49d020066c2805efc52507e904d8342ed0a7 (patch) | |
tree | d672fd8c16180cf05a73eb32d08e77a091a2adaa /scripts/mysql_system_tables_fix.sql | |
parent | cd7d25f4b900f11a3789bb485d098b58b31a0afb (diff) | |
download | mariadb-git-c5bb49d020066c2805efc52507e904d8342ed0a7.tar.gz |
Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
The problem is that creating a event could fail if the value of
the variable server_id didn't fit in the originator column of
the event system table. The cause is two-fold: it was possible
to set server_id to a value outside the documented range (from
0 to 2^32-1) and the originator column of the event table didn't
have enough room for values in this range.
The log tables (general_log and slow_log) also don't have a proper
column type to store the server_id and having a large server_id
value could prevent queries from being logged.
The solution is to ensure that all system tables that store the
server_id value have a proper column type (int unsigned) and that
the variable can't be set to a value that is not within the range.
Diffstat (limited to 'scripts/mysql_system_tables_fix.sql')
-rw-r--r-- | scripts/mysql_system_tables_fix.sql | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index a33c4fcb9fa..a6497f57f0a 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -216,6 +216,20 @@ ALTER TABLE func MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL; # +# Modify log tables. +# + +SET @old_log_state = @@global.general_log; +SET GLOBAL general_log = 'OFF'; +ALTER TABLE general_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL; +SET GLOBAL general_log = @old_log_state; + +SET @old_log_state = @@global.slow_query_log; +SET GLOBAL slow_query_log = 'OFF'; +ALTER TABLE slow_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL; +SET GLOBAL slow_query_log = @old_log_state; + +# # Detect whether we had Create_view_priv # SET @hadCreateViewPriv:=0; @@ -471,7 +485,10 @@ ALTER TABLE event MODIFY sql_mode 'PAD_CHAR_TO_FULL_LENGTH' ) DEFAULT '' NOT NULL AFTER on_completion; ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default ''; -ALTER TABLE event ADD COLUMN originator INT(10) NOT NULL AFTER comment; + +ALTER TABLE event MODIFY COLUMN originator INT UNSIGNED NOT NULL; +ALTER TABLE event ADD COLUMN originator INT UNSIGNED NOT NULL AFTER comment; + ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED'; ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1 |