List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:December 5 2008 12:02pm
Subject:bzr commit into mysql-6.0-bugteam branch (bar:2753)
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-6.0-b40805/

 2753 Alexander Barkov	2008-12-05 [merge]
      Merge from mysql-6.0-bugteam
added:
  mysql-test/r/ctype_filesystem.result
  mysql-test/suite/falcon/t/falcon_bug_22184-master.opt
  mysql-test/suite/sys_vars/t/disabled.def
  mysql-test/t/ctype_filesystem-master.opt
  mysql-test/t/ctype_filesystem.test
modified:
  client/mysql.cc
  dbug/dbug.c
  extra/yassl/src/yassl_imp.cpp
  include/my_dbug.h
  libmysql/libmysql.c
  libmysql/libmysql.def
  libmysqld/examples/CMakeLists.txt
  libmysqld/lib_sql.cc
  libmysqld/libmysqld.def
  mysql-test/r/perror-win.result
  mysql-test/r/subselect.result
  mysql-test/r/timezone2.result
  mysql-test/r/timezone3.result
  mysql-test/r/update.result
  mysql-test/r/variables.result
  mysql-test/r/view.result
  mysql-test/std_data/Moscow_leap
  mysql-test/suite/falcon/r/falcon_bug_22184.result
  mysql-test/suite/falcon/t/falcon_bug_22184.test
  mysql-test/t/disabled.def
  mysql-test/t/perror-win.test
  mysql-test/t/perror.test
  mysql-test/t/subselect.test
  mysql-test/t/timezone3.test
  mysql-test/t/update.test
  mysql-test/t/variables.test
  mysql-test/t/view.test
  mysys/my_thr_init.c
  sql/item_func.cc
  sql/mysql_priv.h
  sql/mysqld.cc
  sql/set_var.cc
  sql/set_var.h
  sql/slave.cc
  sql/sql_manager.cc
  sql/sql_show.cc
  sql/sql_update.cc
  sql/sql_view.cc
  sql/tztime.cc
  sql/tztime.h

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2008-10-20 09:16:47 +0000
+++ b/client/mysql.cc	2008-12-05 01:05:05 +0000
@@ -1658,8 +1658,10 @@ get_one_option(int optid, const struct m
     opt_nopager= 1;
     break;
   case OPT_MYSQL_PROTOCOL:
+#ifndef EMBEDDED_LIBRARY
     opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
                                     opt->name);
+#endif
     break;
   case OPT_SERVER_ARG:
 #ifdef EMBEDDED_LIBRARY

=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c	2008-11-19 10:13:17 +0000
+++ b/dbug/dbug.c	2008-12-05 01:05:05 +0000
@@ -2569,13 +2569,4 @@ int i_am_a_dummy_function() {
        return 0;
 }
 
-#ifdef __WIN__
-char _db_doprnt_;
-char _db_enter_;
-char _db_pargs_;
-char _db_process_;
-char _db_push_;
-char _db_return_;
-#endif /*__WIN__*/
-
 #endif

=== modified file 'extra/yassl/src/yassl_imp.cpp'
--- a/extra/yassl/src/yassl_imp.cpp	2008-11-18 21:17:04 +0000
+++ b/extra/yassl/src/yassl_imp.cpp	2008-12-02 11:25:43 +0000
@@ -1560,6 +1560,7 @@ void ClientHello::Process(input_buffer&,
         return;
     }
     ssl.matchSuite(cipher_suites_, suite_len_);
+    if (ssl.GetError()) return;
     ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]);
 
     if (compression_methods_ == zlib)

=== modified file 'include/my_dbug.h'
--- a/include/my_dbug.h	2008-11-19 10:13:17 +0000
+++ b/include/my_dbug.h	2008-12-05 01:05:05 +0000
@@ -133,21 +133,6 @@ extern  void _db_flush_();
 #define IF_DBUG(A)
 #define DBUG_ABORT()                    abort()
 
-#ifdef __WIN__
-/*
-   On windows all the dll export has to be declared in the *.def file
-   so as we export these symbols in DEBUG mode we have to export
-   these in the RELEASE mode also. So below are the dummy symbols
-   for the RELEASE export
-*/
-extern  char _db_doprnt_;
-extern  char _db_enter_;
-extern  char _db_pargs_;
-extern  char _db_process_;
-extern  char _db_push_;
-extern  char _db_return_;
-#endif /*__WIN__*/
-
 #endif
 #ifdef  __cplusplus
 }

=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c	2008-10-22 11:51:28 +0000
+++ b/libmysql/libmysql.c	2008-12-05 01:05:05 +0000
@@ -207,9 +207,7 @@ void STDCALL mysql_server_end()
   /* If library called my_init(), free memory allocated by it */
   if (!org_my_init_done)
   {
-    my_end(MY_DONT_FREE_DBUG);
-    /* Remove TRACING, if enabled by mysql_debug() */
-    DBUG_POP();
+    my_end(0);
   }
   else
   {

=== modified file 'libmysql/libmysql.def'
--- a/libmysql/libmysql.def	2008-08-11 10:03:45 +0000
+++ b/libmysql/libmysql.def	2008-12-05 01:05:05 +0000
@@ -1,33 +1,7 @@
 LIBRARY		LIBMYSQL
 VERSION		6.0
 EXPORTS
-	_dig_vec_lower
-	_dig_vec_upper
-	bmove_upp
-	delete_dynamic
-	free_defaults
-	getopt_compare_strings
-	getopt_ull_limit_value
-	handle_options
-	init_dynamic_array
-	insert_dynamic
-	int2str
-	is_prefix
-	list_add
-	list_delete
-	load_defaults
-	my_end
-	my_getopt_print_errors
-	my_init
-	my_malloc
-	my_memdup
-	my_no_flags_free
-	my_path
 	mysql_get_parameters
-	my_print_help
-	my_print_variables
-	my_realloc
-	my_strdup
 	mysql_thread_end
 	mysql_thread_init
 	myodbc_remove_escape
@@ -117,22 +91,12 @@ EXPORTS
 	mysql_stmt_sqlstate
 	mysql_sqlstate
 	mysql_get_server_version
-	set_dynamic
-	strcend
-	strcont
-	strdup_root
-	strfill
-	strinstr
-	strmake
-	strmov
-	strxmov
 	mysql_stmt_prepare
 	mysql_stmt_init
 	mysql_stmt_insert_id
 	mysql_stmt_attr_get
 	mysql_stmt_attr_set
 	mysql_stmt_field_count
-	client_errors
 	mysql_set_local_infile_default
 	mysql_set_local_infile_handler
 	mysql_embedded
@@ -140,6 +104,4 @@ EXPORTS
 	mysql_server_end
 	mysql_set_character_set
 	mysql_get_character_set_info
-	get_defaults_options
-	modify_defaults_file
-        mysql_stmt_next_result
+	mysql_stmt_next_result

=== modified file 'libmysqld/examples/CMakeLists.txt'
--- a/libmysqld/examples/CMakeLists.txt	2008-11-19 12:11:30 +0000
+++ b/libmysqld/examples/CMakeLists.txt	2008-12-05 01:05:05 +0000
@@ -24,18 +24,18 @@ IF(WIN32)
   ADD_DEFINITIONS(-DUSE_TLS)
 ENDIF(WIN32)
 
-ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
+ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -DMY_USE_CLIENT_DLL)
 
 ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
                ../../client/mysql.cc ../../client/readline.cc
                ../../client/sql_string.cc)
