From 4352b9953a334e70ecff8f6e71a513d9fa95c40e Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Thu, 27 Feb 2003 22:26:09 +0200 Subject: [PATCH 01/23] fixed SQL_SELECT option with UNIONs --- mysql-test/r/query_cache.result | 11 ++++++++--- mysql-test/t/query_cache.test | 5 +++-- sql/sql_cache.cc | 2 +- sql/sql_yacc.yy | 5 ++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 41fccc2743c..74dee666e05 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -237,13 +237,18 @@ a show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -select sql_cache * from t1; +select sql_cache * from t1 union select * from t1; a 1 2 3 set query_cache_type=2; -select sql_cache * from t1; +select sql_cache * from t1 union select * from t1; +a +1 +2 +3 +select * from t1 union select sql_cache * from t1; a 1 2 @@ -253,7 +258,7 @@ Variable_name Value Qcache_hits 4 show status like "Qcache_queries_in_cache"; Variable_name Value -Qcache_queries_in_cache 1 +Qcache_queries_in_cache 2 set query_cache_type=on; reset query cache; show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index dd092866e44..83c11978436 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -144,9 +144,10 @@ create table t1 (a int not null); insert into t1 values (1),(2),(3); select * from t1; show status like "Qcache_queries_in_cache"; -select sql_cache * from t1; +select sql_cache * from t1 union select * from t1; set query_cache_type=2; -select sql_cache * from t1; +select sql_cache * from t1 union select * from t1; +select * from t1 union select sql_cache * from t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; set query_cache_type=on; diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 64c62345182..ee62d7b16ed 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2439,7 +2439,7 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, if (lex->sql_command == SQLCOM_SELECT && (thd->variables.query_cache_type == 1 || - (thd->variables.query_cache_type == 2 && (lex->select->options & + (thd->variables.query_cache_type == 2 && (lex->select_lex.options & OPTION_TO_QUERY_CACHE))) && thd->safe_to_cache_query) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2f339f30eb4..0879995e733 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1530,7 +1530,10 @@ select_option: Select->options|= OPTION_FOUND_ROWS; } | SQL_NO_CACHE_SYM { current_thd->safe_to_cache_query=0; } - | SQL_CACHE_SYM { Select->options|= OPTION_TO_QUERY_CACHE; } + | SQL_CACHE_SYM + { + Lex->select_lex.options|= OPTION_TO_QUERY_CACHE; + } | ALL {} ; From 45e3de8f32d40986ba6755adba6856cc71bd086d Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Wed, 19 Mar 2003 15:16:51 +0100 Subject: [PATCH 02/23] Do not silently do RESET MASTER when one does 'mysqldump --master-data' ; only do it if the user specifies --delete-master-logs (new option). Safer + fixes bug #159. --- BitKeeper/etc/logging_ok | 1 + client/client_priv.h | 3 ++- client/mysqldump.c | 25 +++++++++++++++++-------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 3f58a7aea48..a6699f7c515 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -5,6 +5,7 @@ bar@bar.mysql.r18.ru bar@bar.udmsearch.izhnet.ru bell@sanja.is.com.ua bk@admin.bk +guilhem@mysql.com heikki@donna.mysql.fi heikki@hundin.mysql.fi jani@hynda.mysql.fi diff --git a/client/client_priv.h b/client/client_priv.h index 56eaf311070..147670005f2 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -30,4 +30,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, - OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE}; + OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE, + OPT_DELETE_MASTER_LOGS}; diff --git a/client/mysqldump.c b/client/mysqldump.c index d7d54a13c57..34f01e1581b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -73,7 +73,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0, opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0, opt_alldbs=0,opt_create_db=0,opt_first_slave=0, - opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0; + opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0, + opt_delete_master_logs=0; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, @@ -101,6 +102,7 @@ static struct option long_options[] = {"debug", optional_argument, 0, '#'}, {"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET}, {"delayed-insert", no_argument, 0, OPT_DELAYED}, + {"delete-master-logs", no_argument, 0, OPT_DELETE_MASTER_LOGS}, {"disable-keys", no_argument, 0, 'K'}, {"extended-insert", no_argument, 0, 'e'}, {"fields-terminated-by", required_argument, 0, (int) OPT_FTB}, @@ -206,9 +208,12 @@ static void usage(void) --add-locks Add locks around insert statements.\n\ --allow-keywords Allow creation of column names that are keywords.\n\ --delayed-insert Insert rows with INSERT DELAYED.\n\ + --delete-master-logs Issue RESET MASTER on the master just after taking\n\ + the dump, and before unlocking tables.\n\ + This will automatically enable --first-slave.\n\ --master-data This will cause the master position and filename to \n\ - be appended to your output. This will automagically \n\ - enable --first-slave.\n\ + be appended to your output, before unlocking tables.\n\ + This will automatically enable --first-slave.\n\ -F, --flush-logs Flush logs file in server before starting dump.\n\ -f, --force Continue even if we get an sql-error.\n\ -h, --host=... Connect to host.\n"); @@ -317,6 +322,10 @@ static int get_options(int *argc,char ***argv) opt_master_data=1; opt_first_slave=1; break; + case OPT_DELETE_MASTER_LOGS: + opt_delete_master_logs=1; + opt_first_slave=1; + break; case OPT_AUTOCOMMIT: opt_autocommit=1; break; @@ -1489,6 +1498,11 @@ int main(int argc, char **argv) if (opt_first_slave) { + if (opt_delete_master_logs && mysql_query(sock, "FLUSH MASTER")) + { + my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s", + MYF(0), mysql_error(sock)); + } if (opt_master_data) { if (mysql_query(sock, "SHOW MASTER STATUS") || @@ -1511,11 +1525,6 @@ int main(int argc, char **argv) mysql_free_result(master); } } - if (mysql_query(sock, "FLUSH MASTER")) - { - my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s", - MYF(0), mysql_error(sock)); - } if (mysql_query(sock, "UNLOCK TABLES")) { my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s", From 8b5ce819db3c8f5e74f5241157a5f3ecf8f7c0c3 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Mon, 24 Mar 2003 23:24:45 +0200 Subject: [PATCH 03/23] Fixed bug that binary log was not locked during a DELETE FROM TABLE_NAME; --- sql/sql_delete.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 278e98533c9..2372e908152 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -30,6 +30,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) char path[FN_REFLEN]; int error; TABLE **table_ptr; + my_bool lock_open_locked= 0; DBUG_ENTER("generate_table"); thd->proc_info="generate_table"; @@ -102,7 +103,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) error= ha_create_table(path,&create_info,1) ? -1 : 0; if (thd->locked_tables && reopen_tables(thd,1,0)) error= -1; - VOID(pthread_mutex_unlock(&LOCK_open)); + lock_open_locked= 1; // Unlock mutex before return } if (!error) { @@ -114,6 +115,8 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) } send_ok(&thd->net); // This should return record count } + if (lock_open_locked) + VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(error ? -1 : 0); } From a496daf777c64a3bfdd89ea084023c6c40e15460 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Tue, 25 Mar 2003 14:49:43 +0200 Subject: [PATCH 04/23] A fix for a bug in MyISAM with large number of NULL columns and at least one BLOB column. --- myisam/mi_dynrec.c | 4 ++-- mysql-test/t/myisam.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index c9fe493744d..4f321c268f1 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -62,8 +62,8 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ MI_DYN_DELETE_BLOCK_HEADER+1; - reclength=info->s->base.pack_reclength+ - _my_calc_total_blob_length(info,record)+ extra; + reclength= (info->s->base.pack_reclength+ info->s->base.pack_bits+ + _my_calc_total_blob_length(info,record)+ extra); if (reclength > MI_DYN_MAX_ROW_LENGTH) { my_errno=HA_ERR_TO_BIG_ROW; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 92f22d35b81..c9cb77d2a3a 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -244,7 +244,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 -int, i999 int, i1000 int) row_format=dynamic; +int, i999 int, i1000 int, b blob) row_format=dynamic; insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -283,6 +283,6 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei"); drop table if exists t1; From e1173e70a54d30ae83c676250e825921322efe32 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Tue, 25 Mar 2003 19:57:38 -0400 Subject: [PATCH 05/23] fix bug with parameters of LOAD DATA INFILE in exec_event --- BitKeeper/etc/logging_ok | 1 + sql/log_event.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 70aaa8d2a52..9d0489e34f8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -90,6 +90,7 @@ tonu@volk.internalnet tonu@x153.internalnet tonu@x3.internalnet venu@work.mysql.com +vva@eagle.mysql.r18.ru vva@genie.(none) walrus@kishkin.ru walrus@mysql.com diff --git a/sql/log_event.cc b/sql/log_event.cc index e243a953c63..51d9bd74adc 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1858,6 +1858,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, String line_term(sql_ex.line_term,sql_ex.line_term_len); String line_start(sql_ex.line_start,sql_ex.line_start_len); String escaped(sql_ex.escaped,sql_ex.escaped_len); + ex.field_term= &field_term; + ex.enclosed= &enclosed; + ex.line_term= &line_term; + ex.line_start= &line_start; + ex.escaped= &escaped; ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG); if (sql_ex.empty_flags & FIELD_TERM_EMPTY) From 4d87fd034621da8a5ba192d88384c7df12ec378a Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Mon, 31 Mar 2003 09:49:09 +0300 Subject: [PATCH 06/23] fixed bug 209 (SQL_SELECT_LIMIT and query cache incompatibility) --- mysql-test/r/query_cache.result | 18 ++++++++++++++++++ mysql-test/t/query_cache.test | 17 ++++++++++++++--- sql/sql_cache.cc | 25 +++++++++++++++---------- sql/sql_parse.cc | 3 ++- 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 936bbf30006..a55e05578e0 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -581,3 +581,21 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 drop table t1; +create table t1 (a int); +insert into t1 values (1),(2); +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 +select * from t1; +a +1 +2 +SET OPTION SQL_SELECT_LIMIT=1; +select * from t1; +a +1 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 2 +SET OPTION SQL_SELECT_LIMIT=DEFAULT; +drop table t1; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 23950ce9caa..33f226f9253 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -401,7 +401,6 @@ select * from t1 where id=2; # # Load data invalidation test # - create table t1 (word char(20) not null); select * from t1; show status like "Qcache_queries_in_cache"; @@ -412,7 +411,6 @@ drop table t1; # # INTO OUTFILE/DUMPFILE test # - drop table if exists t1; create table t1 (a int); insert into t1 values (1),(2),(3); @@ -420,4 +418,17 @@ show status like "Qcache_queries_in_cache"; select * from t1 into outfile "query_caceh.out.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file"; show status like "Qcache_queries_in_cache"; -drop table t1; \ No newline at end of file +drop table t1; + +# +# test of SQL_SELECT_LIMIT +# +create table t1 (a int); +insert into t1 values (1),(2); +show status like "Qcache_queries_in_cache"; +select * from t1; +SET OPTION SQL_SELECT_LIMIT=1; +select * from t1; +show status like "Qcache_queries_in_cache"; +SET OPTION SQL_SELECT_LIMIT=DEFAULT; +drop table t1; diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index ee62d7b16ed..59430d6a486 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -743,11 +743,11 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) if (query_cache_size == 0) DBUG_VOID_RETURN; - if ((local_tables = is_cacheable(thd, thd->query_length, + if ((local_tables= is_cacheable(thd, thd->query_length, thd->query, &thd->lex, tables_used))) { - NET *net = &thd->net; - byte flags = (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0); + NET *net= &thd->net; + byte flags= (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0); STRUCT_LOCK(&structure_guard_mutex); if (query_cache_size == 0) @@ -775,8 +775,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) flags|= (byte) thd->variables.convert_set->number(); DBUG_ASSERT(thd->variables.convert_set->number() < 128); } - tot_length=thd->query_length+thd->db_length+2; - thd->query[tot_length-1] = (char) flags; + tot_length= thd->query_length+thd->db_length+2+sizeof(ha_rows); + thd->query[tot_length-1]= (char) flags; + memcpy((void *)(thd->query + (tot_length-sizeof(ha_rows)-1)), + (const void *)&thd->variables.select_limit, sizeof(ha_rows)); /* Check if another thread is processing the same query? */ Query_cache_block *competitor = (Query_cache_block *) @@ -910,7 +912,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) } Query_cache_block *query_block; - tot_length=query_length+thd->db_length+2; + tot_length= query_length+thd->db_length+2+sizeof(ha_rows); if (thd->db_length) { memcpy(sql+query_length+1, thd->db, thd->db_length); @@ -926,15 +928,18 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) Most significant bit - CLIENT_LONG_FLAG, Other - charset number (0 no charset convertion) */ - flags = (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0); + flags= (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0); if (thd->variables.convert_set != 0) { - flags |= (byte) thd->variables.convert_set->number(); + flags|= (byte) thd->variables.convert_set->number(); DBUG_ASSERT(thd->variables.convert_set->number() < 128); } - sql[tot_length-1] = (char) flags; - query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql, + sql[tot_length-1]= (char) flags; + memcpy((void *)(sql + (tot_length-sizeof(ha_rows)-1)), + (const void *)&thd->variables.select_limit, sizeof(ha_rows)); + query_block= (Query_cache_block *) hash_search(&queries, (byte*) sql, tot_length); + /* Quick abort on unlocked data */ if (query_block == 0 || query_block->query()->result() == 0 || diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1bb1fd9d39a..9e222c4f944 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1029,7 +1029,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, /* We must allocate some extra memory for query cache */ if (!(thd->query= (char*) thd->memdup_w_gap((gptr) (packet), packet_length, - thd->db_length+2))) + thd->db_length+2+ + sizeof(ha_rows)))) break; thd->query[packet_length]=0; thd->packet.shrink(thd->variables.net_buffer_length);// Reclaim some memory From 1211b9a513df1b17198235375770a0ddf585a789 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 1 Apr 2003 18:19:15 +0200 Subject: [PATCH 07/23] Small-and-safe fix for bug #218: "LOAD DATA INFILE IGNORE is well logged, but read as LOAD DATA INFILE REPLACE" This was just bad && instead of &, but nasty consequences. This should be merged to 4.0 BUT it will not be automatic (some code has moved from log_event.h to log_event.cc, and log_event.cc has changed); please Merging Man, do 'bk grep REPLACE_FLAG' in 4.0/sql to find all the new places. --- sql/log_event.cc | 6 +++--- sql/slave.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index c30d03adaf5..7c4c893a823 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -671,9 +671,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) fprintf(file, "LOAD DATA INFILE '%s' ", fname); - if(sql_ex.opt_flags && REPLACE_FLAG ) + if(sql_ex.opt_flags & REPLACE_FLAG ) fprintf(file," REPLACE "); - else if(sql_ex.opt_flags && IGNORE_FLAG ) + else if(sql_ex.opt_flags & IGNORE_FLAG ) fprintf(file," IGNORE "); fprintf(file, "INTO TABLE %s ", table_name); @@ -685,7 +685,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) if(!(sql_ex.empty_flags & ENCLOSED_EMPTY)) { - if(sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) + if(sql_ex.opt_flags & OPT_ENCLOSED_FLAG ) fprintf(file," OPTIONALLY "); fprintf(file, " ENCLOSED BY "); pretty_print_char(file, sql_ex.enclosed); diff --git a/sql/slave.cc b/sql/slave.cc index 358a908e0cc..ac65bd2bdc3 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1100,9 +1100,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) else { enum enum_duplicates handle_dup = DUP_IGNORE; - if(lev->sql_ex.opt_flags && REPLACE_FLAG) + if(lev->sql_ex.opt_flags & REPLACE_FLAG) handle_dup = DUP_REPLACE; - sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && + sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags & DUMPFILE_FLAG ); String field_term(&lev->sql_ex.field_term, 1), enclosed(&lev->sql_ex.enclosed, 1), From 4824d6c66c62e0803df5d0dc00c4d8b9c76cdf02 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 1 Apr 2003 22:49:40 +0200 Subject: [PATCH 08/23] Sprint task #856 : make table exclusion rules (in replication) apply to GRANT and REVOKE too. For example if replicate-wild-ignore-table=mysql.%, GRANT and REVOKE will not be replicated on the slave. --- sql/sql_acl.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ee9d3f1c1ea..e8cbba8aefa 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -28,6 +28,9 @@ #include "mysql_priv.h" #include "sql_acl.h" #include "hash_filo.h" +#ifdef HAVE_REPLICATION +#include "sql_repl.h" //for tables_ok() +#endif #include #include #include @@ -2052,6 +2055,15 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE; tables[0].db=tables[1].db=tables[2].db=(char*) "mysql"; +#ifdef HAVE_REPLICATION + /* + GRANT and REVOKE are applied the slave in/exclusion rules as they are + some kind of updates to the mysql.% tables. + */ + if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) + DBUG_RETURN(0); +#endif + if (open_and_lock_tables(thd,tables)) { // Should never happen close_thread_tables(thd); /* purecov: deadcode */ @@ -2214,6 +2226,16 @@ int mysql_grant (THD *thd, const char *db, List &list, tables[0].lock_type=tables[1].lock_type=TL_WRITE; tables[0].db=tables[1].db=(char*) "mysql"; tables[0].table=tables[1].table=0; + +#ifdef HAVE_REPLICATION + /* + GRANT and REVOKE are applied the slave in/exclusion rules as they are + some kind of updates to the mysql.% tables. + */ + if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) + DBUG_RETURN(0); +#endif + if (open_and_lock_tables(thd,tables)) { // This should never happen close_thread_tables(thd); /* purecov: deadcode */ From c1ff07cbb9de0d9eef3a58522283515ee77b0b18 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Thu, 3 Apr 2003 11:29:10 +0300 Subject: [PATCH 09/23] Safer stack checking --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c407fccf00b..bc5334ce674 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2105,7 +2105,7 @@ int main(int argc, char **argv) size_t stack_size= 0; pthread_attr_getstacksize(&connection_attrib, &stack_size); /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ - if (stack_size && stack_size != thread_stack) + if (stack_size && stack_size < thread_stack) { if (global_system_variables.log_warnings) sql_print_error("Warning: Asked for %ld thread stack, but got %ld", From 3cdc8ae55b4fd0d711b9784897e3c4a1481ccb04 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Thu, 3 Apr 2003 12:10:38 +0300 Subject: [PATCH 10/23] Portability fix (for AMD hammer) --- sql/log.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/log.cc b/sql/log.cc index 5e5d5b9368e..f72917427b7 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1067,6 +1067,7 @@ void sql_print_error(const char *format,...) char buff[1024]; my_vsnprintf(buff,sizeof(buff)-1,format,args); DBUG_PRINT("error",("%s",buff)); + va_start(args,format); } #endif skr=time(NULL); From e96c75fec073db2ef9af59c01634551ed9ea5fd4 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Thu, 3 Apr 2003 13:07:42 +0300 Subject: [PATCH 11/23] Fixed bug in memory allocation that could affect 64 bit systems (affected hammer) --- mysys/my_vsnprintf.c | 9 ++++++++- sql/ha_myisam.cc | 2 +- sql/log.cc | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c index ab8edec4d7b..9bc33e28ba1 100644 --- a/mysys/my_vsnprintf.c +++ b/mysys/my_vsnprintf.c @@ -21,13 +21,18 @@ #include #include + int my_snprintf(char* to, size_t n, const char* fmt, ...) { + int result; va_list args; va_start(args,fmt); - return my_vsnprintf(to, n, fmt, args); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; } + int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; @@ -79,6 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) return (uint) (to - start); } + #ifdef MAIN static void my_printf(const char * fmt, ...) { @@ -92,6 +98,7 @@ static void my_printf(const char * fmt, ...) va_end(ar); } + int main() { diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 895558320fd..d0d68156bac 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -953,7 +953,7 @@ int ha_myisam::create(const char *name, register TABLE *form, &keydef, form->keys*sizeof(MI_KEYDEF), &keyseg, ((form->key_parts + form->keys) * sizeof(MI_KEYSEG)), - 0))) + NullS))) DBUG_RETURN(1); pos=form->key_info; diff --git a/sql/log.cc b/sql/log.cc index f72917427b7..d189f1f1fe3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1067,6 +1067,7 @@ void sql_print_error(const char *format,...) char buff[1024]; my_vsnprintf(buff,sizeof(buff)-1,format,args); DBUG_PRINT("error",("%s",buff)); + va_end(args); va_start(args,format); } #endif From 957834795e3e4f858d1b7b458dd1f35b64278d56 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Thu, 3 Apr 2003 13:21:39 +0300 Subject: [PATCH 12/23] Updated results after merge --- mysql-test/r/myisam.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3a3558eedcb..9a653aff99e 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -246,7 +246,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 -int, i999 int, i1000 int) row_format=dynamic; +int, i999 int, i1000 int, b blob) row_format=dynamic; insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -285,7 +285,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei"); drop table if exists t1; CREATE TABLE `t1` ( `post_id` mediumint(8) unsigned NOT NULL auto_increment, From 14d961a033be864c292f0b0a3e10c8817d7cc9b8 Mon Sep 17 00:00:00 2001 From: "walrus@mysql.com" <> Date: Thu, 3 Apr 2003 21:51:14 +0600 Subject: [PATCH 13/23] test-transactions.sh: correct misprint in the test_update --- sql-bench/test-transactions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-bench/test-transactions.sh b/sql-bench/test-transactions.sh index b081b89fb69..8f92633524f 100644 --- a/sql-bench/test-transactions.sh +++ b/sql-bench/test-transactions.sh @@ -252,7 +252,7 @@ sub test_update for ($id=0 ; $id < $opt_loop_count ; $id++) { - do_query($dbh,"update bench1 set updated=1 where idn=$id"); + do_query($dbh,"update $table set updated=1 where idn=$id"); } $dbh->commit if (!$auto_commit); From f45be5e6cd0978444e274c48b7b9bac7a781dc03 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Thu, 3 Apr 2003 12:54:08 -0400 Subject: [PATCH 14/23] added test for replication load data into temporary table with additional options --- mysql-test/r/rpl_loaddata.result | 11 +++++++++++ mysql-test/t/rpl_loaddata.test | 20 +++++++++++++++++++- sql/log_event.cc | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index 27f3d185f63..c1518e8e29a 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -6,8 +6,19 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; slave start; create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; +create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines; +create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +insert into t3 select * from t2; select * from t1; a b 1 10 2 15 +select * from t3; +day id category name +2003-02-22 2461 b a a a @ %  ' " a +2003-03-22 2161 c asdf +2003-04-22 2416 a bbbbb drop table t1; +drop table t2; +drop table t3; diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index d7fc2a10ca4..2acb67dfce2 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -1,16 +1,34 @@ # See if replication of a "LOAD DATA in an autoincrement column" # Honours autoincrement values # i.e. if the master and slave have the same sequence +# +# check replication of load data for temporary tables with additional parameters +# source include/master-slave.inc; create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; + +create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +#load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionaly enclosed by '%' escaped by '@' lines terminated by '\n%%\n' ignore 1 lines; + load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines; + +create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +insert into t3 select * from t2; + save_master_pos; connection slave; sync_with_master; -select * from t1; + +select * from t1; +select * from t3; + connection master; + drop table t1; +drop table t2; +drop table t3; + save_master_pos; connection slave; sync_with_master; diff --git a/sql/log_event.cc b/sql/log_event.cc index bb885ead3df..c8eb4026120 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1881,7 +1881,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ex.skip_lines = skip_lines; List field_list; set_fields(field_list); - thd->slave_proxy_id = thd->thread_id; + thd->slave_proxy_id = thread_id; if (net) { // mysql_load will use thd->net to read the file From 75015595b1c7cbdff9bf5578562018e0bb1960d8 Mon Sep 17 00:00:00 2001 From: "jani@hynda.(none)" <> Date: Thu, 3 Apr 2003 19:55:37 +0300 Subject: [PATCH 15/23] Fixed a bug when printing error messages. stdout and stderr were mixed wrongly sometimes. --- client/mysql.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 377f4f08f63..d7aa0d1404d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2405,31 +2405,32 @@ select_limit, max_join_size); static int put_info(const char *str,INFO_TYPE info_type,uint error) { + FILE *file= (info_type == INFO_ERROR ? stderr : stdout); static int inited=0; if (status.batch) { if (info_type == INFO_ERROR) { - (void) fflush(stdout); - fprintf(stderr,"ERROR"); + (void) fflush(file); + fprintf(file,"ERROR"); if (error) - (void) fprintf(stderr," %d",error); + (void) fprintf(file," %d",error); if (status.query_start_line && line_numbers) { - (void) fprintf(stderr," at line %lu",status.query_start_line); + (void) fprintf(file," at line %lu",status.query_start_line); if (status.file_name) - (void) fprintf(stderr," in file: '%s'", status.file_name); + (void) fprintf(file," in file: '%s'", status.file_name); } - (void) fprintf(stderr,": %s\n",str); - (void) fflush(stderr); + (void) fprintf(file,": %s\n",str); + (void) fflush(file); if (!ignore_errors) return 1; } else if (info_type == INFO_RESULT && verbose > 1) - tee_puts(str, stdout); + tee_puts(str, file); if (unbuffered) - fflush(stdout); + fflush(file); return info_type == INFO_ERROR ? -1 : 0; } if (!opt_silent || info_type == INFO_ERROR) @@ -2447,17 +2448,17 @@ put_info(const char *str,INFO_TYPE info_type,uint error) putchar('\007'); /* This should make a bell */ vidattr(A_STANDOUT); if (error) - (void) tee_fprintf(stderr, "ERROR %d: ", error); + (void) tee_fprintf(file, "ERROR %d: ", error); else - tee_puts("ERROR: ", stdout); + tee_puts("ERROR: ", file); } else vidattr(A_BOLD); - (void) tee_puts(str, stdout); + (void) tee_puts(str, file); vidattr(A_NORMAL); } if (unbuffered) - fflush(stdout); + fflush(file); return info_type == INFO_ERROR ? -1 : 0; } From 46af747b09d0f8aa627d272a30d60987368ef991 Mon Sep 17 00:00:00 2001 From: "vva@eagle.mysql.r18.ru" <> Date: Thu, 3 Apr 2003 14:19:09 -0400 Subject: [PATCH 16/23] add test file for rpl_loaddata.test --- mysql-test/std_data/rpl_loaddata2.dat | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 mysql-test/std_data/rpl_loaddata2.dat diff --git a/mysql-test/std_data/rpl_loaddata2.dat b/mysql-test/std_data/rpl_loaddata2.dat new file mode 100644 index 00000000000..7a3d4ea7695 --- /dev/null +++ b/mysql-test/std_data/rpl_loaddata2.dat @@ -0,0 +1,8 @@ +2003-01-21,6328,%a%,%aaaaa% +## +2003-02-22,2461,b,%a a a @@ @% @b ' " a% +## +2003-03-22,2161,%c%,%asdf% +## +2003-04-22,2416,%a%,%bbbbb% +## From aa4bf1cd8d851e3714c2e09a297f39e208928060 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Thu, 3 Apr 2003 21:19:11 +0300 Subject: [PATCH 17/23] After merge fix --- sql/log_event.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 9ed672d8d4e..2040cebf17e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1146,9 +1146,9 @@ Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex, sql_ex.cached_new_format = -1; if (ex->dumpfile) - sql_ex.opt_flags |= DUMPFILE_FLAG; + sql_ex.opt_flags|= DUMPFILE_FLAG; if (ex->opt_enclosed) - sql_ex.opt_flags |= OPT_ENCLOSED_FLAG; + sql_ex.opt_flags|= OPT_ENCLOSED_FLAG; sql_ex.empty_flags = 0; @@ -1159,15 +1159,15 @@ Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex, } if (!ex->field_term->length()) - sql_ex.empty_flags |= FIELD_TERM_EMPTY; + sql_ex.empty_flags|= FIELD_TERM_EMPTY; if (!ex->enclosed->length()) - sql_ex.empty_flags |= ENCLOSED_EMPTY; + sql_ex.empty_flags|= ENCLOSED_EMPTY; if (!ex->line_term->length()) - sql_ex.empty_flags |= LINE_TERM_EMPTY; + sql_ex.empty_flags|= LINE_TERM_EMPTY; if (!ex->line_start->length()) - sql_ex.empty_flags |= LINE_START_EMPTY; + sql_ex.empty_flags|= LINE_START_EMPTY; if (!ex->escaped->length()) - sql_ex.empty_flags |= ESCAPED_EMPTY; + sql_ex.empty_flags|= ESCAPED_EMPTY; skip_lines = ex->skip_lines; @@ -1860,9 +1860,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, char llbuff[22]; enum enum_duplicates handle_dup = DUP_IGNORE; if (sql_ex.opt_flags & REPLACE_FLAG) - handle_dup = DUP_REPLACE; - sql_exchange ex((char*)fname, sql_ex.opt_flags && - DUMPFILE_FLAG ); + handle_dup= DUP_REPLACE; + sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG); String field_term(sql_ex.field_term,sql_ex.field_term_len); String enclosed(sql_ex.enclosed,sql_ex.enclosed_len); String line_term(sql_ex.line_term,sql_ex.line_term_len); From 8aa753299082158d9f13843ee1ccb92078da19a5 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Thu, 3 Apr 2003 21:19:13 +0300 Subject: [PATCH 18/23] log.cc: Fix bug number 224: do not call ha_report_binlog_offset_and_commit() when a MyISAM table is updated; this also makes CREATE TABLE not to commit an InnoDB transaction, even when binlogging is enabled --- sql/log.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index 1e903613300..a2ed2b05d4e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1120,9 +1120,16 @@ bool MYSQL_LOG::write(Log_event* event_info) the table handler commit here, protected by the LOCK_log mutex, because otherwise the transactions may end up in a different order in the table handler log! + + Note that we will NOT call ha_report_binlog_offset_and_commit() if + there are binlog events cached in the transaction cache. That is + because then the log event which we write to the binlog here is + not a transactional event. In versions < 4.0.13 before this fix this + caused an InnoDB transaction to be committed if in the middle there + was a MyISAM event! */ - if (file == &log_file) + if (file == &log_file && !my_b_tell(&thd->transaction.trans_log)) { /* LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog From 8611c34e5e08a5c92e84deaf86b74e5af448f7d0 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Thu, 3 Apr 2003 20:19:13 +0200 Subject: [PATCH 19/23] Explicit message to warn that logging (e.g. binary) is permanently turned off because of writing problems (such message would have been useful during a recent support task). --- sql/log.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index 1e903613300..2106cd9c3db 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -310,7 +310,10 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, DBUG_RETURN(0); err: - sql_print_error("Could not use %s for logging (error %d)", log_name, errno); + sql_print_error("Could not use %s for logging (error %d). \ +Turning logging off for the whole duration of the MySQL server process. \ +To turn it on again: fix the cause, \ +shutdown the MySQL server and restart it.", log_name, errno); if (file >= 0) my_close(file,MYF(0)); if (index_file_nr >= 0) From f33c6e7c83d48945c9f40cdb795edff7b97605e3 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Thu, 3 Apr 2003 20:19:14 +0200 Subject: [PATCH 20/23] More honest --master-ssl* options description. As these do nothing yet, better say it and see no traffic on bugs@ and support@. --- sql/mysqld.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bc5334ce674..6d86346455a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3379,23 +3379,27 @@ struct my_option my_long_options[] = (gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl", OPT_MASTER_SSL, - "Turn SSL on for replication. Be warned that is this is a relatively new feature.", + "Planned to enable the slave to connect to the master using SSL. Does nothing yet.", (gptr*) &master_ssl, (gptr*) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-key", OPT_MASTER_SSL_KEY, - "Master SSL keyfile name. Only applies if you have enabled master-ssl.", + "Master SSL keyfile name. Only applies if you have enabled master-ssl. Does \ +nothing yet.", (gptr*) &master_ssl_key, (gptr*) &master_ssl_key, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-cert", OPT_MASTER_SSL_CERT, - "Master SSL certificate file name. Only applies if you have enabled master-ssl.", + "Master SSL certificate file name. Only applies if you have enabled \ +master-ssl. Does nothing yet.", (gptr*) &master_ssl_cert, (gptr*) &master_ssl_cert, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-capath", OPT_MASTER_SSL_CAPATH, - "Master SSL CA path. Only applies if you have enabled master-ssl.", + "Master SSL CA path. Only applies if you have enabled master-ssl. \ +Does nothing yet.", (gptr*) &master_ssl_capath, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-cipher", OPT_MASTER_SSL_CIPHER, - "Master SSL cipher. Only applies if you have enabled master-ssl.", + "Master SSL cipher. Only applies if you have enabled master-ssl. \ +Does nothing yet.", (gptr*) &master_ssl_cipher, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"myisam-recover", OPT_MYISAM_RECOVER, From cb68a2c7b168411d3345846cb7e52432e58c0d64 Mon Sep 17 00:00:00 2001 From: "walrus@mysql.com" <> Date: Fri, 4 Apr 2003 02:54:07 +0600 Subject: [PATCH 21/23] crash-me.sh: add sorted_group_by parameter --- sql-bench/crash-me.sh | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 61468d69fb1..ff649acdae4 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -2734,6 +2734,51 @@ assert("drop table crash_me_n $drop_attr"); +$key = 'sorted_group_by'; +$prompt = 'Group by always sorted'; +if (!defined($limits{$key})) +{ + save_incomplete($key,$prompt); + print "$prompt="; + safe_query_l($key,[ + "create table crash_me_t1 (a int not null, b int not null)", + "insert into crash_me_t1 values (1,1)", + "insert into crash_me_t1 values (1,2)", + "insert into crash_me_t1 values (3,1)", + "insert into crash_me_t1 values (3,2)", + "insert into crash_me_t1 values (2,2)", + "insert into crash_me_t1 values (2,1)", + "create table crash_me_t2 (a int not null, b int not null)", + "create index crash_me_t2_ind on crash_me_t2 (a)", + "insert into crash_me_t2 values (1,3)", + "insert into crash_me_t2 values (3,1)", + "insert into crash_me_t2 values (2,2)", + "insert into crash_me_t2 values (1,1)"]); + + my $bigqry = "select crash_me_t1.a,crash_me_t2.b from ". + "crash_me_t1,crash_me_t2 where crash_me_t1.a=crash_me_t2.a ". + "group by crash_me_t1.a,crash_me_t2.b"; + + my $limit='no'; + my $rs = get_recordset($key,$bigqry); + print_recordset($key,$rs); + if ( defined ($rs)) { + if (compare_recordset($key,$rs,[[1,1],[1,3],[2,2],[3,1]]) eq 0) + { + $limit='yes' + } + } else { + add_log($key,"error: ".$DBI::errstr); + } + + print "$limit\n"; + safe_query_l($key,["drop table crash_me_t1", + "drop table crash_me_t2"]); + save_config_data($key,$limit,$prompt); + +} else { + print "$prompt=$limits{$key} (cashed)\n"; +} # From 17d1a669ed4866bf113984f05f2eecd6a8f28d3f Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Fri, 4 Apr 2003 10:14:06 +0300 Subject: [PATCH 22/23] log.cc: Fix crash in previous bug fix log.cc reported by Rob Lyon if --skip-innodb is specified --- sql/log.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index 2cb2e37be08..8a5aba5cd34 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1132,7 +1132,8 @@ bool MYSQL_LOG::write(Log_event* event_info) was a MyISAM event! */ - if (file == &log_file && !my_b_tell(&thd->transaction.trans_log)) + if (file == &log_file && opt_using_transactions + && !my_b_tell(&thd->transaction.trans_log)) { /* LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog From 9b0266a037ea926307765cbda39d2af4b2504b49 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Fri, 4 Apr 2003 17:43:54 +0200 Subject: [PATCH 23/23] Documented undocumented replication options, now that the manual is up-to-date. --- sql/mysqld.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6d86346455a..4ae248acb67 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3321,7 +3321,7 @@ struct my_option my_long_options[] = (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, - "Log queries in new binary format (for replication)", + "Log update queries in binary format", (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin-index", OPT_BIN_LOG_INDEX, @@ -3375,7 +3375,8 @@ struct my_option my_long_options[] = (gptr*) &master_retry_count, (gptr*) &master_retry_count, 0, GET_ULONG, REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0}, {"master-info-file", OPT_MASTER_INFO_FILE, - "The location of the file that remembers where we left off on the master during the replication process. The default is `master.info' in the data directory. You should not need to change this.", + "The location and name of the file that remembers the master and where the I/O replication \ +thread is in the master's binlogs.", (gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl", OPT_MASTER_SSL, @@ -3498,10 +3499,13 @@ Does nothing yet.", {"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented", (gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log", OPT_RELAY_LOG, "Undocumented", + {"relay-log", OPT_RELAY_LOG, + "The location and name to use for relay logs", (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log-index", OPT_RELAY_LOG_INDEX, "Undocumented", + {"relay-log-index", OPT_RELAY_LOG_INDEX, + "The location and name to use for the file that keeps a list of the last \ +relay logs", (gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", @@ -3563,10 +3567,14 @@ Does nothing yet.", {"skip-thread-priority", OPT_SKIP_PRIOR, "Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "Undocumented", + {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, + "The location and name of the file that remembers where the SQL replication \ +thread is in the relay logs", (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented", + {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, + "The location where the slave should put its temporary files when \ +replicating a LOAD DATA INFILE command", (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, @@ -3892,7 +3900,7 @@ Does nothing yet.", (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, - "Max space to use for all relay logs", + "Maximum space to use for all relay logs", (gptr*) &relay_log_space_limit, (gptr*) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L, (longlong) ULONG_MAX, 0, 1, 0},