From 4ea9835455d91f5d9fac93030f8de0e42ce5f687 Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Tue, 22 Feb 2005 14:42:44 +0300 Subject: [PATCH 01/14] Fix for bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES(after review) --- mysql-test/r/information_schema.result | 5 +++++ mysql-test/t/information_schema.test | 27 ++++++++++++++++++++++++++ sql/sql_show.cc | 8 ++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index e8ec4f70139..a201aa3ed63 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -610,3 +610,8 @@ create view v1 as select * from t1, t2; set @got_val= (select count(*) from information_schema.columns); drop view v1; drop table t1, t2; +CREATE TABLE t_crashme ( f1 BIGINT); +CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; +CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; +drop view a2, a1; +drop table t_crashme; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index baf817b7c84..99fbc181136 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -363,3 +363,30 @@ create view v1 as select * from t1, t2; set @got_val= (select count(*) from information_schema.columns); drop view v1; drop table t1, t2; + +# +# Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES +# + +CREATE TABLE t_crashme ( f1 BIGINT); +CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; +CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; +let $tab_count= 65; +--disable_query_log +while ($tab_count) +{ + EVAL CREATE TABLE t_$tab_count (f1 BIGINT); + dec $tab_count ; +} +--disable_result_log +SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES; +--enable_result_log +let $tab_count= 65; +while ($tab_count) +{ + EVAL DROP TABLE t_$tab_count; + dec $tab_count ; +} +--enable_query_log +drop view a2, a1; +drop table t_crashme; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e46ad024f70..e95b20c29c9 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1778,6 +1778,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) LEX *lex= thd->lex; TABLE *table= tables->table; SELECT_LEX *select_lex= &lex->select_lex; + SELECT_LEX *old_all_select_lex= lex->all_selects_list; SELECT_LEX *lsel= tables->schema_select_lex; ST_SCHEMA_TABLE *schema_table= tables->schema_table; SELECT_LEX sel; @@ -1790,6 +1791,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) List bases; List_iterator_fast it(bases); COND *partial_cond; + uint derived_tables= lex->derived_tables; int error= 1; DBUG_ENTER("get_all_tables"); @@ -1814,7 +1816,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) goto err; } - lex->all_selects_list= &sel; schema_table_idx= get_schema_table_idx(schema_table); lock_type= TL_UNLOCK; @@ -1911,6 +1912,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) goto err; TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first; show_table_list->lock_type= lock_type; + lex->all_selects_list= &sel; + lex->derived_tables= 0; res= open_and_lock_tables(thd, show_table_list); if (schema_table->process_table(thd, show_table_list, table, res, base_name, @@ -1930,7 +1933,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) error= 0; err: - lex->all_selects_list= select_lex; + lex->derived_tables= derived_tables; + lex->all_selects_list= old_all_select_lex; DBUG_RETURN(error); } From 5ef265f21957ceb1801f5beff46835866fc807d5 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Tue, 22 Feb 2005 16:37:25 +0400 Subject: [PATCH 02/14] Bug#8349 myisamchk: --set-charset does not work What we need to be able to set in myisamchk is actually a collation, not a character set. This fix just changes to display the proper error message. --- include/mysys_err.h | 3 ++- myisam/myisamchk.c | 24 +++++++++++++----------- mysys/charset.c | 2 +- mysys/errors.c | 2 ++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/include/mysys_err.h b/include/mysys_err.h index 230be5f4720..19106dc3553 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -21,7 +21,7 @@ extern "C" { #endif #define GLOB 0 /* Error maps */ -#define GLOBERRS 28 /* Max number of error messages in map's */ +#define GLOBERRS 29 /* Max number of error messages in map's */ #define EE(X) globerrs[ X ] /* Defines to add error to right map */ extern const char * NEAR globerrs[]; /* my_error_messages is here */ @@ -54,6 +54,7 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ #define EE_CANT_SYMLINK 25 #define EE_REALPATH 26 #define EE_SYNC 27 +#define EE_UNKNOWN_COLLATION 28 /* exit codes for all MySQL programs */ diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index c89abca9cad..21b56669ea6 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -41,8 +41,8 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */ static uint decode_bits; static char **default_argv; static const char *load_default_groups[]= { "myisamchk", 0 }; -static const char *set_charset_name, *opt_tmpdir; -static CHARSET_INFO *set_charset; +static const char *set_collation_name, *opt_tmpdir; +static CHARSET_INFO *set_collation; static long opt_myisam_block_size; static long opt_key_cache_block_size; static const char *my_progname_short; @@ -149,7 +149,7 @@ int main(int argc, char **argv) } /* main */ enum options_mc { - OPT_CHARSETS_DIR=256, OPT_SET_CHARSET,OPT_START_CHECK_POS, + OPT_CHARSETS_DIR=256, OPT_SET_COLLATION,OPT_START_CHECK_POS, OPT_CORRECT_CHECKSUM, OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE, OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE, @@ -252,9 +252,9 @@ static struct my_option my_long_options[] = (gptr*) &check_param.auto_increment_value, (gptr*) &check_param.auto_increment_value, 0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"set-character-set", OPT_SET_CHARSET, - "Change the character set used by the index", - (gptr*) &set_charset_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"set-collation", OPT_SET_COLLATION, + "Change the collation used by the index", + (gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 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.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -739,8 +739,9 @@ static void get_options(register int *argc,register char ***argv) check_param.tmpdir=&myisamchk_tmpdir; check_param.key_cache_block_size= opt_key_cache_block_size; - if (set_charset_name) - if (!(set_charset=get_charset_by_name(set_charset_name, MYF(MY_WME)))) + if (set_collation_name) + if (!(set_collation= get_charset_by_name(set_collation_name, + MYF(MY_WME)))) exit(1); myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size); @@ -874,11 +875,12 @@ static int myisamchk(MI_CHECK *param, my_string filename) (((ulonglong) 1L << share->base.keys)-1)) || test_if_almost_full(info) || info->s->state.header.file_version[3] != myisam_file_magic[3] || - (set_charset && set_charset->number != share->state.header.language) || + (set_collation && + set_collation->number != share->state.header.language) || myisam_block_size != MI_KEY_BLOCK_LENGTH)) { - if (set_charset) - param->language=set_charset->number; + if (set_collation) + param->language= set_collation->number; if (recreate_table(param, &info,filename)) { VOID(fprintf(stderr, diff --git a/mysys/charset.c b/mysys/charset.c index 5840c885e40..4b7ad3e59f4 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -530,7 +530,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) { char index_file[FN_REFLEN]; strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); - my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); + my_error(EE_UNKNOWN_COLLATION, MYF(ME_BELL), cs_name, index_file); } return cs; diff --git a/mysys/errors.c b/mysys/errors.c index 5401c2b3cc6..05436c9a212 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -49,6 +49,7 @@ const char * NEAR globerrs[GLOBERRS]= "Can't create symlink '%s' pointing at '%s' (Error %d)", "Error on realpath() on '%s' (Error %d)", "Can't sync file '%s' to disk (Errcode: %d)", + "Collation '%s' is not a compiled collation and is not specified in the '%s' file", }; void init_glob_errs(void) @@ -89,5 +90,6 @@ void init_glob_errs() EE(EE_CANT_SYMLINK)= "Can't create symlink '%s' pointing at '%s' (Error %d)"; EE(EE_REALPATH)= "Error on realpath() on '%s' (Error %d)"; EE(EE_SYNC)= "Can't sync file '%s' to disk (Errcode: %d)"; + EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file"; } #endif From a6bf8c6686af9844f31fc479db30ec6ffbee1f96 Mon Sep 17 00:00:00 2001 From: "timour@mysql.com" <> Date: Wed, 23 Feb 2005 13:39:29 +0200 Subject: [PATCH 03/14] Fix for BUG#8576 The problem was in different representations of double variables depending on platform/compiler/compile options. In some cases double variables are represented by 64 bits (while in memory), or by 80 bits (while in FPU register). As a result equal values are not considered "==". As many sources point out, doubles should not be compared by '==' for this reason. This fix subtracts the scaled minimal double value X such that 1 + X != 1, to ensure that the inequality holds in any case. --- sql/opt_range.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ceb9f97bbbc..4d7df479000 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7027,8 +7027,12 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) cur_group_key_parts, tree, cur_index_tree, cur_quick_prefix_records, have_min, have_max, &cur_read_cost, &cur_records); - - if (cur_read_cost < best_read_cost) + /* + If cur_read_cost is lower than best_read_cost use cur_index. + Do not compare doubles directly because they may have different + representations (64 vs. 80 bits). + */ + if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost)) { index_info= cur_index_info; index= cur_index; From 3e9bf3af3441560fe5d7a021f438c93bad35062c Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Wed, 23 Feb 2005 15:15:36 +0300 Subject: [PATCH 04/14] Fix for bug #7217: information_schema: columns are varbinary() instead of timestamp & bug #7215: information_schema: columns are longtext instead of varchar --- mysql-test/r/count_distinct2.result | 4 +-- mysql-test/r/information_schema.result | 20 +++++++++++-- mysql-test/r/temp_table.result | 2 +- mysql-test/t/information_schema.test | 10 +++++++ sql/sql_class.h | 4 ++- sql/sql_select.cc | 41 +++++++++++++++++++++++--- sql/sql_show.cc | 1 + 7 files changed, 72 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/count_distinct2.result b/mysql-test/r/count_distinct2.result index f6b888dec3b..131e3b325ec 100644 --- a/mysql-test/r/count_distinct2.result +++ b/mysql-test/r/count_distinct2.result @@ -116,7 +116,7 @@ count(distinct n) 5000 show status like 'Created_tmp_disk_tables'; Variable_name Value -Created_tmp_disk_tables 2 +Created_tmp_disk_tables 1 drop table t1; create table t1 (s text); flush status; @@ -125,5 +125,5 @@ count(distinct s) 5000 show status like 'Created_tmp_disk_tables'; Variable_name Value -Created_tmp_disk_tables 2 +Created_tmp_disk_tables 1 drop table t1; diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index a201aa3ed63..121de940560 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -494,8 +494,8 @@ select TABLE_NAME,TABLE_TYPE,ENGINE from information_schema.tables where table_schema='information_schema' limit 2; TABLE_NAME TABLE_TYPE ENGINE -SCHEMATA TEMPORARY MyISAM -TABLES TEMPORARY MyISAM +SCHEMATA TEMPORARY MEMORY +TABLES TEMPORARY MEMORY show tables from information_schema like "T%"; Tables_in_information_schema (T%) TABLES @@ -615,3 +615,19 @@ CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; drop view a2, a1; drop table t_crashme; +select table_schema,table_name, column_name from +information_schema.columns +where data_type = 'longtext'; +table_schema table_name column_name +information_schema COLUMNS COLUMN_TYPE +information_schema ROUTINES ROUTINE_DEFINITION +information_schema ROUTINES SQL_MODE +information_schema VIEWS VIEW_DEFINITION +select table_name, column_name, data_type from information_schema.columns +where data_type = 'datetime'; +table_name column_name data_type +TABLES CREATE_TIME datetime +TABLES UPDATE_TIME datetime +TABLES CHECK_TIME datetime +ROUTINES CREATED datetime +ROUTINES LAST_ALTERED datetime diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 6e36f24d8b0..2dd58f54327 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -94,6 +94,6 @@ d 2002-10-24 14:50:40 show status like "created_tmp%tables"; Variable_name Value -Created_tmp_disk_tables 1 +Created_tmp_disk_tables 0 Created_tmp_tables 2 drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 99fbc181136..86d7bad76bc 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -390,3 +390,13 @@ while ($tab_count) --enable_query_log drop view a2, a1; drop table t_crashme; + +# +# Bug #7215 information_schema: columns are longtext instead of varchar +# Bug #7217 information_schema: columns are varbinary() instead of timestamp +# +select table_schema,table_name, column_name from +information_schema.columns +where data_type = 'longtext'; +select table_name, column_name, data_type from information_schema.columns +where data_type = 'datetime'; diff --git a/sql/sql_class.h b/sql/sql_class.h index d57eb3d3cc6..93aacd14753 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1613,10 +1613,12 @@ public: /* If >0 convert all blob fields to varchar(convert_blob_length) */ uint convert_blob_length; CHARSET_INFO *table_charset; + bool schema_table; TMP_TABLE_PARAM() :copy_field(0), group_parts(0), - group_length(0), group_null_parts(0), convert_blob_length(0) + group_length(0), group_null_parts(0), convert_blob_length(0), + schema_table(0) {} ~TMP_TABLE_PARAM() { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 91ced987f6a..f7ff9254f64 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7676,6 +7676,36 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, return new_field; } + +/* + Create field for information schema table + + SYNOPSIS + create_tmp_field_for_schema() + thd Thread handler + table Temporary table + item Item to create a field for + + RETURN + 0 on error + new_created field +*/ + +Field *create_tmp_field_for_schema(THD *thd, Item *item, TABLE *table) +{ + if (item->field_type() == MYSQL_TYPE_VARCHAR) + { + if (item->max_length > MAX_FIELD_VARCHARLENGTH / + item->collation.collation->mbmaxlen) + return new Field_blob(item->max_length, item->maybe_null, + item->name, table, item->collation.collation); + return new Field_varstring(item->max_length, item->maybe_null, item->name, + table, item->collation.collation); + } + return item->tmp_table_field_from_field_type(table); +} + + /* Create field for temporary table @@ -7978,10 +8008,13 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, We here distinguish between UNION and multi-table-updates by the fact that in the later case group is set to the row pointer. */ - Field *new_field= create_tmp_field(thd, table, item, type, ©_func, - tmp_from_field, group != 0, - not_all_columns || group !=0, - param->convert_blob_length); + Field *new_field= (param->schema_table) ? + create_tmp_field_for_schema(thd, item, table) : + create_tmp_field(thd, table, item, type, ©_func, + tmp_from_field, group != 0, + not_all_columns || group !=0, + param->convert_blob_length); + if (!new_field) { if (thd->is_fatal_error) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e95b20c29c9..8bf6f36ccdc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3017,6 +3017,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) tmp_table_param->init(); tmp_table_param->table_charset= cs; tmp_table_param->field_count= field_count; + tmp_table_param->schema_table= 1; SELECT_LEX *select_lex= thd->lex->current_select; if (!(table= create_tmp_table(thd, tmp_table_param, field_list, (ORDER*) 0, 0, 0, From ebce51950a9ccf44c2971c821ead87ce75b3acd8 Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Wed, 23 Feb 2005 14:19:48 +0200 Subject: [PATCH 05/14] Fixed Bug#Server crash due to 'flush status' in various tests. --- sql/log.cc | 4 ++-- sql/sql_class.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 5348ae795b5..a873d75def9 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2457,8 +2457,8 @@ void sql_print_information(const char *format, ...) static const char tc_log_magic[]={254, 0x23, 0x05, 0x74}; uint opt_tc_log_size=TC_LOG_MIN_SIZE; -uint tc_log_max_pages_used=0, tc_log_page_size=0, - tc_log_page_waits=0, tc_log_cur_pages_used=0; +ulong tc_log_max_pages_used=0, tc_log_page_size=0, + tc_log_page_waits=0, tc_log_cur_pages_used=0; int TC_LOG_MMAP::open(const char *opt_name) { diff --git a/sql/sql_class.h b/sql/sql_class.h index d57eb3d3cc6..8247c531504 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -46,9 +46,9 @@ extern const char **errmesg; #define TC_LOG_PAGE_SIZE 8192 #define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE) extern uint opt_tc_log_size; -extern uint tc_log_max_pages_used; -extern uint tc_log_page_size; -extern uint tc_log_page_waits; +extern ulong tc_log_max_pages_used; +extern ulong tc_log_page_size; +extern ulong tc_log_page_waits; #define TC_HEURISTIC_RECOVER_COMMIT 1 #define TC_HEURISTIC_RECOVER_ROLLBACK 2 From 99937c2b9194a50a5c175ab6cf50b0056836dd84 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Wed, 23 Feb 2005 16:28:10 +0400 Subject: [PATCH 06/14] config-win.h: Activate Unicode collations in Windows version. --- include/config-win.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/config-win.h b/include/config-win.h index 66a441ec339..472190e53ca 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -402,4 +402,5 @@ inline double ulonglong2double(ulonglong value) #define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_utf8 1 +#define HAVE_UCA_COLLATIONS 1 From 2b5ee94a332c5e97cdb8b642581ddb09743db8b2 Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Wed, 23 Feb 2005 18:15:45 +0300 Subject: [PATCH 07/14] Fix for bug#6317: string function CHAR, parameter is NULL, wrong result --- mysql-test/r/func_str.result | 6 ++++++ mysql-test/t/func_str.test | 6 ++++++ sql/item_strfunc.cc | 2 ++ 3 files changed, 14 insertions(+) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 88b1a5ea743..f238915d3b9 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -733,3 +733,9 @@ WHERE a = CONV('e251273eb74a8ee3', 16, 10); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; +SELECT CHAR(NULL,121,83,81,'76') as my_column; +my_column +ySQL +SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; +my_column +4 diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 6d5974ca5ed..b1f144cbca2 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -476,3 +476,9 @@ EXPLAIN WHERE a = CONV('e251273eb74a8ee3', 16, 10); DROP TABLE t1; + +# +# Bug #6317: string function CHAR, parameter is NULL, wrong result +# +SELECT CHAR(NULL,121,83,81,'76') as my_column; +SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 8bd1da4e15f..0023d7b1f20 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1868,6 +1868,7 @@ String *Item_func_char::val_str(String *str) { int32 num=(int32) args[i]->val_int(); if (!args[i]->null_value) + { #ifdef USE_MB if (use_mb(collation.collation)) { @@ -1883,6 +1884,7 @@ b1: str->append((char)(num>>8)); } #endif str->append((char)num); + } } str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) From 086c2a915a459bc7e2bb996c6e269304767b3004 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Wed, 23 Feb 2005 17:38:51 +0100 Subject: [PATCH 08/14] FIx for BUG#8682 "flush_block_commit test hangs on HPUX": start_waiting_global_read_lock() should wake up all those who are waiting for protect_against_global_read_lock to go down to 0: those registered in waiting_for_read_lock AND those registered in global_read_lock_blocks_commit. --- sql/lock.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/lock.cc b/sql/lock.cc index 7cfa2aebe7b..8f1cd080db7 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -715,7 +715,7 @@ static void print_lock_error(int error) least the first step above) global_read_lock_blocks_commit count of threads which have the global read lock and block - commits (i.e. have completed the second step above) + commits (i.e. are in or have completed the second step above) waiting_for_read_lock count of threads which want to take a global read lock but cannot protect_against_global_read_lock @@ -886,7 +886,8 @@ void start_waiting_global_read_lock(THD *thd) if (unlikely(thd->global_read_lock)) DBUG_VOID_RETURN; (void) pthread_mutex_lock(&LOCK_open); - tmp= (!--protect_against_global_read_lock && waiting_for_read_lock); + tmp= (!--protect_against_global_read_lock && + (waiting_for_read_lock || global_read_lock_blocks_commit)); (void) pthread_mutex_unlock(&LOCK_open); if (tmp) pthread_cond_broadcast(&COND_refresh); From 6e9b26e8b75422959b48c673b5f6abeae7fa69ad Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Wed, 23 Feb 2005 18:59:54 +0200 Subject: [PATCH 09/14] Fixed a compatibility problem. 1) If my.cnf is found in datadir and basedir, give a warning and use the one in basedir. 2) If my.cnf is found in datadir, use it, but give a warning. 3) No warning if my.cnf is in basedir. --- scripts/mysqld_safe.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index a8615ff2113..e38127ffd8e 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -128,15 +128,28 @@ then else MY_BASEDIR_VERSION=@prefix@ DATADIR=@localstatedir@ - if test -z "$MYSQL_HOME" - then - MYSQL_HOME=$DATADIR # Installation in a not common path - fi ledir=@libexecdir@ fi + if test -z "$MYSQL_HOME" then - MYSQL_HOME=$MY_BASEDIR_VERSION + if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf" + then + echo "WARNING: Found two instances of my.cnf -" + echo "$MY_BASEDIR_VERSION/my.cnf and" + echo "$DATADIR/my.cnf" + echo "IGNORING $DATADIR/my.cnf" + echo + MYSQL_HOME=$MY_BASEDIR_VERSION + elif test -r "$DATADIR/my.cnf" + then + echo "WARNING: Found $DATADIR/my.cnf" + echo "Datadir is deprecated place for my.cnf, please move it to $MY_BASEDIR_VERSION" + echo + MYSQL_HOME=$DATADIR + else + MYSQL_HOME=$MY_BASEDIR_VERSION + fi fi export MYSQL_HOME From fc9c20995f63b55db430c812b6296c25b68f8a2b Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Wed, 23 Feb 2005 20:18:21 +0300 Subject: [PATCH 10/14] Fix for bug #6572: SHOW ERRORS doesn't --- mysql-test/r/warnings.result | 27 +++++++++++++++++++++++++++ mysql-test/t/warnings.test | 13 +++++++++++++ sql/protocol.cc | 6 ++++++ 3 files changed, 46 insertions(+) diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index d883feb7ce2..e03d72351d1 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -1,6 +1,33 @@ drop table if exists t1, t2; SET SQL_WARNINGS=1; create table t1 (a int); +create table t1 (a int); +ERROR 42S01: Table 't1' already exists +show count(*) errors; +@@session.error_count +1 +show errors; +Level Code Message +Error 1050 Table 't1' already exists +show warnings; +Level Code Message +Error 1050 Table 't1' already exists +create table t2(a int) default charset qwerty; +ERROR 42000: Unknown character set: 'qwerty' +show count(*) errors; +@@session.error_count +1 +show errors; +Level Code Message +Error 1115 Unknown character set: 'qwerty' +create table t (i); +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 +show count(*) errors; +@@session.error_count +1 +show errors; +Level Code Message +Error 1064 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 insert into t1 values (1); insert into t1 values ("hej"); Warnings: diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 4bd659606f6..23ab5aa1f05 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -7,6 +7,19 @@ drop table if exists t1, t2; SET SQL_WARNINGS=1; create table t1 (a int); +--error 1050 +create table t1 (a int); +show count(*) errors; +show errors; +show warnings; +--error 1115 +create table t2(a int) default charset qwerty; +show count(*) errors; +show errors; +--error 1064 +create table t (i); +show count(*) errors; +show errors; insert into t1 values (1); insert into t1 values ("hej"); insert into t1 values ("hej"),("dЕ"); diff --git a/sql/protocol.cc b/sql/protocol.cc index 95cd8415c85..4cecd016553 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -58,6 +58,7 @@ void send_error(THD *thd, uint sql_errno, const char *err) uint length; char buff[MYSQL_ERRMSG_SIZE+2], *pos; #endif + const char *orig_err= err; NET *net= &thd->net; DBUG_ENTER("send_error"); DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, @@ -82,6 +83,7 @@ void send_error(THD *thd, uint sql_errno, const char *err) err=ER(sql_errno); /* purecov: inspected */ } } + orig_err= err; } #ifdef EMBEDDED_LIBRARY @@ -120,6 +122,8 @@ void send_error(THD *thd, uint sql_errno, const char *err) } VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length)); #endif /* EMBEDDED_LIBRARY*/ + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, sql_errno, + orig_err ? orig_err : ER(sql_errno)); thd->is_fatal_error=0; // Error message is given thd->net.report_error= 0; @@ -247,6 +251,8 @@ net_printf(THD *thd, uint errcode, ...) strmake(net->last_error, text_pos, length); strmake(net->sqlstate, mysql_errno_to_sqlstate(errcode), SQLSTATE_LENGTH); #endif + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, errcode, + text_pos ? text_pos : ER(errcode)); thd->is_fatal_error=0; // Error message is given DBUG_VOID_RETURN; } From 66daa0d2bd5b8d07abac79c15d7ab12cad1f403a Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Wed, 23 Feb 2005 18:58:49 +0100 Subject: [PATCH 11/14] log_event.cc: cast sql_mode to ulonglong before int8store, otherwise the implementation of int8store based on >> complains that we do 32-bit var >> 32 which is undefined according to C standard. (compiler warning appeared on SGI Irix) --- sql/log_event.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 75d682fa6cd..bbf894c2385 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1029,7 +1029,7 @@ bool Query_log_event::write(IO_CACHE* file) if (sql_mode_inited) { *(start++)= Q_SQL_MODE_CODE; - int8store(start, sql_mode); + int8store(start, (ulonglong)sql_mode); start+= 8; } if (catalog_len >= 0) // i.e. "catalog inited" (false for 4.0 events) From 69fb5af28a11c065a1b0d25b9fb966a75274b255 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Wed, 23 Feb 2005 19:18:14 +0100 Subject: [PATCH 12/14] mysqlbinlog: safety measures (safe setting for completion_type, auto-end-rollback in case crashed binlog) which cannot hurt. --- client/mysqlbinlog.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 7c682f402eb..f564ee31fed 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1249,6 +1249,14 @@ int main(int argc, char** argv) fprintf(result_file, "/*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;\n"); + /* + In mysqlbinlog|mysql, don't want mysql to be disconnected after each + transaction (which would be the case with GLOBAL.COMPLETION_TYPE==2). + */ + fprintf(result_file, + "/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE," + "COMPLETION_TYPE=0*/;\n"); + for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ; (--argc >= 0) && !stop_passed ; ) { @@ -1263,6 +1271,13 @@ int main(int argc, char** argv) start_position= BIN_LOG_HEADER_SIZE; } + /* + Issue a ROLLBACK in case the last printed binlog was crashed and had half + of transaction. + */ + fprintf(result_file, + "ROLLBACK;\n" + "/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n"); if (disable_log_bin) fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n"); From 5d534812d5fb20665c60143ff855a6b90ee6c5f4 Mon Sep 17 00:00:00 2001 From: "timour@mysql.com" <> Date: Wed, 23 Feb 2005 20:49:47 +0200 Subject: [PATCH 13/14] Fix for BUG#8576 This fix addresses a bug of the HPUX C++ compiler, in the way it uses registers. As result, the last comparison of the variable 'result' failed, and next_prefix() looped forever. --- sql/opt_range.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0418225965a..ecf255b091d 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7467,7 +7467,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, double quick_prefix_selectivity; double io_cost; double cpu_cost= 0; /* TODO: CPU cost of index_read calls? */ - DBUG_ENTER("TRP_GROUP_MIN_MAX::cost"); + DBUG_ENTER("cost_group_min_max"); table_records= table->file->records; keys_per_block= (table->file->block_size / 2 / @@ -7971,7 +7971,15 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next() { int min_res= 0; int max_res= 0; +#ifdef HPUX11 + /* + volatile is required by a bug in the HP compiler due to which the + last test of result fails. + */ + volatile int result; +#else int result; +#endif int is_last_prefix; DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::get_next"); From 624aaa4b098fa6736d837fbce36afbffd04612ba Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Wed, 23 Feb 2005 19:59:25 +0100 Subject: [PATCH 14/14] result fixes after my change to mysqlbinlog (which was accidentally pushed some minutes ago) --- mysql-test/r/ctype_ucs.result | 3 ++ mysql-test/r/mysqlbinlog.result | 30 +++++++++++++ mysql-test/r/mysqlbinlog2.result | 75 ++++++++++++++++++++++++++++++++ mysql-test/r/rpl_charset.result | 3 ++ mysql-test/r/user_var.result | 3 ++ 5 files changed, 114 insertions(+) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 8cbd4d58192..78672c7fd7b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -528,6 +528,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 96 User var 1 136 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci master-bin.000001 136 Query 1 226 use `test`; insert into t2 values (@v) /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`; use test; @@ -536,6 +537,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t2 values (@v); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; drop table t2; set names latin1; create table t1 (a enum('x','y','z') character set ucs2); diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index df117479814..6fb2f7f2fb4 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -15,6 +15,7 @@ flush logs; --- Local -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1000000000; @@ -36,32 +37,44 @@ LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-0' INTO TABLE `t1` FI LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Broken LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values ("Alas"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- --database -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=1; +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- --position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values ("Alas"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Remote -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1000000000; @@ -83,42 +96,59 @@ LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-1' INTO TABLE `t1` FI LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Broken LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values ("Alas"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- --database -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=1; +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- --position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values ("Alas"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- reading stdin -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1108844556; BEGIN; SET TIMESTAMP=1108844555; insert t1 values (1); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; use test; SET TIMESTAMP=1108844556; BEGIN; SET TIMESTAMP=1108844555; insert t1 values (1); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; drop table t1, t2; diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result index 8fdaa5bed4e..9899fa54301 100644 --- a/mysql-test/r/mysqlbinlog2.result +++ b/mysql-test/r/mysqlbinlog2.result @@ -16,6 +16,7 @@ insert into t1 values(null, "f"); --- Local -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -38,9 +39,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=1; use test; @@ -61,9 +65,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; SET INSERT_ID=4; use test; SET TIMESTAMP=1579609946; @@ -74,9 +81,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -93,9 +103,12 @@ insert into t1 values(null, "b"); SET INSERT_ID=3; SET TIMESTAMP=1579609944; insert into t1 values(null, "c"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=3; use test; @@ -110,9 +123,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -126,9 +142,12 @@ insert into t1 values(null, "a"); SET INSERT_ID=2; SET TIMESTAMP=1579609942; insert into t1 values(null, "b"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Local with 2 binlogs on command line -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -158,9 +177,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=1; use test; @@ -188,9 +210,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; SET INSERT_ID=4; use test; SET TIMESTAMP=1579609946; @@ -208,9 +233,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -234,9 +262,12 @@ SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); SET INSERT_ID=6; +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=3; use test; @@ -258,9 +289,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -274,9 +308,12 @@ insert into t1 values(null, "a"); SET INSERT_ID=2; SET TIMESTAMP=1579609942; insert into t1 values(null, "b"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Remote -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -299,9 +336,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=1; use test; @@ -322,9 +362,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; SET INSERT_ID=4; use test; SET TIMESTAMP=1579609946; @@ -335,9 +378,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -354,9 +400,12 @@ insert into t1 values(null, "b"); SET INSERT_ID=3; SET TIMESTAMP=1579609944; insert into t1 values(null, "c"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=3; use test; @@ -371,9 +420,12 @@ insert into t1 values(null, "d"); SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -387,9 +439,12 @@ insert into t1 values(null, "a"); SET INSERT_ID=2; SET TIMESTAMP=1579609942; insert into t1 values(null, "b"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Remote with 2 binlogs on command line -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -419,9 +474,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=1; use test; @@ -449,9 +507,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; SET INSERT_ID=4; use test; SET TIMESTAMP=1579609946; @@ -469,9 +530,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -495,9 +559,12 @@ SET INSERT_ID=5; SET TIMESTAMP=1579609946; insert into t1 values(null, "e"); SET INSERT_ID=6; +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET INSERT_ID=3; use test; @@ -519,9 +586,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -535,9 +605,12 @@ insert into t1 values(null, "a"); SET INSERT_ID=2; SET TIMESTAMP=1579609942; insert into t1 values(null, "b"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- to-last-log -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; use test; SET TIMESTAMP=1579609942; @@ -563,6 +636,8 @@ insert into t1 values(null, "e"); SET INSERT_ID=6; SET TIMESTAMP=1579609943; insert into t1 values(null, "f"); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- end of test -- drop table t1; diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index 98a8c53d5fd..ce958c15ece 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -175,6 +175,7 @@ select hex(c1), hex(c2) from t1; hex(c1) hex(c2) CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET TIMESTAMP=1000000000; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; @@ -245,6 +246,8 @@ CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255)); SET TIMESTAMP=1000000000; SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30; INSERT INTO t1 (c1, c2) VALUES ('Ну, за рыбалку','Ну, за рыбалку'); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; drop table t1; create table `t1` ( `pk` varchar(10) not null default '', diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 8ae1d145227..4bc85a10638 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -184,6 +184,7 @@ master-bin.000001 230 User var 1 272 @`var1`=_latin1 0x273B616161 COLLATE latin1 master-bin.000001 272 User var 1 310 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci master-bin.000001 310 Query 1 411 use `test`; insert into t1 values (@var1),(@var2) /*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; ROLLBACK; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`; use test; @@ -196,6 +197,8 @@ SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`; SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`; SET TIMESTAMP=10000; insert into t1 values (@var1),(@var2); +ROLLBACK; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; drop table t1; set @var= NULL ; select FIELD( @var,'1it','Hit') as my_column;