List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:February 25 2009 8:24am
Subject:bzr commit into mysql-5.1-bugteam branch (Davi.Arnaut:2818) Bug#36540
View as plain text  
#At file:///data0/my/darnaut/mysql-repo/work/36540-5.1/ based on revid:aelkin@stripped

 2818 Davi Arnaut	2009-02-25
      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
      1 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.
     @ mysql-test/r/events_bugs.result
        Add test case result for Bug#36540
     @ mysql-test/r/log_tables.result
        Update column type.
     @ mysql-test/r/system_mysql_db.result
        Update column type.
     @ mysql-test/r/variables.result
        Add test case result for server_id value range.
     @ mysql-test/suite/sys_vars/r/server_id_basic_64.result
        Update test case results.
     @ mysql-test/t/events_bugs.test
        Add test case for Bug#36540
     @ mysql-test/t/log_tables.test
        Fix column type.
     @ mysql-test/t/variables.test
        Add test case for server_id value range.
     @ scripts/mysql_system_tables.sql
        Columns that store the server_id value must be of type INT UNSIGNED,
                fix event (originator), general_log and slow_log (server_id) tables
                in accordance.
     @ scripts/mysql_system_tables_fix.sql
        Columns that store the server_id value must be of type INT UNSIGNED,
        fix event (originator), general_log and slow_log (server_id) tables
        in accordance.
     @ sql/mysqld.cc
        Set min and max values for the server_id variable.
        Unfortunately we can't easily change server_id variable type
        from ulong to uint32 because of the sys_var classes.

    modified:
      mysql-test/r/events_bugs.result
      mysql-test/r/log_tables.result
      mysql-test/r/system_mysql_db.result
      mysql-test/r/variables.result
      mysql-test/suite/sys_vars/r/server_id_basic_64.result
      mysql-test/t/events_bugs.test
      mysql-test/t/log_tables.test
      mysql-test/t/variables.test
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_fix.sql
      sql/mysqld.cc
