From 601cfeab34f4415b3295f78a60ac94e4afc7a6a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Dec 2005 23:17:00 +0300 Subject: [PATCH 1/6] Fixes bug #6536. When MyODBC or any other client do my_init()/my_end() several times, it was causing corruption of charset data stored in once_mem_pool. my_end() deallocated once_mem pool, but did not put a flag that charsets have to be reloaded. The fix addresses this problem. --- mysys/my_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mysys/my_init.c b/mysys/my_init.c index 3e5130ec670..d68c76bef1b 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -152,6 +152,7 @@ void my_end(int infoflag) DBUG_PRINT("error",("%s",errbuff[0])); } } + free_charsets(); my_once_free(); if ((infoflag & MY_GIVE_INFO) || print_info) From 81f17615ac52187e4ce6233fce69af3fa9d03db9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Feb 2006 02:18:41 +0100 Subject: [PATCH 2/6] Removed version information from test --- mysql-test/r/binlog_stm_binlog.result | 2 +- mysql-test/t/binlog_stm_binlog.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/binlog_stm_binlog.result b/mysql-test/r/binlog_stm_binlog.result index ac4ca23782d..f9180b69ab6 100644 --- a/mysql-test/r/binlog_stm_binlog.result +++ b/mysql-test/r/binlog_stm_binlog.result @@ -4,7 +4,7 @@ insert into t1 values (1,2); commit; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: 5.1.7-beta-debug-log, Binlog ver: 4 +master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: # master-bin.000001 102 Query 1 209 use `test`; create table t1 (a int, b int) engine=innodb master-bin.000001 209 Query 1 277 use `test`; BEGIN master-bin.000001 277 Query 1 90 use `test`; insert into t1 values (1,2) diff --git a/mysql-test/t/binlog_stm_binlog.test b/mysql-test/t/binlog_stm_binlog.test index d608741da0b..826ce54ae2c 100644 --- a/mysql-test/t/binlog_stm_binlog.test +++ b/mysql-test/t/binlog_stm_binlog.test @@ -5,7 +5,7 @@ create table t1 (a int, b int) engine=innodb; begin; insert into t1 values (1,2); commit; ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ show binlog events; drop table t1; From 7ce3b2a3811b993412783a31bcb7bac186eab928 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Feb 2006 08:24:01 +0400 Subject: [PATCH 3/6] Many files: Backporting character_set_filesystem from 5.0 to 5.1. sql/mysqld.cc: Backporting character_set_filesystem from 5.0 to 5.1. sql/set_var.cc: Backporting character_set_filesystem from 5.0 to 5.1. sql/set_var.h: Backporting character_set_filesystem from 5.0 to 5.1. sql/sql_class.cc: Backporting character_set_filesystem from 5.0 to 5.1. sql/sql_class.h: Backporting character_set_filesystem from 5.0 to 5.1. sql/sql_yacc.yy: Backporting character_set_filesystem from 5.0 to 5.1. mysql-test/t/variables.test: Backporting character_set_filesystem from 5.0 to 5.1. mysql-test/r/variables.result: Backporting character_set_filesystem from 5.0 to 5.1. --- mysql-test/r/variables.result | 18 ++++++++++++++++++ mysql-test/t/variables.test | 14 ++++++++++++++ sql/mysqld.cc | 16 ++++++++++++++++ sql/set_var.cc | 29 +++++++++++++++++++++++++++++ sql/set_var.h | 9 +++++++++ sql/sql_class.cc | 3 +++ sql/sql_class.h | 2 ++ sql/sql_yacc.yy | 20 ++++++++++++++++---- 8 files changed, 107 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 1b5532c334a..1d1c76ab3fe 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -566,3 +566,21 @@ set global character_set_system = latin1; ERROR HY000: Variable 'character_set_system' is a read only variable set @@global.version_compile_os='234'; ERROR HY000: Variable 'version_compile_os' is a read only variable +set character_set_filesystem=latin1; +select @@character_set_filesystem; +@@character_set_filesystem +latin1 +set @@global.character_set_filesystem=latin2; +set character_set_filesystem=latin1; +select @@character_set_filesystem; +@@character_set_filesystem +latin1 +set @@global.character_set_filesystem=latin2; +set character_set_filesystem=default; +select @@character_set_filesystem; +@@character_set_filesystem +latin2 +set @@global.character_set_filesystem=default; +select @@global.character_set_filesystem; +@@global.character_set_filesystem +binary diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 9fc7f79d364..8df1d34ea5e 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -456,4 +456,18 @@ set global character_set_system = latin1; --error 1238 set @@global.version_compile_os='234'; +# +# Check character_set_filesystem variable +# +set character_set_filesystem=latin1; +select @@character_set_filesystem; +set @@global.character_set_filesystem=latin2; +set character_set_filesystem=latin1; +select @@character_set_filesystem; +set @@global.character_set_filesystem=latin2; +set character_set_filesystem=default; +select @@character_set_filesystem; +set @@global.character_set_filesystem=default; +select @@global.character_set_filesystem; + # End of 5.0 tests diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7f835c0e8e0..c19fdcfde82 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -321,6 +321,7 @@ static const char *sql_mode_str= "OFF"; static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; static char *opt_init_slave, *language_ptr, *opt_init_connect; static char *default_character_set_name; +static char *character_set_filesystem_name; static char *my_bind_addr_str; static char *default_collation_name; static char mysql_data_home_buff[2]; @@ -469,6 +470,7 @@ MY_BITMAP temp_pool; CHARSET_INFO *system_charset_info, *files_charset_info ; CHARSET_INFO *national_charset_info, *table_alias_charset; +CHARSET_INFO *character_set_filesystem; SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, have_ndbcluster, have_example_db, have_archive_db, have_csv_db; @@ -2677,6 +2679,12 @@ static int init_common_variables(const char *conf_file_name, int argc, global_system_variables.character_set_client= default_charset_info; global_system_variables.collation_connection= default_charset_info; + if (!(character_set_filesystem= + get_charset_by_csname(character_set_filesystem_name, + MY_CS_PRIMARY, MYF(MY_WME)))) + return 1; + global_system_variables.character_set_filesystem= character_set_filesystem; + sys_init_connect.value_length= 0; if ((sys_init_connect.value= opt_init_connect)) sys_init_connect.value_length= strlen(opt_init_connect); @@ -4563,6 +4571,7 @@ enum options_mysqld OPT_GROUP_CONCAT_MAX_LEN, OPT_DEFAULT_COLLATION, OPT_CHARACTER_SET_CLIENT_HANDSHAKE, + OPT_CHARACTER_SET_FILESYSTEM, OPT_INIT_CONNECT, OPT_INIT_SLAVE, OPT_SECURE_AUTH, @@ -4671,6 +4680,11 @@ Disable with --skip-bdb (will save memory).", (gptr*) &opt_character_set_client_handshake, (gptr*) &opt_character_set_client_handshake, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM, + "Set the filesystem character set.", + (gptr*) &character_set_filesystem_name, + (gptr*) &character_set_filesystem_name, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"character-set-server", 'C', "Set the default character set.", (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, @@ -6260,6 +6274,7 @@ static void mysql_init_variables(void) files_charset_info= &my_charset_utf8_general_ci; national_charset_info= &my_charset_utf8_general_ci; table_alias_charset= &my_charset_bin; + character_set_filesystem= &my_charset_bin; opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0; @@ -6320,6 +6335,7 @@ static void mysql_init_variables(void) default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME; sys_charset_system.value= (char*) system_charset_info->csname; + character_set_filesystem_name= (char*) "binary"; /* Set default values for some option variables */ diff --git a/sql/set_var.cc b/sql/set_var.cc index d945e0842e4..15418a106fc 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -148,6 +148,7 @@ sys_var_character_set_database sys_character_set_database("character_set_databas sys_var_character_set_client sys_character_set_client("character_set_client"); sys_var_character_set_connection sys_character_set_connection("character_set_connection"); sys_var_character_set_results sys_character_set_results("character_set_results"); +sys_var_character_set_filesystem sys_character_set_filesystem("character_set_filesystem"); sys_var_thd_ulong sys_completion_type("completion_type", &SV::completion_type, check_completion_type, @@ -580,6 +581,7 @@ sys_var *sys_variables[]= &sys_character_set_client, &sys_character_set_connection, &sys_character_set_results, + &sys_character_set_filesystem, &sys_charset_system, &sys_collation_connection, &sys_collation_database, @@ -771,6 +773,7 @@ struct show_var_st init_vars[]= { {sys_character_set_client.name,(char*) &sys_character_set_client, SHOW_SYS}, {sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS}, {sys_character_set_database.name, (char*) &sys_character_set_database,SHOW_SYS}, + {sys_character_set_filesystem.name,(char*) &sys_character_set_filesystem, SHOW_SYS}, {sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS}, {sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS}, {sys_charset_system.name, (char*) &sys_charset_system, SHOW_SYS}, @@ -2076,6 +2079,32 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type) } +CHARSET_INFO ** +sys_var_character_set_filesystem::ci_ptr(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + return &global_system_variables.character_set_filesystem; + else + return &thd->variables.character_set_filesystem; +} + + +extern CHARSET_INFO *character_set_filesystem; + +void +sys_var_character_set_filesystem::set_default(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + global_system_variables.character_set_filesystem= character_set_filesystem; + else + { + thd->variables.character_set_filesystem= (global_system_variables. + character_set_filesystem); + thd->update_charset(); + } +} + + CHARSET_INFO ** sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type) { diff --git a/sql/set_var.h b/sql/set_var.h index 18c3353e8ff..046281ec7c5 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -540,6 +540,15 @@ public: virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0; }; +class sys_var_character_set_filesystem :public sys_var_character_set +{ +public: + sys_var_character_set_filesystem(const char *name_arg) : + sys_var_character_set(name_arg) {} + void set_default(THD *thd, enum_var_type type); + CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); +}; + class sys_var_character_set_client :public sys_var_character_set { public: diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b3709235d8b..2125201026a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -648,6 +648,9 @@ void THD::update_charset() charset_is_collation_connection= !String::needs_conversion(0,charset(),variables.collation_connection, ¬_used); + charset_is_character_set_filesystem= + !String::needs_conversion(0, charset(), + variables.character_set_filesystem, ¬_used); } diff --git a/sql/sql_class.h b/sql/sql_class.h index c025b4f0774..1672a5ea811 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -569,6 +569,7 @@ struct system_variables my_bool old_passwords; /* Only charset part of these variables is sensible */ + CHARSET_INFO *character_set_filesystem; CHARSET_INFO *character_set_client; CHARSET_INFO *character_set_results; @@ -1341,6 +1342,7 @@ public: bool query_error, bootstrap, cleanup_done; bool tmp_table_used; bool charset_is_system_charset, charset_is_collation_connection; + bool charset_is_character_set_filesystem; bool enable_slow_log; /* enable slow log for current statement */ bool no_trans_update, abort_on_warning; bool got_warning; /* Set on call to push_warning() */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ebb97cde3e4..d1ef0e08d57 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -684,7 +684,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal NCHAR_STRING opt_component key_cache_name - sp_opt_label BIN_NUM label_ident + sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem %type opt_table_alias @@ -5937,7 +5937,7 @@ select_var_ident: ; into: - INTO OUTFILE TEXT_STRING_sys + INTO OUTFILE TEXT_STRING_filesystem { LEX *lex= Lex; lex->uncacheable(UNCACHEABLE_SIDEEFFECT); @@ -5946,7 +5946,7 @@ into: YYABORT; } opt_field_term opt_line_term - | INTO DUMPFILE TEXT_STRING_sys + | INTO DUMPFILE TEXT_STRING_filesystem { LEX *lex=Lex; if (!lex->describe) @@ -6930,7 +6930,7 @@ load: LOAD DATA_SYM }; load_data: - load_data_lock opt_local INFILE TEXT_STRING_sys + load_data_lock opt_local INFILE TEXT_STRING_filesystem { LEX *lex=Lex; lex->sql_command= SQLCOM_LOAD; @@ -7459,6 +7459,18 @@ TEXT_STRING_literal: ; +TEXT_STRING_filesystem: + TEXT_STRING + { + THD *thd= YYTHD; + if (thd->charset_is_character_set_filesystem) + $$= $1; + else + thd->convert_string(&$$, thd->variables.character_set_filesystem, + $1.str, $1.length, thd->charset()); + } + ; + ident: IDENT_sys { $$=$1; } | keyword From e9b5239619bc4a5df5112aeb909f97bb703b17c9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Feb 2006 08:32:39 +0100 Subject: [PATCH 4/6] disabled non deterministic test --- mysql-test/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 7555df95b04..491c1ba2fa6 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -32,3 +32,4 @@ rpl_sp : Bug#16456 rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future subselect : Bug#15706 (ps mode) [PATCH PENDING] +rpl_ndb_log : result not deterministic From 89f14570adf9b864926c9a8a87311ef780cc805b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Feb 2006 12:52:38 +0400 Subject: [PATCH 5/6] Bug#16591 Partitions: crash using information_schema.partitions Bug#16695 Reading I_S.PARTITIONS with pre-5.1.6 partitioned tables crashes server issue a warning in case of error during table opening --- sql/sql_show.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 387e5e4fcfb..9ce6b72b318 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3583,23 +3583,23 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables, String tmp_str; TIME time; TABLE *show_table= tables->table; - handler *file= show_table->file; + handler *file; #ifdef WITH_PARTITION_STORAGE_ENGINE - partition_info *part_info= show_table->part_info; + partition_info *part_info; #endif DBUG_ENTER("get_schema_partitions_record"); if (res) { -#ifdef WITH_PARTITION_STORAGE_ENGINE - if (part_info) + if (!tables->view) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, thd->net.last_errno, thd->net.last_error); -#endif thd->clear_error(); DBUG_RETURN(0); } + file= show_table->file; #ifdef WITH_PARTITION_STORAGE_ENGINE + part_info= show_table->part_info; if (part_info) { partition_element *part_elem; From 9236e3c24bad0f213409baa81156b19407f1e597 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Feb 2006 13:51:25 +0400 Subject: [PATCH 6/6] BUG#17117: header fille "plugin.h" does not have a namespace prefix plugin.h has been moved into include/mysql/plugin.h include/mysql/plugin.h: Rename: include/plugin.h -> include/mysql/plugin.h include/Makefile.am: plugin.h has been moved into include/mysql/plugin.h include/myisam.h: plugin.h has been moved into include/mysql/plugin.h plugin/fulltext/plugin_example.c: plugin.h has been moved into include/mysql/plugin.h sql/sql_plugin.h: plugin.h has been moved into include/mysql/plugin.h storage/csv/ha_tina.cc: plugin.h has been moved into include/mysql/plugin.h storage/example/ha_example.cc: plugin.h has been moved into include/mysql/plugin.h storage/myisam/ftdefs.h: plugin.h has been moved into include/mysql/plugin.h --- include/Makefile.am | 2 +- include/myisam.h | 2 +- include/{ => mysql}/plugin.h | 0 plugin/fulltext/plugin_example.c | 2 +- sql/sql_plugin.h | 2 +- storage/csv/ha_tina.cc | 2 +- storage/example/ha_example.cc | 2 +- storage/myisam/ftdefs.h | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename include/{ => mysql}/plugin.h (100%) diff --git a/include/Makefile.am b/include/Makefile.am index 5b743baccb6..33e34fb512f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -22,7 +22,7 @@ pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \ errmsg.h my_global.h my_net.h my_alloc.h \ my_getopt.h sslopt-longopts.h my_dir.h typelib.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ - mysql_time.h plugin.h $(BUILT_SOURCES) + mysql_time.h mysql/plugin.h $(BUILT_SOURCES) noinst_HEADERS = config-win.h config-os2.h config-netware.h \ heap.h my_bitmap.h my_uctype.h \ myisam.h myisampack.h myisammrg.h ft_global.h\ diff --git a/include/myisam.h b/include/myisam.h index 4d55409b8b3..982982711f1 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -32,7 +32,7 @@ extern "C" { #include "keycache.h" #endif #include "my_handler.h" -#include +#include /* There is a hard limit for the maximum number of keys as there are only diff --git a/include/plugin.h b/include/mysql/plugin.h similarity index 100% rename from include/plugin.h rename to include/mysql/plugin.h diff --git a/plugin/fulltext/plugin_example.c b/plugin/fulltext/plugin_example.c index 11b0822f3f8..8f84793c1e5 100644 --- a/plugin/fulltext/plugin_example.c +++ b/plugin/fulltext/plugin_example.c @@ -15,7 +15,7 @@ #include #include -#include +#include long number_of_calls= 0; /* for SHOW STATUS, see below */ diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index ce06334ffd7..52bfc44496b 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -24,7 +24,7 @@ #define SHOW_FUNC SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG, \ SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_HAVE, \ SHOW_HA_ROWS, SHOW_SYS, SHOW_LONG_NOFLUSH -#include +#include #undef SHOW_FUNC typedef enum enum_mysql_show_type SHOW_TYPE; typedef struct st_mysql_show_var SHOW_VAR; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index bc228d5c767..3425a8735c7 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -51,7 +51,7 @@ TODO: #include "ha_tina.h" #include -#include +#include /* Stuff for shares */ pthread_mutex_t tina_mutex; diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 0e9dcf231d9..dff36e10b1a 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -70,7 +70,7 @@ #include "mysql_priv.h" #include "ha_example.h" -#include +#include static handler* example_create_handler(TABLE_SHARE *table); static int example_init_func(); diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h index 800b911b425..175f34df102 100644 --- a/storage/myisam/ftdefs.h +++ b/storage/myisam/ftdefs.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #define true_word_char(s,X) (my_isalnum(s,X) || (X)=='_') #define misc_word_char(X) 0