-TARGET_LINK_LIBRARIES(mysql_embedded ws2_32)
+TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
 ADD_DEPENDENCIES(mysql_embedded libmysqld)
 
 ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
-TARGET_LINK_LIBRARIES(mysqltest_embedded ws2_32)
+TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
 ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
 
 ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
-TARGET_LINK_LIBRARIES(mysql_client_test_embedded ws2_32)
+TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
 ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld)

=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2008-11-17 16:13:20 +0000
+++ b/libmysqld/lib_sql.cc	2008-12-05 01:05:05 +0000
@@ -385,6 +385,7 @@ static void emb_free_embedded_thd(MYSQL 
   thd->store_globals();
   thd->unlink();
   delete thd;
+  my_pthread_setspecific_ptr(THR_THD,  0);
   mysql->thd=0;
 }
 
@@ -539,12 +540,7 @@ int init_embedded_server(int argc, char 
 
   (void) thr_setconcurrency(concurrency);	// 10 by default
 
-  if (flush_time && flush_time != ~(ulong) 0L)
-  {
-    pthread_t hThread;
-    if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
-      sql_print_error("Warning: Can't create thread to manage maintenance");
-  }
+  start_handle_manager();
 
   // FIXME initialize binlog_filter and rpl_filter if not already done
   //       corresponding delete is in clean_up()

=== modified file 'libmysqld/libmysqld.def'
--- a/libmysqld/libmysqld.def	2008-11-26 11:54:39 +0000
+++ b/libmysqld/libmysqld.def	2008-12-05 01:05:05 +0000
@@ -1,96 +1,6 @@
 LIBRARY		LIBMYSQLD
 VERSION		5.1
 EXPORTS
-	_db_process_
-	_db_enter_
-	_db_return_
-	_db_push_
-	_db_doprnt_
-	_db_pargs_
-	strnmov
-	get_charset
-	my_memmem
-	my_snprintf
-	pthread_exit
-	pthread_cond_signal
-	dynstr_append_mem
-	init_dynamic_string
-	dynstr_free
-	my_hash_free
-	my_vsnprintf
-	dynstr_append
-	my_close
-	my_open
-	dynstr_set
-	dynstr_append_os_quoted
-	my_delete
-	my_seek
-	my_write
-	create_temp_file
-	fn_format
-	dirname_part
-	my_hash_insert
-	my_hash_search
-	test_if_hard_path
-	my_copy
-	my_mkdir
-	my_sleep
-	my_strtod
-	pthread_cond_wait
-	my_strnncoll_simple
-	get_dynamic
-	my_regerror
-	init_dynamic_array2
-	pthread_create
-	pthread_cond_init
-	ll2str
-	my_fileno
-	my_gcvt
-	my_regcomp
-	my_regexec
-	my_regex_end
-	my_regfree
-	my_set_exception_pointers
-	my_print_stacktrace
-	my_thread_stack_size
-	my_safe_print_str
-	my_stat
-	_my_hash_init
-	pthread_attr_setstacksize
-	pthread_attr_init
-	my_dirend
-	wild_compare
-	my_dir
-	my_micro_time
-	find_type_or_exit
-	_dig_vec_upper
-	_dig_vec_lower
-	bmove_upp
-	delete_dynamic
-	free_defaults
-	getopt_compare_strings
-	getopt_ull_limit_value
-	handle_options
-	init_dynamic_array
-	insert_dynamic
-	int2str
-	is_prefix
-	list_add
-	list_delete
-	load_defaults
-	max_allowed_packet
-	my_cgets
-	my_end
-	my_getopt_print_errors
-	my_init
-	my_malloc
-	my_memdup
-	my_no_flags_free
-	my_path
-	my_print_help
-	my_print_variables
-	my_realloc
-	my_strdup
 	mysql_thread_end
 	mysql_thread_init
 	myodbc_remove_escape
@@ -159,47 +69,13 @@ EXPORTS
 	mysql_thread_safe
 	mysql_use_result
 	mysql_warning_count
-	set_dynamic
-	strcend
-	strcont
-	strdup_root
-	strfill
-	strinstr
-	strmake
-	strmov
-	strxmov
 	mysql_server_end
 	mysql_server_init
 	get_tty_password
-	sql_protocol_typelib
 	mysql_get_server_version
 	mysql_set_character_set
 	mysql_sqlstate
-	charsets_dir
-	disabled_my_option
-	my_charset_latin1
-	init_alloc_root
-	my_progname
-	get_charset_name
-	get_charset_by_csname
-	print_defaults
-	find_type
-	strxnmov
-	strend
-	my_fopen
-	my_fclose
-	unpack_filename
-	str2int
-	int10_to_str
-	longlong10_to_str
-	my_snprintf_8bit
-	alloc_root
-	free_root
-	my_read
-	llstr
 	mysql_get_parameters
-	mysql_thread_init
-	mysql_thread_end
 	mysql_stmt_bind_param
 	mysql_stmt_bind_result
 	mysql_stmt_execute
@@ -227,8 +103,4 @@ EXPORTS
 	mysql_stmt_attr_get
 	mysql_stmt_attr_set
 	mysql_stmt_field_count
-	get_defaults_options
-	my_charset_bin
-	my_charset_same
-	modify_defaults_file
-        mysql_stmt_next_result
+	mysql_stmt_next_result

=== added file 'mysql-test/r/ctype_filesystem.result'
--- a/mysql-test/r/ctype_filesystem.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/ctype_filesystem.result	2008-12-01 11:34:53 +0000
@@ -0,0 +1,11 @@
+SET CHARACTER SET utf8;
+SHOW VARIABLES like 'character_sets_dir';
+Variable_name	Value
+character_sets_dir	MYSQL_TEST_DIR/ß/
+SHOW VARIABLES like 'character_set_filesystem';
+Variable_name	Value
+character_set_filesystem	latin1
+SHOW VARIABLES like 'character_set_client';
+Variable_name	Value
+character_set_client	utf8
+SET CHARACTER SET default;

=== modified file 'mysql-test/r/perror-win.result'
--- a/mysql-test/r/perror-win.result	2008-11-27 12:33:40 +0000
+++ b/mysql-test/r/perror-win.result	2008-12-01 19:51:01 +0000
@@ -1,5 +1,7 @@
 MySQL error code 150: Foreign key constraint is incorrectly formed
-Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
+Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
 OS error code  23:  Too many open files in system
-Win32 error code 23: Data error (cyclic redundancy check).
-Win32 error code 15000: The specified channel path is invalid.
+Win32 error code 23: Data error (cyclic redundancy check).
+MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
+Win32 error code 1062: The service has not been started.
+Illegal error code: 30000

=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result	2008-11-27 14:25:02 +0000
+++ b/mysql-test/r/subselect.result	2008-11-28 11:40:40 +0000
@@ -4659,36 +4659,6 @@ SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.
 a	incorrect
 1	1
 DROP TABLE t1,t2,t3;
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int, c int);
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-CREATE VIEW v1 AS
-SELECT t2.c AS c FROM t1, t2
-WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-UPDATE v1 SET c=1;
-CREATE VIEW v2 (a,b) AS
-SELECT t2.id, t2.c AS c FROM t1, t2
-WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
-INSERT INTO v2(a,b) VALUES (1,2);
-SELECT * FROM v1;
-c
-1
-1
-1
-1
-2
-2
-CREATE VIEW v3 AS
-SELECT t2.c AS c FROM t2
-WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-DELETE FROM v3;
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2;
 End of 5.1 tests.
 CREATE TABLE t1( a INT );
 INSERT INTO t1 VALUES (1),(2);