=== modified file 'mysql-test/r/events_bugs.result'
--- a/mysql-test/r/events_bugs.result	2009-01-23 12:22:05 +0000
+++ b/mysql-test/r/events_bugs.result	2009-02-25 08:21:42 +0000
@@ -736,6 +736,17 @@ select replace(@full_mode, 'ALLOW_INVALI
 select name from mysql.event where name = 'p' and sql_mode = @full_mode;
 name
 drop event e1;
+SET @old_server_id = @@GLOBAL.server_id;
+SET GLOBAL server_id = (1 << 32) - 1;
+SELECT @@GLOBAL.server_id;
+@@GLOBAL.server_id
+4294967295
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
+event_name	originator
+ev1	4294967295
+DROP EVENT ev1;
+SET GLOBAL server_id = @old_server_id;
 DROP DATABASE events_test;
 SET GLOBAL event_scheduler= 'ON';
 SET @@global.concurrent_insert= @concurrent_insert;

=== modified file 'mysql-test/r/log_tables.result'
--- a/mysql-test/r/log_tables.result	2008-11-13 19:19:00 +0000
+++ b/mysql-test/r/log_tables.result	2009-02-25 08:21:42 +0000
@@ -56,7 +56,7 @@ general_log	CREATE TABLE `general_log` (
   `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `user_host` mediumtext NOT NULL,
   `thread_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `command_type` varchar(64) NOT NULL,
   `argument` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
@@ -65,7 +65,7 @@ Field	Type	Null	Key	Default	Extra
 event_time	timestamp	NO		CURRENT_TIMESTAMP	on update CURRENT_TIMESTAMP
 user_host	mediumtext	NO		NULL	
 thread_id	int(11)	NO		NULL	
-server_id	int(11)	NO		NULL	
+server_id	int(10) unsigned	NO		NULL	
 command_type	varchar(64)	NO		NULL	
 argument	mediumtext	NO		NULL	
 show create table mysql.slow_log;
@@ -80,7 +80,7 @@ slow_log	CREATE TABLE `slow_log` (
   `db` varchar(512) NOT NULL,
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `sql_text` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
 show fields from mysql.slow_log;
@@ -94,7 +94,7 @@ rows_examined	int(11)	NO		NULL	
 db	varchar(512)	NO		NULL	
 last_insert_id	int(11)	NO		NULL	
 insert_id	int(11)	NO		NULL	
-server_id	int(11)	NO		NULL	
+server_id	int(10) unsigned	NO		NULL	
 sql_text	mediumtext	NO		NULL	
 flush logs;
 flush tables;
@@ -167,7 +167,7 @@ general_log	CREATE TABLE `general_log` (
   `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `user_host` mediumtext NOT NULL,
   `thread_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `command_type` varchar(64) NOT NULL,
   `argument` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
@@ -183,7 +183,7 @@ slow_log	CREATE TABLE `slow_log` (
   `db` varchar(512) NOT NULL,
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `sql_text` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
 alter table mysql.general_log engine=myisam;
@@ -194,7 +194,7 @@ general_log	CREATE TABLE `general_log` (
   `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `user_host` mediumtext NOT NULL,
   `thread_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `command_type` varchar(64) NOT NULL,
   `argument` mediumtext NOT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log'
@@ -210,7 +210,7 @@ slow_log	CREATE TABLE `slow_log` (
   `db` varchar(512) NOT NULL,
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `sql_text` mediumtext NOT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
 set global general_log='ON';
@@ -268,7 +268,7 @@ CREATE TABLE `general_log` (
 ON UPDATE CURRENT_TIMESTAMP,
 `user_host` mediumtext NOT NULL,
 `thread_id` int(11) NOT NULL,
-`server_id` int(11) NOT NULL,
+`server_id` int(10) unsigned NOT NULL,
 `command_type` varchar(64) NOT NULL,
 `argument` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
@@ -283,7 +283,7 @@ ON UPDATE CURRENT_TIMESTAMP,
 `db` varchar(512) NOT NULL,
 `last_insert_id` int(11) NOT NULL,
 `insert_id` int(11) NOT NULL,
-`server_id` int(11) NOT NULL,
+`server_id` int(10) unsigned NOT NULL,
 `sql_text` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
 set global general_log='ON';

=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result	2008-02-28 11:21:44 +0000
+++ b/mysql-test/r/system_mysql_db.result	2009-02-25 08:21:42 +0000
@@ -227,7 +227,7 @@ event	CREATE TABLE `event` (
   `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
   `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
   `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
-  `originator` int(10) NOT NULL,
+  `originator` int(10) unsigned NOT NULL,
   `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
   `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
   `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
@@ -241,7 +241,7 @@ general_log	CREATE TABLE `general_log` (
   `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `user_host` mediumtext NOT NULL,
   `thread_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `command_type` varchar(64) NOT NULL,
   `argument` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
@@ -257,7 +257,7 @@ slow_log	CREATE TABLE `slow_log` (
   `db` varchar(512) NOT NULL,
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `sql_text` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
 show tables;

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2009-01-30 13:44:49 +0000
+++ b/mysql-test/r/variables.result	2009-02-25 08:21:42 +0000
@@ -1341,3 +1341,27 @@ SET @@session.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
 SET @@global.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
+SET @old_server_id = @@GLOBAL.server_id;
+SET GLOBAL server_id = (1 << 32) - 1;
+SELECT @@GLOBAL.server_id;
+@@GLOBAL.server_id
+4294967295
+SET GLOBAL server_id = (1 << 32);
+Warnings:
+Warning	1292	Truncated incorrect server-id value: '4294967296'
+SELECT @@GLOBAL.server_id;
+@@GLOBAL.server_id
+4294967295
+SET GLOBAL server_id = (1 << 64);
+SELECT @@GLOBAL.server_id;
+@@GLOBAL.server_id
+0
+SET GLOBAL server_id = 0;
+SELECT @@GLOBAL.server_id;
+@@GLOBAL.server_id
+0
+SET GLOBAL server_id = -1;
+SELECT @@GLOBAL.server_id;
+@@GLOBAL.server_id
+0
+SET GLOBAL server_id = @old_server_id;

=== modified file 'mysql-test/suite/sys_vars/r/server_id_basic_64.result'
--- a/mysql-test/suite/sys_vars/r/server_id_basic_64.result	2008-07-23 14:06:44 +0000
+++ b/mysql-test/suite/sys_vars/r/server_id_basic_64.result	2009-02-25 08:21:42 +0000
@@ -60,9 +60,11 @@ SELECT @@global.server_id;
 @@global.server_id
 0
 SET @@global.server_id = 2147483649*2;
+Warnings:
+Warning	1292	Truncated incorrect server-id value: '4294967298'
 SELECT @@global.server_id;
 @@global.server_id
-4294967298
+4294967295
 SET @@global.server_id = 65530.34.;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
 SET @@global.server_id = '125';

=== modified file 'mysql-test/t/events_bugs.test'
--- a/mysql-test/t/events_bugs.test	2009-01-23 12:22:05 +0000
+++ b/mysql-test/t/events_bugs.test	2009-02-25 08:21:42 +0000
@@ -1209,6 +1209,18 @@ select replace(@full_mode, 'ALLOW_INVALI
 select name from mysql.event where name = 'p' and sql_mode = @full_mode;
 drop event e1;
 
+#
+# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
+#
+
+SET @old_server_id = @@GLOBAL.server_id;
+SET GLOBAL server_id = (1 << 32) - 1;
+SELECT @@GLOBAL.server_id;
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
+DROP EVENT ev1;
+SET GLOBAL server_id = @old_server_id;
+
 ###########################################################################
 #
 # End of tests

=== modified file 'mysql-test/t/log_tables.test'
--- a/mysql-test/t/log_tables.test	2008-11-13 19:19:00 +0000
+++ b/mysql-test/t/log_tables.test	2009-02-25 08:21:42 +0000
@@ -287,7 +287,7 @@ CREATE TABLE `general_log` (
                          ON UPDATE CURRENT_TIMESTAMP,
   `user_host` mediumtext NOT NULL,
   `thread_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `command_type` varchar(64) NOT NULL,
   `argument` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
@@ -303,7 +303,7 @@ CREATE TABLE `slow_log` (
   `db` varchar(512) NOT NULL,
   `last_insert_id` int(11) NOT NULL,
   `insert_id` int(11) NOT NULL,
-  `server_id` int(11) NOT NULL,
+  `server_id` int(10) unsigned NOT NULL,
   `sql_text` mediumtext NOT NULL
 ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
 

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2009-02-02 22:56:45 +0000
+++ b/mysql-test/t/variables.test	2009-02-25 08:21:42 +0000
@@ -1079,3 +1079,20 @@ SET @@session.thread_stack= 7;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@global.thread_stack= 7;
 #
+
+#
+# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
+#
+
+SET @old_server_id = @@GLOBAL.server_id;
+SET GLOBAL server_id = (1 << 32) - 1;
+SELECT @@GLOBAL.server_id;
+SET GLOBAL server_id = (1 << 32);
+SELECT @@GLOBAL.server_id;
+SET GLOBAL server_id = (1 << 64);
+SELECT @@GLOBAL.server_id;
+SET GLOBAL server_id = 0;
+SELECT @@GLOBAL.server_id;
+SET GLOBAL server_id = -1;
+SELECT @@GLOBAL.server_id;
+SET GLOBAL server_id = @old_server_id;

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2008-07-31 09:50:24 +0000
+++ b/scripts/mysql_system_tables.sql	2009-02-25 08:21:42 +0000
@@ -66,7 +66,7 @@ CREATE TABLE IF NOT EXISTS procs_priv ( 
 
 -- Create general_log if CSV is enabled.
 
-SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
+SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
 
 PREPARE stmt FROM @str;
 EXECUTE stmt;
@@ -74,13 +74,13 @@ DROP PREPARE stmt;
 
 -- Create slow_log if CSV is enabled.
 
-SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
+SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
 
 PREPARE stmt FROM @str;
 EXECUTE stmt;
 DROP PREPARE stmt;
 
-CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode  set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','!
 NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode  set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','!
 NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
 
 
 CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2008-04-04 16:46:05 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2009-02-25 08:21:42 +0000
@@ -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

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-02-24 11:29:49 +0000
+++ b/sql/mysqld.cc	2009-02-25 08:21:42 +0000
@@ -6248,7 +6248,7 @@ Can't be set to 1 if --log-slave-updates
    GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"server-id",	OPT_SERVER_ID,
    "Uniquely identifies the server instance in the community of replication partners.",
-   (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
+   (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
    0, 0, 0},
   {"set-variable", 'O',
    "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",


Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20090225082142-iba4b9ubkfcou2rb.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Davi.Arnaut:2818) Bug#36540Davi Arnaut25 Feb