List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 4 2010 4:10pm
Subject:bzr commit into mysql-trunk branch (Georgi.Kodinov:3045)
View as plain text  
#At file:///Users/kgeorge/mysql/work/B52315-trunk-merge/ based on revid:luis.soares@stripped

 3045 Georgi Kodinov	2010-06-04 [merge]
      merge

    added:
      mysql-test/include/mysqlhotcopy.inc
      mysql-test/r/mysqlhotcopy_archive.result
      mysql-test/r/mysqlhotcopy_myisam.result
      mysql-test/t/mysqlhotcopy_archive.test
      mysql-test/t/mysqlhotcopy_myisam.test
    modified:
      BUILD/SETUP.sh
      mysql-test/collections/default.experimental
      mysql-test/lib/mtr_misc.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/variables.result
      mysql-test/t/disabled.def
      mysql-test/t/variables.test
      sql/mysqld.cc
      sql/sql_class.h
      sql/sql_parse.cc
      sql/sys_vars.cc
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	2010-05-31 09:18:27 +0000
+++ b/BUILD/SETUP.sh	2010-06-04 16:09:50 +0000
@@ -119,6 +119,9 @@ fi
 
 # Set flags for various build configurations.
 # Used in -valgrind builds
+# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
+# LINT_INIT(), which is only useful for silencing spurious warnings
+# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
 valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
 valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
 #

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2010-06-01 12:31:37 +0000
+++ b/mysql-test/collections/default.experimental	2010-06-04 16:09:50 +0000
@@ -91,3 +91,5 @@ parts.partition_mgm_lc1_ndb             
 parts.partition_mgm_lc2_ndb              # joro : NDB tests marked as experimental as agreed with bochklin
 parts.partition_syntax_ndb               # joro : NDB tests marked as experimental as agreed with bochklin
 parts.partition_value_ndb                # joro : NDB tests marked as experimental as agreed with bochklin
+main.mysqlhotcopy_myisam                 # horst: due to bug#54129
+main.mysqlhotcopy_archive                # horst: due to bug#54129

=== added file 'mysql-test/include/mysqlhotcopy.inc'
--- a/mysql-test/include/mysqlhotcopy.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/mysqlhotcopy.inc	2010-06-04 08:53:18 +0000
@@ -0,0 +1,121 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+--source include/not_windows.inc
+--source include/not_embedded.inc
+
+if ($MYSQLHOTCOPY)
+{
+  die due to missing mysqlhotcopy tool;
+}
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--disable_warnings
+DROP DATABASE IF EXISTS hotcopy_test;
+--enable_warnings
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+eval CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=$engine;
+eval CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=$engine;
+eval CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=$engine;
+
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test
+
+# backup into another database in the same directory
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+USE hotcopy_save;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# restore data into the original database with mysqlhotcopy
+if(`SELECT engine= 'MyISAM' FROM information_schema.tables WHERE table_name='t1'`)
+{
+USE hotcopy_test;
+DELETE FROM t1;
+SELECT * FROM t1;
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
+
+USE hotcopy_save;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+}
+
+USE hotcopy_test;
+DROP TABLE t2;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
+
+FLUSH TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# backup of db into a directory
+USE hotcopy_test;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test $MYSQLTEST_VARDIR/tmp
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--list_files $MYSQLTEST_VARDIR/tmp/hotcopy_test
+#--exec rm -rf $MYSQLTEST_VARDIR/tmp/hotcopy_test
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/hotcopy_test *
+--rmdir $MYSQLTEST_VARDIR/tmp/hotcopy_test
+
+# backup without full index files
+# reproduction of bug#53556, "--list_files" shows MYI files, which is wrong.
+DROP DATABASE hotcopy_save;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --noindices -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "allowold"
+DROP DATABASE hotcopy_save;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--error 9,2304
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "keepold"
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --keepold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save_old
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "suffix"
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --suffix=_cpy -S $MASTER_MYSOCK -u root hotcopy_test
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test_cpy
+DROP DATABASE hotcopy_test_cpy;
+
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
+