=== modified file 'mysql-test/r/timezone2.result'
--- a/mysql-test/r/timezone2.result	2007-03-09 10:12:31 +0000
+++ b/mysql-test/r/timezone2.result	2008-12-01 15:43:51 +0000
@@ -110,7 +110,7 @@ i	ts
 362793610	1981-07-01 04:00:00
 select from_unixtime(362793609);
 from_unixtime(362793609)
-1981-07-01 03:59:60
+1981-07-01 03:59:59
 drop table t1;
 create table t1 (ts timestamp);
 set time_zone='UTC';

=== modified file 'mysql-test/r/timezone3.result'
--- a/mysql-test/r/timezone3.result	2004-11-12 15:44:17 +0000
+++ b/mysql-test/r/timezone3.result	2008-12-01 14:18:35 +0000
@@ -17,6 +17,9 @@ insert into t1 values
 insert into t1 values
 (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
 (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+insert into t1 values
+(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
+(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
 select i, from_unixtime(i), c from t1;
 i	from_unixtime(i)	c
 1072904422	2004-01-01 00:00:00	2004-01-01 00:00:00
@@ -31,6 +34,8 @@ i	from_unixtime(i)	c
 1099180821	2004-10-31 02:59:59	2004-10-31 02:59:59
 362793608	1981-07-01 03:59:59	1981-07-01 03:59:59
 362793610	1981-07-01 04:00:00	1981-07-01 04:00:00
+1230768022	2009-01-01 02:59:59	2009-01-01 02:59:59
+1230768024	2009-01-01 03:00:00	2009-01-01 03:00:00
 drop table t1;
 create table t1 (ts timestamp);
 insert into t1 values (19730101235900), (20040101235900);
@@ -39,3 +44,6 @@ ts
 1973-01-01 23:59:00
 2004-01-01 23:59:00
 drop table t1;
+SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
+FROM_UNIXTIME(1230768022)	FROM_UNIXTIME(1230768023)	FROM_UNIXTIME(1230768024)
+2009-01-01 02:59:59	2009-01-01 02:59:59	2009-01-01 03:00:00

=== modified file 'mysql-test/r/update.result'
--- a/mysql-test/r/update.result	2007-04-27 08:42:15 +0000
+++ b/mysql-test/r/update.result	2008-11-28 16:36:07 +0000
@@ -491,4 +491,15 @@ update t1 join t2 on (t1.a=t2.a) set t1.
 affected rows: 127
 info: Rows matched: 128  Changed: 127  Warnings: 0
 drop table t1,t2;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INT RETURN f1();
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i = 3 WHERE f1();
+ERROR HY000: Recursive stored functions and triggers are not allowed.
+UPDATE t1 SET i = f1();
+ERROR HY000: Recursive stored functions and triggers are not allowed.
+DROP TABLE t1;
+DROP FUNCTION f1;
 End of 5.0 tests

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2008-11-24 20:46:11 +0000
+++ b/mysql-test/r/variables.result	2008-11-27 11:01:59 +0000
@@ -1325,19 +1325,6 @@ ERROR HY000: Variable 'skip_show_databas
 SET @@global.skip_show_database= true;
 ERROR HY000: Variable 'skip_show_database' is a read only variable
 #
-SHOW VARIABLES like 'socket';
-Variable_name	Value
-socket	#
-SELECT @@session.socket;
-ERROR HY000: Variable 'socket' is a GLOBAL variable
-SELECT @@global.socket;
-@@global.socket
-#
-SET @@session.socket= 'x';
-ERROR HY000: Variable 'socket' is a read only variable
-SET @@global.socket= 'x';
-ERROR HY000: Variable 'socket' is a read only variable
-#
 SHOW VARIABLES like 'thread_stack';
 Variable_name	Value
 thread_stack	#

=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2008-10-29 13:55:04 +0000
+++ b/mysql-test/r/view.result	2008-11-28 17:51:47 +0000
@@ -625,7 +625,7 @@ drop table t1;
 create table t1 (a int, b int);
 create view v1 as select a, sum(b) from t1 group by a;
 select b from v1 use index (some_index) where b=1;
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'some_index' doesn't exist in table 'v1'
 drop view v1;
 drop table t1;
 create table t1 (col1 char(5),col2 char(5));
@@ -3563,11 +3563,11 @@ CREATE TABLE t1 (a INT);
 INSERT INTO t1 VALUES (1),(2);
 CREATE VIEW v1 AS SELECT * FROM t1;
 SELECT * FROM v1 USE KEY(non_existant);
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
 SELECT * FROM v1 FORCE KEY(non_existant);
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
 SELECT * FROM v1 IGNORE KEY(non_existant);
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
 DROP VIEW v1;
 DROP TABLE t1;
 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
@@ -3675,6 +3675,31 @@ DROP VIEW v1;
 
 CREATE VIEW v1 AS SELECT 1;
 DROP VIEW v1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+c1	c2
+2	2
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+c1	c2
+2	2
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_Comment
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+ERROR 42000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+ERROR 42000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+ERROR 42000: Key 'c2' doesn't exist in table 'v1'
+DROP VIEW v1;
+DROP TABLE t1;
 # -----------------------------------------------------------------
 # -- End of 5.0 tests.
 # -----------------------------------------------------------------
@@ -3809,3 +3834,33 @@ create view v_9801 as
 select sum(s1) from t_9801 group by s1 with rollup with check option;
 ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801'
 drop table t_9801;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+CREATE VIEW v1 AS
+SELECT t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+CREATE VIEW v2 (a,b) AS
+SELECT t2.id, t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+INSERT INTO v2(a,b) VALUES (2,2);
+ERROR HY000: CHECK OPTION failed 'test.v2'
+INSERT INTO v2(a,b) VALUES (1,2);
+SELECT * FROM v1;
+c
+1
+1
+1
+1
+2
+2
+CREATE VIEW v3 AS
+SELECT t2.c AS c FROM t2
+WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+DELETE FROM v3;
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;

=== modified file 'mysql-test/std_data/Moscow_leap'
Binary files a/mysql-test/std_data/Moscow_leap	2004-11-03 17:59:03 +0000 and b/mysql-test/std_data/Moscow_leap	2008-12-01 14:18:35 +0000 differ

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_22184.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_22184.result	2007-09-20 15:44:25 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_22184.result	2008-12-01 14:29:45 +0000
@@ -1,7 +1,6 @@
 SET STORAGE_ENGINE = Falcon;
 *** Bug #22184 ***
 DROP TABLE IF EXISTS t6;
-SET @@max_allowed_packet = 20000000;
 CREATE TABLE t6 (s1 longblob);
 INSERT INTO t6 VALUES (repeat('a',2100000));
 INSERT INTO t6 VALUES (repeat('a',2200000));

=== added file 'mysql-test/suite/falcon/t/falcon_bug_22184-master.opt'
--- a/mysql-test/suite/falcon/t/falcon_bug_22184-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22184-master.opt	2008-12-01 14:29:45 +0000
@@ -0,0 +1 @@
+--max_allowed_packet=20000000

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_22184.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_22184.test	2007-09-29 04:30:42 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22184.test	2008-12-01 14:29:45 +0000
@@ -8,7 +8,6 @@ SET STORAGE_ENGINE = Falcon;
 DROP TABLE IF EXISTS t6;
 --enable_warnings
 
-SET @@max_allowed_packet = 20000000;
 CREATE TABLE t6 (s1 longblob);
 INSERT INTO t6 VALUES (repeat('a',2100000));
 INSERT INTO t6 VALUES (repeat('a',2200000));

=== added file 'mysql-test/suite/sys_vars/t/disabled.def'
--- a/mysql-test/suite/sys_vars/t/disabled.def	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/disabled.def	2008-11-26 15:16:58 +0000
@@ -0,0 +1,21 @@
+##############################################################################
+#
+#  List the test cases that are to be disabled temporarily.
+#
+#  Separate the test case name and the comment with ':'.
+#
+#    <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+#  Do not use any TAB characters for whitespace.
+#
+##############################################################################
+key_buffer_size_basic_64    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
+rpl_recovery_rank_basic_64  : Bug #36522: Some tests of system variables have diffs on 64bit platorms
+sort_buffer_size_basic_64   : Bug #36522: Some tests of system variables have diffs on 64bit platorms
+query_cache_size_basic_32   : Bug#36747: Allocating a large query cache is not deterministic
+query_cache_size_basic_64   : Bug#36747: Allocating a large query cache is not deterministic
+query_alloc_block_size_basic_64:  Bug #37708 query_alloc_block_size_basic_64 fails in pushbuild
+sort_buffer_size_basic_32   : Bug#36875 main.sort_buffer_size_basic_32 fails on some systems
+key_buffer_size_basic_32    : Bug#36876 main.key_buffer_size_basic_32 fails on some systems
+max_heap_table_size_basic_32 : Bug#36877 main.max_heap_table_size_basic_32 fails on some systems
+tmp_table_size_basic_32     : Bug#36878 main.tmp_table_size_basic_32 fails on some systems

=== added file 'mysql-test/t/ctype_filesystem-master.opt'
--- a/mysql-test/t/ctype_filesystem-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/ctype_filesystem-master.opt	2008-12-01 11:34:53 +0000
@@ -0,0 +1,2 @@
+--character-sets-dir=$MYSQL_TEST_DIR/�+--character-set-filesystem=latin1

=== added file 'mysql-test/t/ctype_filesystem.test'
--- a/mysql-test/t/ctype_filesystem.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/ctype_filesystem.test	2008-12-01 11:34:53 +0000
@@ -0,0 +1,6 @@
+SET CHARACTER SET utf8;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+SHOW VARIABLES like 'character_sets_dir';
+SHOW VARIABLES like 'character_set_filesystem';
+SHOW VARIABLES like 'character_set_client';
+SET CHARACTER SET default;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2008-11-26 21:44:57 +0000
+++ b/mysql-test/t/disabled.def	2008-12-05 11:27:19 +0000
@@ -12,13 +12,14 @@
 innodb          : WL#1213: Waiting for InnoDB team to add support for 4-byte character sets.
 federated_transactions   : Bug#29523 Transactions do not work
 lowercase_table3         : Bug#32667 lowercase_table3.test reports to error log
-rpl_log_pos          : Bug#8693 Test 'rpl_log_pos' fails sometimes
 ctype_create         : Bug#32965 main.ctype_create fails
 backup_no_engine     : Bug#36021 2008-04-13 rsomla server crashes when openning table with unknown storage engine
 query_cache_wlock_invalidate_func: Bug#35390 causes not deterministic results.
+csv_alter_table      : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
 cast                 : Bug#35594 2008-03-27 main.cast fails on Windows2003-64
 backup_triggers_and_events  : Bug#37762 2008-07-01 rafal Test fails on remove_file for unknown reasons
 backup_no_be                : Bug#38023 2008-07-16 rafal Test triggers valgrind warnings described in the bug
 thread_cache_size_func      : Bug#40575 2008-11-07 joro main.thread_cache_size_func fails in pushbuild when run with pool of threads
 log_output_basic     : Bug #40988  	log_output_basic.test succeeded though syntactically false.
+wait_timeout_func    : Bug #41225 joro wait_timeout_func fails
 

=== modified file 'mysql-test/t/perror-win.test'
--- a/mysql-test/t/perror-win.test	2008-11-27 12:33:40 +0000
+++ b/mysql-test/t/perror-win.test	2008-11-28 13:12:43 +0000
@@ -6,6 +6,9 @@ eval select LENGTH("$MY_PERROR") > 0 as 
 enable_query_log;
 
 
---exec $MY_PERROR 150
---exec $MY_PERROR 23
---exec $MY_PERROR 15000
+--exec $MY_PERROR 150 2>&1
+--exec $MY_PERROR 23 2>&1
+--exec $MY_PERROR 1062 2>&1
+--error 1
+--exec $MY_PERROR 30000 2>&1
+

=== modified file 'mysql-test/t/perror.test'
--- a/mysql-test/t/perror.test	2008-08-05 23:26:18 +0000
+++ b/mysql-test/t/perror.test	2008-11-28 11:40:40 +0000
@@ -1,3 +1,4 @@
+--source include/not_windows.inc
 #
 # Check if the variable MY_PERROR is set
 #

=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test	2008-11-27 14:25:02 +0000
+++ b/mysql-test/t/subselect.test	2008-11-28 11:40:40 +0000
@@ -3495,41 +3495,6 @@ SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.
 
 DROP TABLE t1,t2,t3;
 
-#
-# Bug#37460 Assertion failed:
-# !table->file || table->file->inited == handler::NONE
-#
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int, c int);
-
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-
-CREATE VIEW v1 AS
-  SELECT t2.c AS c FROM t1, t2
-    WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-UPDATE v1 SET c=1;
-
-CREATE VIEW v2 (a,b) AS
-  SELECT t2.id, t2.c AS c FROM t1, t2
-    WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-
---error 1369
-INSERT INTO v2(a,b) VALUES (2,2);
-INSERT INTO v2(a,b) VALUES (1,2);
-SELECT * FROM v1;
-
-CREATE VIEW v3 AS
-  SELECT t2.c AS c FROM t2
-    WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-
-DELETE FROM v3;
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2;
-
 --echo End of 5.1 tests.
 
 

=== modified file 'mysql-test/t/timezone3.test'
--- a/mysql-test/t/timezone3.test	2005-07-28 00:22:47 +0000
+++ b/mysql-test/t/timezone3.test	2008-12-01 14:18:35 +0000
@@ -45,6 +45,10 @@ insert into t1 values
   (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
   (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
 
+insert into t1 values
+  (unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
+  (unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
+
 select i, from_unixtime(i), c from t1;
 drop table t1;
 
@@ -58,4 +62,12 @@ insert into t1 values (19730101235900), 
 select * from t1;
 drop table t1;
 
+#
+# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
+# literal
+#
+
+# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
+SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
+
 # End of 4.1 tests

=== modified file 'mysql-test/t/update.test'
--- a/mysql-test/t/update.test	2007-04-23 14:22:33 +0000
+++ b/mysql-test/t/update.test	2008-11-28 16:36:07 +0000
@@ -430,4 +430,25 @@ drop table t1,t2;
 connection default;
 disconnect con1;
 
+#
+# Bug #40745: Error during WHERE clause calculation in UPDATE
+#             leads to an assertion failure
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE FUNCTION f1() RETURNS INT RETURN f1();
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+
+--error ER_SP_NO_RECURSION
+UPDATE t1 SET i = 3 WHERE f1();
+--error ER_SP_NO_RECURSION
+UPDATE t1 SET i = f1();
+
+DROP TABLE t1;
+DROP FUNCTION f1;
+
 --echo End of 5.0 tests

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2008-11-24 20:46:11 +0000
+++ b/mysql-test/t/variables.test	2008-11-27 11:01:59 +0000
@@ -1071,18 +1071,6 @@ SET @@global.skip_show_database= true;
 #
 --echo #
 --replace_column 2 #
-SHOW VARIABLES like 'socket';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.socket;
---replace_column 1 #
-SELECT @@global.socket;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.socket= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.socket= 'x';
-#
---echo #
---replace_column 2 #
 SHOW VARIABLES like 'thread_stack';
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SELECT @@session.thread_stack;

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2008-10-29 13:55:04 +0000
+++ b/mysql-test/t/view.test	2008-11-28 17:51:47 +0000
@@ -510,7 +510,7 @@ drop table t1;
 #
 create table t1 (a int, b int);
 create view v1 as select a, sum(b) from t1 group by a;
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
 select b from v1 use index (some_index) where b=1;
 drop view v1;
 drop table t1;
@@ -3422,11 +3422,11 @@ drop table t1;
 CREATE TABLE t1 (a INT);
 INSERT INTO t1 VALUES (1),(2);
 CREATE VIEW v1 AS SELECT * FROM t1;
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
 SELECT * FROM v1 USE KEY(non_existant);
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
 SELECT * FROM v1 FORCE KEY(non_existant);
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
 SELECT * FROM v1 IGNORE KEY(non_existant);
 
 DROP VIEW v1;
@@ -3565,6 +3565,32 @@ DROP VIEW v1;
 CREATE VIEW v1 AS SELECT 1;
 DROP VIEW v1;
 
+#
+# Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws an error
+#
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+
+DROP VIEW v1;
+DROP TABLE t1;
 
 --echo # -----------------------------------------------------------------
 --echo # -- End of 5.0 tests.
@@ -3751,3 +3777,37 @@ create view v_9801 as
 
 drop table t_9801;
 
+#
+# Bug#37460 Assertion failed:
+# !table->file || table->file->inited == handler::NONE
+#
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+
+CREATE VIEW v1 AS
+  SELECT t2.c AS c FROM t1, t2
+    WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+
+CREATE VIEW v2 (a,b) AS
+  SELECT t2.id, t2.c AS c FROM t1, t2
+    WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+  
+--error 1369
+INSERT INTO v2(a,b) VALUES (2,2);
+INSERT INTO v2(a,b) VALUES (1,2);
+SELECT * FROM v1;
+
+CREATE VIEW v3 AS
+  SELECT t2.c AS c FROM t2
+    WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+
+DELETE FROM v3;
+
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2008-10-20 09:16:47 +0000
+++ b/mysys/my_thr_init.c	2008-12-05 01:05:05 +0000
@@ -386,17 +386,7 @@ void my_thread_end(void)
 
 struct st_my_thread_var *_my_thread_var(void)
 {
-  struct st_my_thread_var *tmp=
-    my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
-#if defined(USE_TLS)
-  /* This can only happen in a .DLL */
-  if (!tmp)
-  {
-    my_thread_init();
-    tmp=my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
-  }
-#endif
-  return tmp;
+  return  my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
 }
 
 #ifndef DBUG_OFF

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2008-11-27 17:31:54 +0000
+++ b/sql/item_func.cc	2008-11-28 11:40:40 +0000
@@ -2278,7 +2278,7 @@ void Item_func_min_max::fix_length_and_d
 
 uint Item_func_min_max::cmp_datetimes(ulonglong *value)
 {
-  ulonglong min_max;
+  longlong min_max;
   uint min_max_idx= 0;
   LINT_INIT(min_max);
 

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-11-27 17:31:54 +0000
+++ b/sql/mysql_priv.h	2008-12-05 01:05:05 +0000
@@ -1843,10 +1843,9 @@ int mysql_load(THD *thd, sql_exchange *e
 int write_record(THD *thd, TABLE *table, COPY_INFO *info);
 
 /* sql_manager.cc */
-extern ulong volatile manager_status;
-extern bool volatile manager_thread_in_use, mqh_used;
-extern pthread_t manager_thread;
-pthread_handler_t handle_manager(void *arg);
+extern bool volatile  mqh_used;
+void start_handle_manager();
+void stop_handle_manager();
 bool mysql_manager_submit(void (*action)());
 
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-11-28 00:26:35 +0000
+++ b/sql/mysqld.cc	2008-12-05 01:05:05 +0000
@@ -886,16 +886,6 @@ static void close_connections(void)
   kill_cached_threads++;
   flush_thread_cache();
 
-  /* kill flush thread */
-  (void) pthread_mutex_lock(&LOCK_manager);
-  if (manager_thread_in_use)
-  {
-    DBUG_PRINT("quit", ("killing manager thread: 0x%llx",
-                        (ulonglong)manager_thread));
-   (void) pthread_cond_signal(&COND_manager);
-  }
-  (void) pthread_mutex_unlock(&LOCK_manager);
-
   /* kill connection thread */
 #if !defined(__WIN__) && !defined(__NETWARE__)
   DBUG_PRINT("quit", ("waiting for select thread: 0x%llx",
@@ -1307,6 +1297,7 @@ void clean_up(bool print_message)
   if (cleanup_done++)
     return; /* purecov: inspected */
 
+  stop_handle_manager();
   release_ddl_log();
 
   /*
@@ -3584,12 +3575,14 @@ static int init_common_variables(const c
     sys_init_connect.value_length= strlen(opt_init_connect);
   else
     sys_init_connect.value=my_strdup("",MYF(0));
+  sys_init_connect.is_os_charset= TRUE;
 
   sys_init_slave.value_length= 0;
   if ((sys_init_slave.value= opt_init_slave))
     sys_init_slave.value_length= strlen(opt_init_slave);
   else
     sys_init_slave.value=my_strdup("",MYF(0));
+  sys_init_slave.is_os_charset= TRUE;
 
   /* check log options and issue warnings if needed */
   if (opt_log && opt_logname && !(log_output_options & LOG_FILE) &&
@@ -4344,17 +4337,6 @@ server.");
 
 #ifndef EMBEDDED_LIBRARY
 
-static void create_maintenance_thread()
-{
-  if (flush_time && flush_time != ~(ulong) 0L)
-  {
-    pthread_t hThread;
-    if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
-      sql_print_warning("Can't create thread to manage maintenance");
-  }
-}
-
-
 static void create_shutdown_thread()
 {
 #ifdef __WIN__
@@ -4660,7 +4642,7 @@ int main(int argc, char **argv)
   execute_ddl_log_recovery();
 
   create_shutdown_thread();
-  create_maintenance_thread();
+  start_handle_manager();
 
   if (Events::init(opt_noacl))
     unireg_abort(1);

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2008-11-24 20:46:11 +0000
+++ b/sql/set_var.cc	2008-11-28 16:30:27 +0000
@@ -189,14 +189,14 @@ static sys_var_bool_ptr	sys_automatic_sp
 static sys_var_const            sys_back_log(&vars, "back_log",
                                              OPT_GLOBAL, SHOW_LONG,
                                              (uchar*) &back_log);
-static sys_var_const_str       sys_basedir(&vars, "basedir", mysql_home);
+static sys_var_const_os_str       sys_basedir(&vars, "basedir", mysql_home);
 static sys_var_long_ptr	sys_binlog_cache_size(&vars, "binlog_cache_size",
 					      &binlog_cache_size);
 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
                                             &SV::binlog_format);
 static sys_var_thd_ulong	sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
 						  &SV::bulk_insert_buff_size);
-static sys_var_const            sys_character_sets_dir(&vars,
+static sys_var_const_os         sys_character_sets_dir(&vars,
                                                        "character_sets_dir",
                                                        OPT_GLOBAL, SHOW_CHAR,
                                                        (uchar*)
@@ -246,7 +246,7 @@ static sys_var_long_ptr	sys_concurrent_i
                                               &myisam_concurrent_insert);
 static sys_var_long_ptr	sys_connect_timeout(&vars, "connect_timeout",
 					    &connect_timeout);
-static sys_var_const_str       sys_datadir(&vars, "datadir", mysql_real_data_home);
+static sys_var_const_os_str       sys_datadir(&vars, "datadir", mysql_real_data_home);
 static sys_var_backup_wait_timeout sys_backup_wait_timeout(&vars, "backup_wait_timeout");
 static sys_var_thd_ulong sys_deadlock_search_depth_short(&vars,
                                 "deadlock_search_depth_short",
@@ -499,7 +499,7 @@ static sys_var_thd_enum        sys_optim
 static sys_var_const            sys_pid_file(&vars, "pid_file",
                                              OPT_GLOBAL, SHOW_CHAR,
                                              (uchar*) pidfile_name);
-static sys_var_const            sys_plugin_dir(&vars, "plugin_dir",
+static sys_var_const_os         sys_plugin_dir(&vars, "plugin_dir",
                                                OPT_GLOBAL, SHOW_CHAR,
                                                (uchar*) opt_plugin_dir);
 static sys_var_const            sys_port(&vars, "port",
@@ -567,7 +567,7 @@ static sys_var_const    sys_thread_concu
 static sys_var_const    sys_thread_stack(&vars, "thread_stack",
                                          OPT_GLOBAL, SHOW_LONG,
                                          (uchar*) &my_thread_stack_size);
-static sys_var_readonly        sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
+static sys_var_readonly_os      sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
 static sys_var_thd_ulong	sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
 						   &SV::trans_alloc_block_size,
 						   0, fix_trans_mem_root);
@@ -628,17 +628,17 @@ static sys_var_thd_optimizer_switch   sy
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
 extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
             *opt_ssl_key;
-static sys_var_const_str_ptr	sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
-static sys_var_const_str_ptr	sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
-static sys_var_const_str_ptr	sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
-static sys_var_const_str_ptr	sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
-static sys_var_const_str_ptr	sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
+static sys_var_const_os_str_ptr	sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
+static sys_var_const_os_str_ptr	sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
+static sys_var_const_os_str_ptr	sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
+static sys_var_const_os_str_ptr	sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
+static sys_var_const_os_str_ptr	sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
 #else
-static sys_var_const_str	sys_ssl_ca(&vars, "ssl_ca", NULL);
-static sys_var_const_str	sys_ssl_capath(&vars, "ssl_capath", NULL);
-static sys_var_const_str	sys_ssl_cert(&vars, "ssl_cert", NULL);
-static sys_var_const_str	sys_ssl_cipher(&vars, "ssl_cipher", NULL);
-static sys_var_const_str	sys_ssl_key(&vars, "ssl_key", NULL);
+static sys_var_const_os_str	sys_ssl_ca(&vars, "ssl_ca", NULL);
+static sys_var_const_os_str	sys_ssl_capath(&vars, "ssl_capath", NULL);
+static sys_var_const_os_str	sys_ssl_cert(&vars, "ssl_cert", NULL);
+static sys_var_const_os_str	sys_ssl_cipher(&vars, "ssl_cipher", NULL);
+static sys_var_const_os_str	sys_ssl_key(&vars, "ssl_key", NULL);
 #endif
 static sys_var_thd_enum
 sys_updatable_views_with_limit(&vars, "updatable_views_with_limit",
@@ -1014,6 +1014,7 @@ bool update_sys_var_str(sys_var_str *var
   old_value= var_str->value;
   var_str->value= res;
   var_str->value_length= new_length;
+  var_str->is_os_charset= FALSE;
   rw_unlock(var_mutex);
   my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
   return 0;
@@ -1903,6 +1904,13 @@ err:
 }
 
 
+CHARSET_INFO *sys_var::charset(THD *thd)
+{
+  return is_os_charset ? thd->variables.character_set_filesystem : 
+    system_charset_info;
+}
+
+
 bool sys_var_thd_enum::update(THD *thd, set_var *var)
 {
   if (var->type == OPT_GLOBAL)

=== modified file 'sql/set_var.h'
--- a/sql/set_var.h	2008-11-24 20:46:11 +0000
+++ b/sql/set_var.h	2008-12-02 11:25:43 +0000
@@ -71,9 +71,18 @@ public:
 
   sys_after_update_func after_update;
   bool no_support_one_shot;
+  /*
+    true if the value is in character_set_filesystem, 
+    false otherwise.
+    Note that we can't use a pointer to the charset as the system var is 
+    instantiated in global scope and the charset pointers are initialized
+    later.
+  */  
+  bool is_os_charset;
   sys_var(const char *name_arg, sys_after_update_func func= NULL,
           Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
     :name(name_arg), after_update(func), no_support_one_shot(1),
+    is_os_charset (FALSE),
     binlog_status(binlog_status_arg),
     m_allow_empty_value(TRUE)
   {}
@@ -107,6 +116,7 @@ public:
   { return option_limits == 0; }
   virtual bool is_struct() { return 0; }
   virtual bool is_readonly() const { return 0; }
+  CHARSET_INFO *charset(THD *thd);
   virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
 
 protected:
@@ -291,6 +301,18 @@ public:
 };
 
 
+class sys_var_const_os_str: public sys_var_const_str
+{
+public:
+  sys_var_const_os_str(sys_var_chain *chain, const char *name_arg, 
+                       const char *value_arg)
+    :sys_var_const_str(chain, name_arg, value_arg)
+  { 
+    is_os_charset= TRUE; 
+  }
+};
+
+
 class sys_var_const_str_ptr :public sys_var
 {
 public:
@@ -320,6 +342,18 @@ public:
 };
 
 
+class sys_var_const_os_str_ptr :public sys_var_const_str_ptr
+{
+public:
+  sys_var_const_os_str_ptr(sys_var_chain *chain, const char *name_arg, 
+                           char **value_arg)
+    :sys_var_const_str_ptr(chain, name_arg, value_arg)
+  {
+    is_os_charset= TRUE; 
+  }
+};
+
+
 class sys_var_enum :public sys_var
 {
   uint *value;
@@ -1019,6 +1053,19 @@ public:
 };
 
 
+class sys_var_readonly_os: public sys_var_readonly
+{
+public:
+  sys_var_readonly_os(sys_var_chain *chain, const char *name_arg, enum_var_type type,
+		   SHOW_TYPE show_type_arg,
+		   sys_value_ptr_func value_ptr_func_arg)
+    :sys_var_readonly(chain, name_arg, type, show_type_arg, value_ptr_func_arg)
+  {
+    is_os_charset= TRUE;
+  }
+};
+
+
 /**
   Global-only, read-only variable. E.g. command line option.
 */
@@ -1047,6 +1094,22 @@ public:
 };
 
 
+class sys_var_const_os: public sys_var_const
+{
+public:
+  enum_var_type var_type;
+  SHOW_TYPE show_type_value;
+  uchar *ptr;
+  sys_var_const_os(sys_var_chain *chain, const char *name_arg, 
+                   enum_var_type type,
+                SHOW_TYPE show_type_arg, uchar *ptr_arg)
+    :sys_var_const(chain, name_arg, type, show_type_arg, ptr_arg)
+  {
+    is_os_charset= TRUE;
+  }
+};
+
+
 class sys_var_have_option: public sys_var
 {
 protected:

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2008-11-24 20:46:11 +0000
+++ b/sql/slave.cc	2008-11-28 16:05:44 +0000
@@ -290,7 +290,7 @@ static void print_slave_skip_errors(void
     10 characters must be sufficient for a number plus {',' | '...'}
     plus a NUL terminator. That is a max 6 digit number.
   */
-  const int MIN_ROOM= 10;
+  const size_t MIN_ROOM= 10;
   DBUG_ENTER("print_slave_skip_errors");
   DBUG_ASSERT(sizeof(slave_skip_error_names) > MIN_ROOM);
   DBUG_ASSERT(MAX_SLAVE_ERROR <= 999999); // 6 digits

=== modified file 'sql/sql_manager.cc'
--- a/sql/sql_manager.cc	2007-05-10 09:59:39 +0000
+++ b/sql/sql_manager.cc	2008-12-04 18:41:53 +0000
@@ -23,8 +23,9 @@
 
 #include "mysql_priv.h"
 
-ulong volatile manager_status;
-bool volatile manager_thread_in_use;
+
+static bool volatile manager_thread_in_use;
+static bool abort_manager;
 
 pthread_t manager_thread;
 pthread_mutex_t LOCK_manager;
@@ -63,7 +64,6 @@ bool mysql_manager_submit(void (*action)
 pthread_handler_t handle_manager(void *arg __attribute__((unused)))
 {
   int error = 0;
-  ulong status;
   struct timespec abstime;
   bool reset_flush_time = TRUE;
   struct handler_cb *cb= NULL;
@@ -72,7 +72,6 @@ pthread_handler_t handle_manager(void *a
 
   pthread_detach_this_thread();
   manager_thread = pthread_self();
-  manager_status = 0;
   manager_thread_in_use = 1;
 
   for (;;)
@@ -87,16 +86,14 @@ pthread_handler_t handle_manager(void *a
 	set_timespec(abstime, flush_time);
         reset_flush_time = FALSE;
       }
-      while (!manager_status && (!error || error == EINTR) && !abort_loop)
+      while ((!error || error == EINTR) && !abort_manager)
         error= pthread_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
     }
     else
     {
-      while (!manager_status && (!error || error == EINTR) && !abort_loop)
+      while ((!error || error == EINTR) && !abort_manager)
         error= pthread_cond_wait(&COND_manager, &LOCK_manager);
     }
-    status = manager_status;
-    manager_status = 0;
     if (cb == NULL)
     {
       cb= cb_list;
@@ -104,7 +101,7 @@ pthread_handler_t handle_manager(void *a
     }
     pthread_mutex_unlock(&LOCK_manager);
 
-    if (abort_loop)
+    if (abort_manager)
       break;
 
     if (error == ETIMEDOUT || error == ETIME)
@@ -121,11 +118,42 @@ pthread_handler_t handle_manager(void *a
       my_free((uchar*)cb, MYF(0));
       cb= next;
     }
-
-    if (status)
-      DBUG_PRINT("error", ("manager did not handle something: %lx", status));
   }
   manager_thread_in_use = 0;
+  DBUG_LEAVE; // Can't use DBUG_RETURN after my_thread_end
   my_thread_end();
-  DBUG_RETURN(NULL);
+  return (NULL);
 }
+
+
+/* Start handle manager thread */
+void start_handle_manager()
+{
+  DBUG_ENTER("start_handle_manager");
+  abort_manager = false;
+  if (flush_time && flush_time != ~(ulong) 0L)
+  {
+    pthread_t hThread;
+    if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
+      sql_print_warning("Can't create handle_manager thread");
+  }
+  DBUG_VOID_RETURN;
+}
+
+
+/* Initiate shutdown of handle manager thread */
+void stop_handle_manager()
+{
+  DBUG_ENTER("stop_handle_manager");
+  abort_manager = true;
+  pthread_mutex_lock(&LOCK_manager);
+  if (manager_thread_in_use)
+  {
+    DBUG_PRINT("quit", ("initiate shutdown of handle manager thread: 0x%lx",
+                        (ulong)manager_thread));
+   pthread_cond_signal(&COND_manager);
+  }
+  pthread_mutex_unlock(&LOCK_manager);
+  DBUG_VOID_RETURN;
+}
+

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2008-11-13 12:53:16 +0000
+++ b/sql/sql_show.cc	2008-11-28 16:30:27 +0000
@@ -2088,6 +2088,7 @@ static bool show_status_array(THD *thd, 
   COND *partial_cond= 0;
   enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
   bool res= FALSE;
+  CHARSET_INFO *charset= system_charset_info;
   DBUG_ENTER("show_status_array");
 
   thd->count_cuted_fields= CHECK_FIELD_WARN;  
@@ -2136,9 +2137,10 @@ static bool show_status_array(THD *thd, 
 
         if (show_type == SHOW_SYS)
         {
-          show_type= ((sys_var*) value)->show_type();
-          value=     (char*) ((sys_var*) value)->value_ptr(thd, value_type,
-                                                           &null_lex_str);
+          sys_var *var= ((sys_var *) value);
+          show_type= var->show_type();
+          value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
+          charset= var->charset(thd);
         }
 
         pos= end= buff;
@@ -2215,7 +2217,7 @@ static bool show_status_array(THD *thd, 
           DBUG_ASSERT(0);
           break;
         }
-        table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
+        table->field[1]->store(pos, (uint32) (end - pos), charset);
         thd->count_cuted_fields= CHECK_FIELD_IGNORE;
         table->field[1]->set_notnull();
 

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2008-11-27 14:25:02 +0000
+++ b/sql/sql_update.cc	2008-11-28 17:51:47 +0000
@@ -728,6 +728,11 @@ int mysql_update(THD *thd,
     else
       table->file->unlock_row();
     thd->row_count++;
+    if (thd->is_error())
+    {
+      error= 1;
+      break;
+    }
   }
   dup_key_found= 0;
   /*

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2008-11-14 17:41:51 +0000
+++ b/sql/sql_view.cc	2008-12-01 08:18:06 +0000
@@ -1056,8 +1056,9 @@ bool mysql_make_view(THD *thd, File_pars
 
   if (table->index_hints && table->index_hints->elements)
   {
-      my_error(ER_WRONG_USAGE, MYF(0), "index hints", "VIEW");
-      DBUG_RETURN(TRUE);
+    my_error(ER_KEY_DOES_NOT_EXITS, MYF(0),
+             table->index_hints->head()->key_name.str, table->table_name);
+    DBUG_RETURN(TRUE);
   }
 
   /* check loop via view definition */

=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc	2008-05-08 20:43:28 +0000
+++ b/sql/tztime.cc	2008-12-01 16:00:03 +0000
@@ -1072,6 +1072,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_
   localtime_r(&tmp_t, &tmp_tm);
   localtime_to_TIME(tmp, &tmp_tm);
   tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+  adjust_leap_second(tmp);
 }
 
 
@@ -1156,6 +1157,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIM
   gmtime_r(&tmp_t, &tmp_tm);
   localtime_to_TIME(tmp, &tmp_tm);
   tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+  adjust_leap_second(tmp);
 }
 
 
@@ -1259,6 +1261,7 @@ void
 Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
 {
   ::gmt_sec_to_TIME(tmp, t, tz_info);
+  adjust_leap_second(tmp);
 }
 
 
@@ -2279,6 +2282,24 @@ my_tz_find(THD *thd, const String *name)
 }
 
 
+/**
+  Convert leap seconds into non-leap
+
+  This function will convert the leap seconds added by the OS to 
+  non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ...
+  This check is not checking for years on purpose : although it's not a
+  complete check this way it doesn't require looking (and having installed)
+  the leap seconds table.
+
+  @param[in,out] broken down time structure as filled in by the OS
+*/
+
+void Time_zone::adjust_leap_second(MYSQL_TIME *t)
+{
+  if (t->second == 60 || t->second == 61)
+    t->second= 59;
+}
+
 #endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
 
 

=== modified file 'sql/tztime.h'
--- a/sql/tztime.h	2007-10-16 20:11:50 +0000
+++ b/sql/tztime.h	2008-12-01 15:22:16 +0000
@@ -55,6 +55,9 @@ public:
     allocated on MEM_ROOT and should not require destruction.
   */
   virtual ~Time_zone() {};
+
+protected:
+  static inline void adjust_leap_second(MYSQL_TIME *t);
 };
 
 extern Time_zone * my_tz_UTC;

Thread
bzr commit into mysql-6.0-bugteam branch (bar:2753) Alexander Barkov5 Dec