=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl	2009-11-24 08:12:48 +0000
+++ b/mysql-test/lib/mtr_misc.pl	2010-06-03 08:31:26 +0000
@@ -149,6 +149,28 @@ sub mtr_exe_maybe_exists (@) {
 
 #
 # NOTE! More specific paths should be given before less specific.
+#
+sub mtr_pl_maybe_exists (@) {
+  my @path= @_;
+
+  map {$_.= ".pl"} @path if IS_WINDOWS;
+  foreach my $path ( @path )
+  {
+    if(IS_WINDOWS)
+    {
+      return $path if -f $path;
+    }
+    else
+    {
+      return $path if -x $path;
+    }
+  }
+  return "";
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
 # For example /client/debug should be listed before /client
 #
 sub mtr_exe_exists (@) {

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-05-24 18:57:25 +0000
+++ b/mysql-test/mysql-test-run.pl	2010-06-04 16:09:50 +0000
@@ -2111,6 +2111,15 @@ sub environment_setup {
                         "$basedir/myisam/myisampack"));
 
   # ----------------------------------------------------
+  # mysqlhotcopy
+  # ----------------------------------------------------
+  my $mysqlhotcopy=
+    mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy");
+  # Since mysqltest interprets the real path as "false" in an if,
+  # use 1 ("true") to indicate "not exists" so it can be tested for
+  $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1;
+
+  # ----------------------------------------------------
   # perror
   # ----------------------------------------------------
   my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),

=== added file 'mysql-test/r/mysqlhotcopy_archive.result'
--- a/mysql-test/r/mysqlhotcopy_archive.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysqlhotcopy_archive.result	2010-06-03 08:31:26 +0000
@@ -0,0 +1,118 @@
+DROP DATABASE IF EXISTS hotcopy_test;
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=archive;
+CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=archive;
+CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=archive;
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning	1265	Data truncated for column 'c2' at row 2
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+USE hotcopy_save;
+SELECT * FROM t1;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DROP TABLE t2;
+db.opt
+t1.ARZ
+t1.frm
+t3.ARZ
+t3.frm
+FLUSH TABLES;
+SELECT * FROM t1;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_test_cpy;
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;

=== added file 'mysql-test/r/mysqlhotcopy_myisam.result'
--- a/mysql-test/r/mysqlhotcopy_myisam.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysqlhotcopy_myisam.result	2010-06-03 08:31:26 +0000
@@ -0,0 +1,164 @@
+DROP DATABASE IF EXISTS hotcopy_test;
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning	1265	Data truncated for column 'c2' at row 2
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+USE hotcopy_save;
+SELECT * FROM t1;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DELETE FROM t1;
+SELECT * FROM t1;
+c1	c2
+USE hotcopy_save;
+SELECT * FROM t1;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DROP TABLE t2;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t3.MYD
+t3.MYI
+t3.frm
+FLUSH TABLES;
+SELECT * FROM t1;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1	c2
+1	aaaaaaaaaaaaaaaaaaaa
+2	bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_test_cpy;
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2010-04-27 09:58:21 +0000
+++ b/mysql-test/r/variables.result	2010-06-04 16:09:50 +0000
@@ -1026,6 +1026,13 @@ hostname	#
 # Test 'myisam_mmap_size' option is not dynamic
 SET @@myisam_mmap_size= 500M;
 ERROR HY000: Variable 'myisam_mmap_size' is a read only variable
+#
+# Bug #52315: utc_date() crashes when system time > year 2037
+#
+SET TIMESTAMP=2*1024*1024*1024;
+#Should not crash
+SELECT UTC_DATE();
+SET TIMESTAMP=DEFAULT;
 End of 5.0 tests
 set join_buffer_size=1;
 Warnings:

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2010-05-31 09:18:27 +0000
+++ b/mysql-test/t/disabled.def	2010-06-04 16:09:50 +0000
@@ -14,3 +14,6 @@ query_cache_28249        : Bug#43861 200
 innodb-autoinc           : Bug#49267 2009-12-02 test fails on windows because of different case mode
 innodb                   : Bug#49396 2009-12-03 test fails in embedded mode
 plugin_load              : Bug#42144 2009-12-21 alik plugin_load fails
+partition_innodb_plugin  : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+main.mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst
+main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst

=== added file 'mysql-test/t/mysqlhotcopy_archive.test'
--- a/mysql-test/t/mysqlhotcopy_archive.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysqlhotcopy_archive.test	2010-06-03 08:31:26 +0000
@@ -0,0 +1,8 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+--source include/have_archive.inc
+let $engine= archive;
+--source include/mysqlhotcopy.inc
+--exit

=== added file 'mysql-test/t/mysqlhotcopy_myisam.test'
--- a/mysql-test/t/mysqlhotcopy_myisam.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysqlhotcopy_myisam.test	2010-06-03 08:31:26 +0000
@@ -0,0 +1,7 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+let $engine= MyISAM;
+--source include/mysqlhotcopy.inc
+--exit

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2010-04-03 17:35:51 +0000
+++ b/mysql-test/t/variables.test	2010-06-04 16:09:50 +0000
@@ -773,6 +773,21 @@ show variables like 'hostname';
 --echo # Test 'myisam_mmap_size' option is not dynamic
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@myisam_mmap_size= 500M;
+
+
+--echo #
+--echo # Bug #52315: utc_date() crashes when system time > year 2037
+--echo #
+
+--error 0, ER_UNKNOWN_ERROR
+SET TIMESTAMP=2*1024*1024*1024;
+--echo #Should not crash
+--disable_result_log
+SELECT UTC_DATE();
+--enable_result_log
+SET TIMESTAMP=DEFAULT;
+
+
 --echo End of 5.0 tests
 
 #

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-06-02 10:01:26 +0000
+++ b/sql/mysqld.cc	2010-06-04 16:09:50 +0000
@@ -3362,6 +3362,13 @@ static int init_common_variables()
 
   max_system_variables.pseudo_thread_id= (ulong)~0;
   server_start_time= flush_status_time= my_time(0);
+  /* TODO: remove this when my_time_t is 64 bit compatible */
+  if (server_start_time >= (time_t) MY_TIME_T_MAX)
+  {
+    sql_print_error("This MySQL server doesn't support dates later then 2038");
+    return 1;
+  }
+
   rpl_filter= new Rpl_filter;
   binlog_filter= new Rpl_filter;
   if (!rpl_filter || !binlog_filter)

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-05-23 20:41:18 +0000
+++ b/sql/sql_class.h	2010-06-04 16:09:50 +0000
@@ -2358,6 +2358,11 @@ public:
     start_time= user_time= t;
     start_utime= utime_after_lock= my_micro_time();
   }
+  /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
+  inline bool	is_valid_time() 
+  { 
+    return (start_time < (time_t) MY_TIME_T_MAX); 
+  }
   void set_time_after_lock()  { utime_after_lock= my_micro_time(); }
   ulonglong current_utime()  { return my_micro_time(); }
   inline ulonglong found_rows(void)

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-06-01 12:31:37 +0000
+++ b/sql/sql_parse.cc	2010-06-04 16:09:50 +0000
@@ -887,6 +887,18 @@ bool dispatch_command(enum enum_server_c
   thd->enable_slow_log= TRUE;
   thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
   thd->set_time();
+  if (!thd->is_valid_time())
+  {
+    /*
+     If the time has got past 2038 we need to shut this server down
+     We do this by making sure every command is a shutdown and we 
+     have enough privileges to shut the server down
+
+     TODO: remove this when we have full 64 bit my_time_t support
+    */
+    thd->security_ctx->master_access|= SHUTDOWN_ACL;
+    command= COM_SHUTDOWN;
+  }
   thd->set_query_id(get_query_id());
   if (!(server_command_flags[command] & CF_SKIP_QUERY_ID))
     next_query_id();

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-04-27 09:58:21 +0000
+++ b/sql/sys_vars.cc	2010-06-04 16:09:50 +0000
@@ -2321,6 +2321,28 @@ static ulonglong read_timestamp(THD *thd
 {
   return (ulonglong) thd->start_time;
 }
+
+
+static bool check_timestamp(sys_var *self, THD *thd, set_var *var)
+{
+  time_t val;
+
+  if (!var->value)
+    return FALSE;
+
+  var->save_result.ulonglong_value= var->value->val_int();
+  val= (time_t) var->save_result.ulonglong_value;
+  if (val < (time_t) MY_TIME_T_MIN || val > (time_t) MY_TIME_T_MAX)
+  {
+    my_message(ER_UNKNOWN_ERROR, 
+               "This version of MySQL doesn't support dates later than 2038",
+               MYF(0));
+    return TRUE;
+  }
+  return FALSE;
+}
+
+
 static Sys_var_session_special Sys_timestamp(
        "timestamp", "Set the time for this client",
        sys_var::ONLY_SESSION, NO_CMD_LINE,


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100604160950-usx33mwczmow3i5e.bundle
Thread
bzr commit into mysql-trunk branch (Georgi.Kodinov:3045) Georgi Kodinov4 Jun