From 904cad878325be53c185118073ab52b42398194f Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Sat, 19 Jul 2003 10:34:41 +0200 Subject: [PATCH 01/87] typo fixed --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index e0b28874892..69cd1a82108 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -623,7 +623,7 @@ main() FILE *file=fopen("conftestval", "w"); f = (float) ll; fprintf(file,"%g\n",f); - close(file); + fclose(file); exit (0); }], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes" From 33c47c7eadbb72bb680ff1a7df9302030e14e882 Mon Sep 17 00:00:00 2001 From: "miguel@hegel.local" <> Date: Wed, 23 Jul 2003 21:57:44 -0400 Subject: [PATCH 02/87] Fix for service issue with paths having spaces (bug #687) --- include/my_sys.h | 1 + mysys/mf_format.c | 8 ++++++++ sql/mysqld.cc | 7 +++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index 7f8b8a80a1c..acce118c7b8 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -100,6 +100,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_RETURN_REAL_PATH 32 /* return full path for file */ #define MY_SAFE_PATH 64 /* Return NULL if too long path */ #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ +#define MY_QUOTE_SPACES 256 /* quote when the path has spaces */ /* My seek flags */ #define MY_SEEK_SET 0 diff --git a/mysys/mf_format.c b/mysys/mf_format.c index ab1904da162..36d3908d310 100644 --- a/mysys/mf_format.c +++ b/mysys/mf_format.c @@ -111,6 +111,14 @@ my_string fn_format(my_string to, const char *name, const char *dir, strmov(buff,to); (void) my_readlink(to, buff, MYF(0)); } + if ( flag & MY_QUOTE_SPACES) + if ( strchr(to, ' ')) + { + char tmp_buff[FN_REFLEN]; + tmp_buff[0]='"'; + strxmov(tmp_buff+1,to,"\"",NullS); + strmov(to,tmp_buff); + } DBUG_RETURN (to); } /* fn_format */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9b8d12e845d..cbd8ebd350b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2559,7 +2559,8 @@ int main(int argc, char **argv) { char file_path[FN_REFLEN]; my_path(file_path, argv[0], ""); /* Find name in path */ - fn_format(file_path,argv[0],file_path,"",1+4+16); /* Force full path */ + fn_format(file_path,argv[0],file_path,"",MY_REPLACE_DIR+ + MY_UNPACK_FILENAME+MY_RESOLVE_SYMLINKS+MY_QUOTE_SPACES); if (argc == 2) { @@ -2605,8 +2606,10 @@ int main(int argc, char **argv) mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini */ uint length=strlen(file_path); + char tmp_path[FN_REFLEN]; + fn_format(tmp_path,argv[3],tmp_path,"",MY_QUOTE_SPACES); *strxnmov(file_path + length, sizeof(file_path)-length-2, " ", - argv[3], " ", argv[2], NullS)= '\0'; + tmp_path, " ", argv[2], NullS)= '\0'; if (!default_service_handling(argv, argv[2], argv[2], file_path)) return 0; } From df3b31f3c496febf104e476720b1fe4ef9696b4e Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Thu, 24 Jul 2003 22:25:36 +0200 Subject: [PATCH 03/87] WL#1036 (print the db in slave error messages). I extended the task to cleaning error messages, making them look nicer, and making the output of SHOW SLAVE STATUS (column Last_error) be as complete as what's printed on the .err file; previously we would have, for a failure of a replicated LOAD DATA INFILE: - in the .err, 2 lines: "duplicate entry 2708 for key 1" "failed loading SQL_LOAD-5-2-2.info" - and in SHOW SLAVE STATUS, only: "failed loading SQL_LOAD-5-2-2.info". Now SHOW SLAVE STATUS will contain the concatenation of the 2 messages. --- sql/log_event.cc | 111 ++++++++++++++++++++++++++++++----------------- sql/slave.cc | 55 ++++++++++++++++++----- sql/slave.h | 3 +- 3 files changed, 117 insertions(+), 52 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index a6d2abbf894..96bcf0a2779 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1753,7 +1753,7 @@ void Unknown_log_event::print(FILE* file, bool short_form, char* last_db) #ifndef MYSQL_CLIENT int Query_log_event::exec_event(struct st_relay_log_info* rli) { - int expected_error,actual_error = 0; + int expected_error, actual_error= 0; init_sql_alloc(&thd->mem_root, 8192,0); thd->db = rewrite_db((char*)db); @@ -1801,19 +1801,30 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) else if (!strcmp(thd->query,"COMMIT")) rli->inside_transaction=0; + /* + If we expected a non-zero error code, and we don't get the same error + code, and none of them should be ignored. + */ if ((expected_error != (actual_error = thd->net.last_errno)) && expected_error && !ignored_error_code(actual_error) && !ignored_error_code(expected_error)) { - const char* errmsg = "Slave: did not get the expected error\ - running query from master - expected: '%s' (%d), got '%s' (%d)"; - sql_print_error(errmsg, ER_SAFE(expected_error), - expected_error, - actual_error ? thd->net.last_error: "no error", - actual_error); - thd->query_error = 1; + slave_print_error(rli, 0, + "Query '%s' did not get the same error as the query \ +got on master - got on master: '%s' (%d), got on slave: '%s' (%d) \ +(default database was '%s')", + query, + ER_SAFE(expected_error), + expected_error, + actual_error ? thd->net.last_error: "no error", + actual_error, + print_slave_db_safe((char*)db)); + thd->query_error= 1; } + /* + If we get the same error code as expected, or they should be ignored. + */ else if (expected_error == actual_error || ignored_error_code(actual_error)) { @@ -1821,37 +1832,38 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) *rli->last_slave_error = 0; rli->last_slave_errno = 0; } - } - else - { - // master could be inconsistent, abort and tell DBA to check/fix it - VOID(pthread_mutex_lock(&LOCK_thread_count)); - thd->db = thd->query = 0; - VOID(pthread_mutex_unlock(&LOCK_thread_count)); - thd->variables.convert_set = 0; - close_thread_tables(thd); - free_root(&thd->mem_root,0); - return 1; - } - } - thd->db= 0; // prevent db from being freed + /* + Other cases: mostly we expected no error and get one. + */ + else if (thd->query_error || thd->fatal_error) + { + slave_print_error(rli,actual_error, "Error '%s' on query '%s' \ +(default database was '%s')", + actual_error ? thd->net.last_error : + "unexpected success or fatal error", query, + print_slave_db_safe((char*)db)); + thd->query_error= 1; + } + } + /* + End of sanity check. If the test was wrong, the query got a really bad + error on the master, which could be inconsistent, abort and tell DBA to + check/fix it. check_expected_error() already printed the message to + stderr and rli, and set thd->query_error to 1. + */ + } /* End of if (db_ok(... */ + +end: + VOID(pthread_mutex_lock(&LOCK_thread_count)); + thd->db= 0; // prevent db from being freed thd->query= 0; // just to be sure VOID(pthread_mutex_unlock(&LOCK_thread_count)); // assume no convert for next query unless set explictly thd->variables.convert_set = 0; - close_thread_tables(thd); - - if (thd->query_error || thd->fatal_error) - { - slave_print_error(rli,actual_error, "error '%s' on query '%s'", - actual_error ? thd->net.last_error : - "unexpected success or fatal error", query); - free_root(&thd->mem_root,0); - return 1; - } + close_thread_tables(thd); free_root(&thd->mem_root,0); - return Log_event::exec_event(rli); + return (thd->query_error ? thd->query_error : Log_event::exec_event(rli)); } /* @@ -1972,8 +1984,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, event in the master log */ sql_print_error("Slave: load data infile at position %s in log \ -'%s' produced %d warning(s)", llstr(log_pos,llbuff), RPL_LOG_NAME, - thd->cuted_fields ); +'%s' produced %d warning(s) (loaded table was '%s', database was '%s')", + llstr(log_pos,llbuff), RPL_LOG_NAME, + thd->cuted_fields, + (char*)table_name, + print_slave_db_safe((char*)db)); if (net) net->pkt_nr= thd->net.pkt_nr; } @@ -2005,8 +2020,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, err=ER(sql_errno); } slave_print_error(rli,sql_errno, - "Error '%s' running load data infile", - err); + "Error '%s' running load data infile \ +(loaded table was '%s', database was '%s')", + err, (char*)table_name, print_slave_db_safe((char*)db)); free_root(&thd->mem_root,0); return 1; } @@ -2014,7 +2030,10 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, if (thd->fatal_error) { - sql_print_error("Fatal error running LOAD DATA INFILE "); + slave_print_error(rli,ER_UNKNOWN_ERROR, +"Fatal error running \ +LOAD DATA INFILE (loaded table was '%s', database was '%s')", + (char*)table_name, print_slave_db_safe((char*)db)); return 1; } @@ -2311,7 +2330,21 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) */ if (lev->exec_event(0,rli,1)) { - slave_print_error(rli,my_errno, "Failed executing load from '%s'", fname); + /* + We want to indicate the name of the file that could not be loaded + (SQL_LOADxxx). + But as we are here we are sure the error is in rli->last_slave_error and + rli->last_slave_errno (example of error: duplicate entry for key), so we + don't want to overwrite it with the filename. + What we want instead is add the filename to the current error message. + */ + char *tmp= my_strdup(rli->last_slave_error,MYF(MY_WME)); + if (!tmp) + goto err; + slave_print_error(rli,rli->last_slave_errno, /* ok to re-use the error code */ + "%s. Failed executing load from '%s'", + tmp, fname); + my_free(tmp,MYF(0)); thd->options = save_options; goto err; } diff --git a/sql/slave.cc b/sql/slave.cc index 6ace446a341..b4fa11f456e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -74,7 +74,6 @@ static int request_table_dump(MYSQL* mysql, const char* db, const char* table); static int create_table_from_dump(THD* thd, NET* net, const char* db, const char* table_name); static int check_master_version(MYSQL* mysql, MASTER_INFO* mi); -char* rewrite_db(char* db); /* @@ -290,8 +289,6 @@ err: if (need_data_lock) pthread_mutex_unlock(&rli->data_lock); - /* Isn't this strange: if !need_data_lock, we broadcast with no lock ?? */ - pthread_mutex_unlock(log_lock); DBUG_RETURN ((*errmsg) ? 1 : 0); } @@ -362,7 +359,10 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, rli->pending= 0; if (!rli->inited) + { + DBUG_PRINT("info", ("rli->inited == 0")); DBUG_RETURN(0); + } DBUG_ASSERT(rli->slave_running == 0); DBUG_ASSERT(rli->mi->slave_running == 0); @@ -828,6 +828,21 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) return rli->abort_slave || abort_loop || thd->killed; } +/* + Writes an error message to rli->last_slave_error and rli->last_slave_errno + (which will be displayed by SHOW SLAVE STATUS), and prints it to stderr. + + SYNOPSIS + slave_print_error() + rli + err_code The error code + msg The error message (usually related to the error code, but can + contain more information). + ... (this is printf-like format, with % symbols in msg) + + RETURN VALUES + void + */ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...) { @@ -835,9 +850,16 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...) va_start(args,msg); my_vsnprintf(rli->last_slave_error, sizeof(rli->last_slave_error), msg, args); - sql_print_error("Slave: %s, error_code=%d", rli->last_slave_error, - err_code); rli->last_slave_errno = err_code; + /* If the error string ends with '.', do not add a ',' it would be ugly */ + if (rli->last_slave_error[0] && + (rli->last_slave_error[strlen(rli->last_slave_error)-1] == '.')) + sql_print_error("Slave: %s Error_code=%d", rli->last_slave_error, + err_code); + else + sql_print_error("Slave: %s, error_code=%d", rli->last_slave_error, + err_code); + } @@ -865,6 +887,16 @@ char* rewrite_db(char* db) return db; } +/* + From other comments and tests in code, it looks like + sometimes Query_log_event and Load_log_event can have db==0 + (see rewrite_db() above for example) + (cases where this happens are unclear; it may be when the master is 3.23). +*/ +char* print_slave_db_safe(char* db) +{ + return (db ? rewrite_db(db) : (char*) ""); +} /* Checks whether a db matches some do_db and ignore_db rules @@ -1282,7 +1314,7 @@ file '%s')", fname); &msg)) { sql_print_error("Failed to open the relay log (relay_log_name='FIRST', \ -relay_log_pos=4"); +relay_log_pos=4)"); goto err; } rli->master_log_name[0]= 0; @@ -1346,7 +1378,7 @@ file '%s')", fname); { char llbuf[22]; sql_print_error("Failed to open the relay log (relay_log_name='%s', \ -relay_log_pos=%s", rli->relay_log_name, llstr(rli->relay_log_pos, llbuf)); +relay_log_pos=%s)", rli->relay_log_name, llstr(rli->relay_log_pos, llbuf)); goto err; } } @@ -2142,14 +2174,13 @@ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error) case ER_NET_ERROR_ON_WRITE: case ER_SERVER_SHUTDOWN: case ER_NEW_ABORTING_CONNECTION: - my_snprintf(rli->last_slave_error, sizeof(rli->last_slave_error), - "Slave: query '%s' partially completed on the master \ + slave_print_error(rli,expected_error, + "query '%s' partially completed on the master \ and was aborted. There is a chance that your master is inconsistent at this \ point. If you are sure that your master is ok, run this query manually on the\ slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;\ - SLAVE START;", thd->query); - rli->last_slave_errno = expected_error; - sql_print_error("%s",rli->last_slave_error); + SLAVE START; .", thd->query); + thd->query_error= 1; return 1; default: return 0; diff --git a/sql/slave.h b/sql/slave.h index 842ddca75f4..d1fd54d3c04 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -383,9 +383,10 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); char* rewrite_db(char* db); +char* print_slave_db_safe(char* db); int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code); void skip_load_data_infile(NET* net); -void slave_print_error(RELAY_LOG_INFO* rli,int err_code, const char* msg, ...); +void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); void end_slave(); /* clean up */ int init_master_info(MASTER_INFO* mi, const char* master_info_fname, From aba7647fd814cf3d9171e7f742d5e72266cc54ec Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Thu, 24 Jul 2003 22:29:09 +0200 Subject: [PATCH 04/87] Fix for BUG#858 "CHANGE MASTER forgets to update relay-log.info"; just a flush_relay_log_info() at the end of CHANGE MASTER (there was already flush_master_info()). --- sql/sql_repl.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 13b22d6a221..faa18b146bb 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -878,9 +878,14 @@ int change_master(THD* thd, MASTER_INFO* mi) and we have the hold on the run locks which will keep all threads that could possibly modify the data structures from running */ + + /* + If the user specified host or port without binlog or position, + reset binlog's name to FIRST and position to 4. + */ + if ((lex_mi->host || lex_mi->port) && !lex_mi->log_file_name && !lex_mi->pos) { - // if we change host or port, we must reset the postion mi->master_log_name[0] = 0; mi->master_log_pos= BIN_LOG_HEADER_SIZE; mi->rli.pending = 0; @@ -950,15 +955,24 @@ int change_master(THD* thd, MASTER_INFO* mi) DBUG_RETURN(1); } } - mi->rli.master_log_pos = mi->master_log_pos; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); + /* If changing RELAY_LOG_FILE or RELAY_LOG_POS, this will be nonsense: */ + mi->rli.master_log_pos = mi->master_log_pos; strmake(mi->rli.master_log_name,mi->master_log_name, sizeof(mi->rli.master_log_name)-1); if (!mi->rli.master_log_name[0]) // uninitialized case mi->rli.master_log_pos=0; pthread_mutex_lock(&mi->rli.data_lock); - mi->rli.abort_pos_wait++; + mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */ + /* + If we don't write new coordinates to disk now, then old will remain in + relay-log.info until START SLAVE is issued; but if mysqld is shutdown + before START SLAVE, then old will remain in relay-log.info, and will be the + in-memory value at restart (thus causing errors, as the old relay log does + not exist anymore). + */ + flush_relay_log_info(&mi->rli); pthread_cond_broadcast(&mi->data_cond); pthread_mutex_unlock(&mi->rli.data_lock); From 1dfaccb0164336aa004ea373a67bc8735a290b80 Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Fri, 25 Jul 2003 09:25:50 +0500 Subject: [PATCH 05/87] Fix: remove compile warnings on RH(with openssl) --- acinclude.m4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 6ca600d29f3..b558e952543 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -745,7 +745,7 @@ AC_DEFUN(MYSQL_FIND_OPENSSL, [ for d in /usr/kerberos/include do if test -f $d/krb5.h ; then - OPENSSL_INCLUDE="$OPENSSL_INCLUDE -I$d" + OPENSSL_KERBEROS_INCLUDE="$d" fi done @@ -794,10 +794,15 @@ AC_MSG_CHECKING(for OpenSSL) openssl_libs="-L$OPENSSL_LIB -lssl -lcrypto" # Don't set openssl_includes to /usr/include as this gives us a lot of # compiler warnings when using gcc 3.x + openssl_includes="" if test "$OPENSSL_INCLUDE" != "-I/usr/include" then openssl_includes="$OPENSSL_INCLUDE" fi + if test "$OPENSSL_KERBEROS_INCLUDE" + then + openssl_includes="$openssl_includes -I$OPENSSL_KERBEROS_INCLUDE" + fi AC_DEFINE(HAVE_OPENSSL) # openssl-devel-0.9.6 requires dlopen() and we can't link staticly From 4e22494ebf8847ee4842159534b1f14d895feb2f Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 25 Jul 2003 14:32:03 +0200 Subject: [PATCH 06/87] outer join, impossible on condition, where, and usable key for range bug#926 --- mysql-test/r/select.result | 20 ++++++++++++++++++++ mysql-test/t/select.test | 20 ++++++++++++++++++++ sql/sql_select.cc | 4 ---- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 811c396ea67..bde527b9b44 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3508,3 +3508,23 @@ aa id t2_id id 5 8303 2520 2520 6 8304 2521 2521 drop table t1,t2; +create table t1 (id1 int NOT NULL); +create table t2 (id2 int NOT NULL); +create table t3 (id3 int NOT NULL); +create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4)); +insert into t1 values (1); +insert into t1 values (2); +insert into t2 values (1); +insert into t4 values (1,1); +explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 +left join t4 on id3 = id4 where id2 = 1 or id4 = 1; +table type possible_keys key key_len ref rows Extra +t3 system NULL NULL NULL NULL 0 const row not found +t1 ALL NULL NULL NULL NULL 2 +t2 ALL NULL NULL NULL NULL 1 +t4 ALL id4 NULL NULL NULL 1 Using where +select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 +left join t4 on id3 = id4 where id2 = 1 or id4 = 1; +id1 id2 id3 id4 id44 +1 1 NULL NULL NULL +drop table t1,t2,t3,t4; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index c2e451ea7f3..9884c88b420 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1832,3 +1832,23 @@ INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; drop table t1,t2; +# +# outer join, impossible on condition, where, and usable key for range +# +create table t1 (id1 int NOT NULL); +create table t2 (id2 int NOT NULL); +create table t3 (id3 int NOT NULL); +create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4)); + +insert into t1 values (1); +insert into t1 values (2); +insert into t2 values (1); +insert into t4 values (1,1); + +explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 +left join t4 on id3 = id4 where id2 = 1 or id4 = 1; +select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 +left join t4 on id3 = id4 where id2 = 1 or id4 = 1; + +drop table t1,t2,t3,t4; + diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4008bf75f01..6675a310464 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2641,9 +2641,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) join->thd->select_limit < join->best_positions[i].records_read && !(join->select_options & OPTION_FOUND_ROWS))) { - /* Join with outer join condition */ - COND *orig_cond=sel->cond; - sel->cond=and_conds(sel->cond,tab->on_expr); if (sel->test_quick_select(tab->keys, used_tables & ~ current_map, (join->select_options & @@ -2651,7 +2648,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) HA_POS_ERROR : join->thd->select_limit)) < 0) DBUG_RETURN(1); // Impossible range - sel->cond=orig_cond; /* Fix for EXPLAIN */ if (sel->quick) join->best_positions[i].records_read= sel->quick->records; From c1b62170a7afd62fc20b9d22da5592868abf255f Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Fri, 25 Jul 2003 22:26:39 +0300 Subject: [PATCH 07/87] srv0srv.c, os0file.c, log0recv.h, log0log.h, fil0fil.h, fsp0fsp.c, fil0fil.c: Merge trx0trx.c: Print more info about a trx in SHOW INNODB status; try to find the bug reported by Plaxo buf0buf.c: Check that page log sequence numbers are not in the future log0recv.c, log0log.c: Fixed a bug: if you used big BLOBs, and your log files were relatively small, InnoDB could in a big BLOB operation temporarily write over the log produced AFTER the latest checkpoint. If InnoDB would crash at that moment, then the crash recovery would fail, because InnoDB would not be able to scan the log even up to the latest checkpoint. Starting from this version, InnoDB tries to ensure the latest checkpoint is young enough. If that is not possible, InnoDB prints a warning to the .err log --- innobase/buf/buf0buf.c | 23 ++++++++++++ innobase/fil/fil0fil.c | 28 ++++++++++++++ innobase/fsp/fsp0fsp.c | 46 ++++++++++++++++++++++- innobase/include/fil0fil.h | 8 ++++ innobase/include/log0log.h | 14 +++++++ innobase/include/log0recv.h | 2 + innobase/log/log0log.c | 75 ++++++++++++++++++++++++++++++++----- innobase/log/log0recv.c | 49 ++++++++++++++++++++++-- innobase/os/os0file.c | 1 + innobase/srv/srv0srv.c | 15 +++++++- innobase/trx/trx0trx.c | 7 ++++ 11 files changed, 253 insertions(+), 15 deletions(-) diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index 246a60a61cd..3f2476c715b 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -34,6 +34,7 @@ Created 11/5/1995 Heikki Tuuri #include "ibuf0ibuf.h" #include "dict0dict.h" #include "log0recv.h" +#include "log0log.h" #include "trx0undo.h" #include "srv0srv.h" @@ -273,6 +274,7 @@ buf_page_is_corrupted( ulint old_checksum; ulint checksum_field; ulint old_checksum_field; + dulint current_lsn; if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4) != mach_read_from_4(read_buf + UNIV_PAGE_SIZE @@ -284,6 +286,27 @@ buf_page_is_corrupted( return(TRUE); } +#ifndef UNIV_HOTBACKUP + if (recv_lsn_checks_on && log_peek_lsn(¤t_lsn)) { + if (ut_dulint_cmp(current_lsn, + mach_read_from_8(read_buf + FIL_PAGE_LSN)) + < 0) { + ut_print_timestamp(stderr); + + fprintf(stderr, +" InnoDB: Error: page %lu log sequence number %lu %lu\n" +"InnoDB: is in the future! Current system log sequence number %lu %lu.\n" +"InnoDB: Your database may be corrupt.\n", + mach_read_from_4(read_buf + FIL_PAGE_OFFSET), + ut_dulint_get_high( + mach_read_from_8(read_buf + FIL_PAGE_LSN)), + ut_dulint_get_low( + mach_read_from_8(read_buf + FIL_PAGE_LSN)), + ut_dulint_get_high(current_lsn), + ut_dulint_get_low(current_lsn)); + } + } +#endif old_checksum = buf_calc_page_old_checksum(read_buf); old_checksum_field = mach_read_from_4(read_buf + UNIV_PAGE_SIZE diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index a8dc357749c..f55df90846c 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -831,6 +831,34 @@ fil_space_release_free_extents( mutex_exit(&(system->mutex)); } +/*********************************************************************** +Gets the number of reserved extents. If the database is silent, this number +should be zero. */ + +ulint +fil_space_get_n_reserved_extents( +/*=============================*/ + ulint id) /* in: space id */ +{ + fil_space_t* space; + fil_system_t* system = fil_system; + ulint n; + + ut_ad(system); + + mutex_enter(&(system->mutex)); + + HASH_SEARCH(hash, system->spaces, id, space, space->id == id); + + ut_a(space); + + n = space->n_reserved_extents; + + mutex_exit(&(system->mutex)); + + return(n); +} + /************************************************************************ Prepares a file node for i/o. Opens the file if it is closed. Updates the pending i/o's field in the node and the system appropriately. Takes the node diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index b6941d80e90..20bf4972f64 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -2709,10 +2709,52 @@ fseg_free_page_low( return; } +/* + fprintf(stderr, +"InnoDB: InnoDB is freeing space %lu page %lu,\n" +"InnoDB: which belongs to descr seg %lu %lu\n" +"InnoDB: segment %lu %lu.\n", + space, page, + ut_dulint_get_high( + mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr)), + ut_dulint_get_low( + mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr)), + ut_dulint_get_high( + mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr)), + ut_dulint_get_low( + mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr))); +*/ /* If we get here, the page is in some extent of the segment */ - ut_a(0 == ut_dulint_cmp( + if (0 != ut_dulint_cmp( mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr), - mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr))); + mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr))) { + + ut_sprintf_buf(errbuf, descr, 40); + fprintf(stderr, +"InnoDB: Dump of the tablespace extent descriptor: %s\n", errbuf); + ut_sprintf_buf(errbuf, seg_inode, 40); + fprintf(stderr, +"InnoDB: Dump of the segment inode: %s\n", errbuf); + + fprintf(stderr, +"InnoDB: Serious error: InnoDB is trying to free space %lu page %lu,\n" +"InnoDB: which does not belong to segment %lu %lu but belongs\n" +"InnoDB: to segment %lu %lu.\n", + space, page, + ut_dulint_get_high( + mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr)), + ut_dulint_get_low( + mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr)), + ut_dulint_get_high( + mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr)), + ut_dulint_get_low( + mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr))); + + fprintf(stderr, +"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n" +"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n"); + ut_a(0); + } not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr); diff --git a/innobase/include/fil0fil.h b/innobase/include/fil0fil.h index 4f78fdb2fd7..ad3149f0b36 100644 --- a/innobase/include/fil0fil.h +++ b/innobase/include/fil0fil.h @@ -386,6 +386,14 @@ fil_space_release_free_extents( /*===========================*/ ulint id, /* in: space id */ ulint n_reserved); /* in: how many one reserved */ +/*********************************************************************** +Gets the number of reserved extents. If the database is silent, this number +should be zero. */ + +ulint +fil_space_get_n_reserved_extents( +/*=============================*/ + ulint id); /* in: space id */ typedef struct fil_space_struct fil_space_t; diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h index e79e914e4f6..24ec28a56e6 100644 --- a/innobase/include/log0log.h +++ b/innobase/include/log0log.h @@ -513,6 +513,15 @@ log_print( /*======*/ char* buf, /* in/out: buffer where to print */ char* buf_end);/* in: buffer end */ +/********************************************************** +Peeks the current lsn. */ + +ibool +log_peek_lsn( +/*=========*/ + /* out: TRUE if success, FALSE if could not get the + log system mutex */ + dulint* lsn); /* out: if returns TRUE, current lsn is here */ /************************************************************************** Refreshes the statistics used to print per-second averages. */ @@ -785,6 +794,11 @@ struct log_struct{ called */ /* Fields involved in checkpoints */ + ulint log_group_capacity; /* capacity of the log group; if + the checkpoint age exceeds this, it is + a serious error because it is possible + we will then overwrite log and spoil + crash recovery */ ulint max_modified_age_async; /* when this recommended value for lsn - buf_pool_get_oldest_modification() diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h index 7418e4abf1b..e5a5bc05563 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -333,6 +333,8 @@ extern ibool recv_recovery_on; extern ibool recv_no_ibuf_operations; extern ibool recv_needed_recovery; +extern ibool recv_lsn_checks_on; + extern ibool recv_is_making_a_backup; extern ulint recv_max_parsed_page_no; diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 53ca97baaa0..99827da5bf5 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -33,6 +33,11 @@ log_t* log_sys = NULL; ibool log_do_write = TRUE; ibool log_debug_writes = FALSE; +/* These control how often we print warnings if the last checkpoint is too +old */ +ibool log_has_printed_chkp_warning = FALSE; +time_t log_last_warning_time; + /* Pointer to this variable is used as the i/o-message when we do i/o to an archive */ byte log_archive_io; @@ -299,6 +304,7 @@ log_close(void) dulint oldest_lsn; dulint lsn; log_t* log = log_sys; + ulint checkpoint_age; ut_ad(mutex_own(&(log->mutex))); @@ -322,8 +328,34 @@ log_close(void) log->check_flush_or_checkpoint = TRUE; } - if (ut_dulint_minus(lsn, log->last_checkpoint_lsn) - <= log->max_modified_age_async) { + checkpoint_age = ut_dulint_minus(lsn, log->last_checkpoint_lsn); + + if (checkpoint_age >= log->log_group_capacity) { + /* TODO: split btr_store_big_rec_extern_fields() into small + steps so that we can release all latches in the middle, and + call log_free_check() to ensure we never write over log written + after the latest checkpoint. In principle, we should split all + big_rec operations, but other operations are smaller. */ + + if (!log_has_printed_chkp_warning + || difftime(time(NULL), log_last_warning_time) > 15) { + + log_has_printed_chkp_warning = TRUE; + log_last_warning_time = time(NULL); + + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: the age of the last checkpoint is %lu,\n" +"InnoDB: which exceeds the log group capacity %lu.\n" +"InnoDB: If you are using big BLOB or TEXT rows, you must set the\n" +"InnoDB: combined size of log files at least 10 times bigger than the\n" +"InnoDB: largest such row.\n", + checkpoint_age, log->log_group_capacity); + } + } + + if (checkpoint_age <= log->max_modified_age_async) { + goto function_exit; } @@ -332,8 +364,7 @@ log_close(void) if (ut_dulint_is_zero(oldest_lsn) || (ut_dulint_minus(lsn, oldest_lsn) > log->max_modified_age_async) - || (ut_dulint_minus(lsn, log->last_checkpoint_lsn) - > log->max_checkpoint_age_async)) { + || checkpoint_age > log->max_checkpoint_age_async) { log->check_flush_or_checkpoint = TRUE; } @@ -551,7 +582,6 @@ log_calc_max_ages(void) the database server */ { log_group_t* group; - ulint n_threads; ulint margin; ulint free; ibool success = TRUE; @@ -561,8 +591,6 @@ log_calc_max_ages(void) ut_ad(!mutex_own(&(log_sys->mutex))); - n_threads = srv_get_n_threads(); - mutex_enter(&(log_sys->mutex)); group = UT_LIST_GET_FIRST(log_sys->log_groups); @@ -590,12 +618,15 @@ log_calc_max_ages(void) group = UT_LIST_GET_NEXT(log_groups, group); } + /* Add extra safety */ + smallest_capacity = smallest_capacity - smallest_capacity / 10; + /* For each OS thread we must reserve so much free space in the smallest log group that it can accommodate the log entries produced by single query steps: running out of free log space is a serious system error which requires rebooting the database. */ - free = LOG_CHECKPOINT_FREE_PER_THREAD * n_threads + free = LOG_CHECKPOINT_FREE_PER_THREAD * (10 + srv_thread_concurrency) + LOG_CHECKPOINT_EXTRA_FREE; if (free >= smallest_capacity / 2) { success = FALSE; @@ -607,6 +638,10 @@ log_calc_max_ages(void) margin = ut_min(margin, log_sys->adm_checkpoint_interval); + margin = margin - margin / 10; /* Add still some extra safety */ + + log_sys->log_group_capacity = smallest_capacity; + log_sys->max_modified_age_async = margin - margin / LOG_POOL_PREFLUSH_RATIO_ASYNC; log_sys->max_modified_age_sync = margin @@ -626,7 +661,7 @@ failure: if (!success) { fprintf(stderr, - "Error: log file group too small for the number of threads\n"); +"InnoDB: Error: log file group too small for innodb_thread_concurrency\n"); } return(success); @@ -3111,6 +3146,28 @@ log_check_log_recs( return(TRUE); } +/********************************************************** +Peeks the current lsn. */ + +ibool +log_peek_lsn( +/*=========*/ + /* out: TRUE if success, FALSE if could not get the + log system mutex */ + dulint* lsn) /* out: if returns TRUE, current lsn is here */ +{ + if (0 == mutex_enter_nowait(&(log_sys->mutex), (char*)__FILE__, + __LINE__)) { + *lsn = log_sys->lsn; + + mutex_exit(&(log_sys->mutex)); + + return(TRUE); + } + + return(FALSE); +} + /********************************************************** Prints info of the log. */ diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 8e5fe819afb..9c9ad568d98 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -46,6 +46,8 @@ ibool recv_recovery_from_backup_on = FALSE; ibool recv_needed_recovery = FALSE; +ibool recv_lsn_checks_on = FALSE; + /* If the following is TRUE, the buffer pool file pages must be invalidated after recovery and no ibuf operations are allowed; this becomes TRUE if the log record hash table becomes too full, and log records must be merged @@ -71,6 +73,12 @@ ulint recv_previous_parsed_rec_is_multi = 0; ulint recv_max_parsed_page_no = 0; +/* The maximum lsn we see for a page during the recovery process. If this +is bigger than the lsn we are able to scan up to, that is an indication that +the recovery failed and the database may be corrupt. */ + +dulint recv_max_page_lsn; + /************************************************************ Creates the recovery system. */ @@ -132,6 +140,8 @@ recv_sys_init( OS_FILE_LOG_BLOCK_SIZE); recv_sys->found_corrupt_log = FALSE; + recv_max_page_lsn = ut_dulint_zero; + mutex_exit(&(recv_sys->mutex)); } @@ -1124,6 +1134,10 @@ recv_recover_page( mutex_enter(&(recv_sys->mutex)); + if (ut_dulint_cmp(recv_max_page_lsn, page_lsn) < 0) { + recv_max_page_lsn = page_lsn; + } + recv_addr->state = RECV_PROCESSED; ut_a(recv_sys->n_addrs); @@ -2192,9 +2206,12 @@ recv_scan_log_recs( while (log_block < buf + len && !finished) { no = log_block_get_hdr_no(log_block); +/* + fprintf(stderr, "Log block header no %lu\n", no); - /* fprintf(stderr, "Log block header no %lu\n", no); */ - + fprintf(stderr, "Scanned lsn no %lu\n", + log_block_convert_lsn_to_no(scanned_lsn)); +*/ if (no != log_block_convert_lsn_to_no(scanned_lsn) || !log_block_checksum_is_ok_or_old_format(log_block)) { @@ -2586,7 +2603,6 @@ recv_recovery_from_checkpoint_start( recv_group_scan_log_recs(group, &contiguous_lsn, &group_scanned_lsn); - group->scanned_lsn = group_scanned_lsn; if (ut_dulint_cmp(old_scanned_lsn, group_scanned_lsn) < 0) { @@ -2603,6 +2619,31 @@ recv_recovery_from_checkpoint_start( group = UT_LIST_GET_NEXT(log_groups, group); } + /* We currently have only one log group */ + if (ut_dulint_cmp(group_scanned_lsn, checkpoint_lsn) < 0) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: We were only able to scan the log up to\n" +"InnoDB: %lu %lu, but a checkpoint was at %lu %lu.\n" +"InnoDB: It is possible that the database is now corrupt!\n", + ut_dulint_get_high(group_scanned_lsn), + ut_dulint_get_low(group_scanned_lsn), + ut_dulint_get_high(checkpoint_lsn), + ut_dulint_get_low(checkpoint_lsn)); + } + + if (ut_dulint_cmp(group_scanned_lsn, recv_max_page_lsn) < 0) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: We were only able to scan the log up to %lu %lu\n" +"InnoDB: but a database page a had an lsn %lu %lu. It is possible that the\n" +"InnoDB: database is now corrupt!\n", + ut_dulint_get_high(group_scanned_lsn), + ut_dulint_get_low(group_scanned_lsn), + ut_dulint_get_high(recv_max_page_lsn), + ut_dulint_get_low(recv_max_page_lsn)); + } + if (ut_dulint_cmp(recv_sys->recovered_lsn, checkpoint_lsn) < 0) { mutex_exit(&(log_sys->mutex)); @@ -2656,6 +2697,8 @@ recv_recovery_from_checkpoint_start( sync_order_checks_on = FALSE; + recv_lsn_checks_on = TRUE; + /* The database is now ready to start almost normal processing of user transactions: transaction rollbacks and the application of the log records in the hash table can be run in background. */ diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index a9a64ae7864..7936b06c24d 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -1030,6 +1030,7 @@ os_file_flush( #ifdef HAVE_FDATASYNC ret = fdatasync(file); #else +/* printf("Flushing to file %lu\n", (ulint)file); */ ret = fsync(file); #endif os_n_fsyncs++; diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index f81b2d0a60e..f31d275eff0 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1798,8 +1798,12 @@ retry: os_fast_mutex_unlock(&srv_conc_mutex); + trx->op_info = (char*)"sleeping before joining InnoDB queue"; + os_thread_sleep(50000); + trx->op_info = (char*)""; + os_fast_mutex_lock(&srv_conc_mutex); srv_conc_n_waiting_threads--; @@ -2299,6 +2303,7 @@ srv_sprintf_innodb_monitor( char* buf_end = buf + len - 2000; double time_elapsed; time_t current_time; + ulint n_reserved; mutex_enter(&srv_innodb_monitor_mutex); @@ -2414,8 +2419,16 @@ srv_sprintf_innodb_monitor( "ROW OPERATIONS\n" "--------------\n"); buf += sprintf(buf, - "%ld queries inside InnoDB, %ld queries in queue\n", + "%ld queries inside InnoDB, %lu queries in queue\n", srv_conc_n_threads, srv_conc_n_waiting_threads); + + n_reserved = fil_space_get_n_reserved_extents(0); + if (n_reserved > 0) { + buf += sprintf(buf, + "%lu tablespace extents now reserved for B-tree split operations\n", + n_reserved); + } + #ifdef UNIV_LINUX buf += sprintf(buf, "Main thread process no. %lu, id %lu, state: %s\n", diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index e8d6c093680..47c39290b15 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -1624,6 +1624,13 @@ trx_print( } buf += sprintf(buf, "\n"); + + if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) { + + buf += sprintf(buf, "mysql tables in use %lu, locked %lu\n", + trx->n_mysql_tables_in_use, + trx->mysql_n_tables_locked); + } start_of_line = buf; From 34352d0c216536e0dea1b3df4ce7de40f61788a6 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sat, 26 Jul 2003 17:59:05 +0200 Subject: [PATCH 08/87] Make rpl_insert_id.test use InnoDB, and added foreign keys to the table, so that it really tests replication of SET FOREIGN_KEY_CHECKS (previously it used MyISAM). --- mysql-test/r/rpl_insert_id.result | 4 ++-- mysql-test/t/rpl_insert_id.test | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result index 0065d83f169..889e7891770 100644 --- a/mysql-test/r/rpl_insert_id.result +++ b/mysql-test/r/rpl_insert_id.result @@ -21,8 +21,8 @@ b c 1 4 drop table t1; drop table t2; -create table t1(a int auto_increment, key(a)); -create table t2(b int auto_increment, c int, key(b)); +create table t1(a int auto_increment, key(a)) type=innodb; +create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) type=innodb; SET FOREIGN_KEY_CHECKS=0; insert into t1 values (10); insert into t1 values (null),(null),(null); diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test index 26d5d3a9ed2..d91bd02883e 100644 --- a/mysql-test/t/rpl_insert_id.test +++ b/mysql-test/t/rpl_insert_id.test @@ -22,8 +22,10 @@ connection master; #are replicated the same way drop table t1; drop table t2; -create table t1(a int auto_increment, key(a)); -create table t2(b int auto_increment, c int, key(b)); +--disable_warnings +create table t1(a int auto_increment, key(a)) type=innodb; +create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) type=innodb; +--enable_warnings SET FOREIGN_KEY_CHECKS=0; insert into t1 values (10); insert into t1 values (null),(null),(null); From 4eccbd87cdaec8afaa83a26a34b858b32069d3ce Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Mon, 28 Jul 2003 15:33:46 +0200 Subject: [PATCH 09/87] Avoid segfault when LOAD DATA FROM MASTER is run on a master which does no binary logging. --- sql/repl_failsafe.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 1552b3994e9..0a5f90617d1 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -860,7 +860,7 @@ int load_master_data(THD* thd) of LOAD DATA FROM MASTER - no reason to forbid it, really, although it does not make much sense for the user to do it */ - if (row[0] && row[1]) + if (row && row[0] && row[1]) { strmake(active_mi->master_log_name, row[0], sizeof(active_mi->master_log_name)); From c46f888fe39fd93166cdc6ded6cbd04da1b2b836 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Mon, 28 Jul 2003 17:50:06 +0200 Subject: [PATCH 10/87] Followup to Jim's changes in mysqldoc tree. Unfortunately, it's too late for 4.0.14 :( --- Docs/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 26249028539..17450c3b072 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -40,10 +40,10 @@ paper: manual_a4.ps manual_letter.ps $(PDFMANUAL) # The Makefile contains the previous version so we can not use that include.texi: ../configure.in echo "@c This file is autogenerated by the Makefile" > $@ - echo -n "@set mysql_version " >> $@ + echo -n "@set mysqlversion " >> $@ grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \ sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> $@ - echo -n "@set default_port " >> $@ + echo -n "@set defaultport " >> $@ grep "MYSQL_TCP_PORT_DEFAULT=" ../configure.in | \ sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> $@ From a5eacc69e6a0571ab9c91dd60f43fce195d72a27 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Tue, 29 Jul 2003 00:04:56 +0300 Subject: [PATCH 11/87] mysqld.cc: innodb_fast_shutdown CAN take an argument though it was not specified so in mysqld.cc --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index cbd8ebd350b..41807285acc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3346,7 +3346,7 @@ struct my_option my_long_options[] = 0, 0, 0}, {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN, "Speeds up server shutdown process", (gptr*) &innobase_fast_shutdown, - (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT, "Percentage of dirty pages allowed in bufferpool", (gptr*) &srv_max_buf_pool_modified_pct, (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, From d7ea863d6b9d2648620122accc05cfd2cfc7c105 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Wed, 30 Jul 2003 01:12:33 +0300 Subject: [PATCH 12/87] dict0dict.c: Fix bug introduced in 4.0.13 and reported by Emic: if a CREATE TABLE ended in a comment, a memory overrun could happen --- innobase/dict/dict0dict.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index b1d7b5f762e..924fa3ecf95 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -2405,9 +2405,12 @@ dict_strip_comments( ptr = str; for (;;) { +scan_more: if (*sptr == '\0') { *ptr = '\0'; + ut_a(ptr <= str + strlen(sql_string)); + return(str); } @@ -2421,7 +2424,7 @@ dict_strip_comments( || *sptr == (char)0x0D || *sptr == '\0') { - break; + goto scan_more; } sptr++; @@ -2435,12 +2438,12 @@ dict_strip_comments( sptr += 2; - break; + goto scan_more; } if (*sptr == '\0') { - break; + goto scan_more; } sptr++; From 8f50cd04724b4daf54cd246a0599ef5902406099 Mon Sep 17 00:00:00 2001 From: "dlenev@mysql.com" <> Date: Wed, 30 Jul 2003 03:33:48 +0400 Subject: [PATCH 13/87] Fix security bug. mysqld server without ssl support was completly ignorant about ssl_type attribute --- BitKeeper/etc/logging_ok | 1 + sql/sql_acl.cc | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index e6124b4111e..edb3f4141da 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -15,6 +15,7 @@ bell@laptop.sanja.is.com.ua bell@sanja.is.com.ua bk@admin.bk davida@isil.mysql.com +dlenev@mysql.com gluh@gluh.(none) gluh@gluh.mysql.r18.ru greg@gcw.ath.cx diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 755a72bec32..1f311e651dd 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -530,7 +530,6 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, !check_scramble(password,message,acl_user->salt, (my_bool) old_ver))) { -#ifdef HAVE_OPENSSL Vio *vio=thd->net.vio; /* In this point we know that user is allowed to connect @@ -543,6 +542,7 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, case SSL_TYPE_NONE: /* SSL is not required to connect */ user_access=acl_user->access; break; +#ifdef HAVE_OPENSSL case SSL_TYPE_ANY: /* Any kind of SSL is good enough */ if (vio_type(vio) == VIO_TYPE_SSL) user_access=acl_user->access; @@ -625,10 +625,16 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, } break; } - } #else /* HAVE_OPENSSL */ - user_access=acl_user->access; + default: + /* + If we don't have SSL but SSL is required for this user the + authentication should fail. + */ + break; #endif /* HAVE_OPENSSL */ + } + *mqh=acl_user->user_resource; if (!acl_user->user) *priv_user=(char*) ""; // Change to anonymous user /* purecov: inspected */ From 86e6cf399e7594d022b31402f73c691d775b18ec Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Wed, 30 Jul 2003 14:59:56 +0300 Subject: [PATCH 14/87] support of more then 255 tables dependence in query cache (fixed BUG#930) --- mysql-test/r/query_cache.result | 535 +++++++++++++++++++++++++++++++- mysql-test/t/query_cache.test | 530 ++++++++++++++++++++++++++++++- sql/sql_cache.h | 2 +- 3 files changed, 1064 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 0ef0cab423b..e1fd5443580 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2,7 +2,7 @@ flush query cache; flush query cache; reset query cache; flush status; -drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; +drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00,mysqltest.t1; drop database if exists mysqltest; create table t1 (a int not null); insert into t1 values (1),(2),(3); @@ -640,3 +640,536 @@ Variable_name Value Qcache_queries_in_cache 2 SET OPTION SQL_SELECT_LIMIT=DEFAULT; drop table t1; +flush status; +create table t0(a int); +create table t1(a int); +create table t2(a int); +create table t3(a int); +create table t4(a int); +create table t5(a int); +create table t6(a int); +create table t7(a int); +create table t8(a int); +create table t9(a int); +create table t10(a int); +create table t11(a int); +create table t12(a int); +create table t13(a int); +create table t14(a int); +create table t15(a int); +create table t16(a int); +create table t17(a int); +create table t18(a int); +create table t19(a int); +create table t20(a int); +create table t21(a int); +create table t22(a int); +create table t23(a int); +create table t24(a int); +create table t25(a int); +create table t26(a int); +create table t27(a int); +create table t28(a int); +create table t29(a int); +create table t30(a int); +create table t31(a int); +create table t32(a int); +create table t33(a int); +create table t34(a int); +create table t35(a int); +create table t36(a int); +create table t37(a int); +create table t38(a int); +create table t39(a int); +create table t40(a int); +create table t41(a int); +create table t42(a int); +create table t43(a int); +create table t44(a int); +create table t45(a int); +create table t46(a int); +create table t47(a int); +create table t48(a int); +create table t49(a int); +create table t50(a int); +create table t51(a int); +create table t52(a int); +create table t53(a int); +create table t54(a int); +create table t55(a int); +create table t56(a int); +create table t57(a int); +create table t58(a int); +create table t59(a int); +create table t60(a int); +create table t61(a int); +create table t62(a int); +create table t63(a int); +create table t64(a int); +create table t65(a int); +create table t66(a int); +create table t67(a int); +create table t68(a int); +create table t69(a int); +create table t70(a int); +create table t71(a int); +create table t72(a int); +create table t73(a int); +create table t74(a int); +create table t75(a int); +create table t76(a int); +create table t77(a int); +create table t78(a int); +create table t79(a int); +create table t80(a int); +create table t81(a int); +create table t82(a int); +create table t83(a int); +create table t84(a int); +create table t85(a int); +create table t86(a int); +create table t87(a int); +create table t88(a int); +create table t89(a int); +create table t90(a int); +create table t91(a int); +create table t92(a int); +create table t93(a int); +create table t94(a int); +create table t95(a int); +create table t96(a int); +create table t97(a int); +create table t98(a int); +create table t99(a int); +create table t100(a int); +create table t101(a int); +create table t102(a int); +create table t103(a int); +create table t104(a int); +create table t105(a int); +create table t106(a int); +create table t107(a int); +create table t108(a int); +create table t109(a int); +create table t110(a int); +create table t111(a int); +create table t112(a int); +create table t113(a int); +create table t114(a int); +create table t115(a int); +create table t116(a int); +create table t117(a int); +create table t118(a int); +create table t119(a int); +create table t120(a int); +create table t121(a int); +create table t122(a int); +create table t123(a int); +create table t124(a int); +create table t125(a int); +create table t126(a int); +create table t127(a int); +create table t128(a int); +create table t129(a int); +create table t130(a int); +create table t131(a int); +create table t132(a int); +create table t133(a int); +create table t134(a int); +create table t135(a int); +create table t136(a int); +create table t137(a int); +create table t138(a int); +create table t139(a int); +create table t140(a int); +create table t141(a int); +create table t142(a int); +create table t143(a int); +create table t144(a int); +create table t145(a int); +create table t146(a int); +create table t147(a int); +create table t148(a int); +create table t149(a int); +create table t150(a int); +create table t151(a int); +create table t152(a int); +create table t153(a int); +create table t154(a int); +create table t155(a int); +create table t156(a int); +create table t157(a int); +create table t158(a int); +create table t159(a int); +create table t160(a int); +create table t161(a int); +create table t162(a int); +create table t163(a int); +create table t164(a int); +create table t165(a int); +create table t166(a int); +create table t167(a int); +create table t168(a int); +create table t169(a int); +create table t170(a int); +create table t171(a int); +create table t172(a int); +create table t173(a int); +create table t174(a int); +create table t175(a int); +create table t176(a int); +create table t177(a int); +create table t178(a int); +create table t179(a int); +create table t180(a int); +create table t181(a int); +create table t182(a int); +create table t183(a int); +create table t184(a int); +create table t185(a int); +create table t186(a int); +create table t187(a int); +create table t188(a int); +create table t189(a int); +create table t190(a int); +create table t191(a int); +create table t192(a int); +create table t193(a int); +create table t194(a int); +create table t195(a int); +create table t196(a int); +create table t197(a int); +create table t198(a int); +create table t199(a int); +create table t200(a int); +create table t201(a int); +create table t202(a int); +create table t203(a int); +create table t204(a int); +create table t205(a int); +create table t206(a int); +create table t207(a int); +create table t208(a int); +create table t209(a int); +create table t210(a int); +create table t211(a int); +create table t212(a int); +create table t213(a int); +create table t214(a int); +create table t215(a int); +create table t216(a int); +create table t217(a int); +create table t218(a int); +create table t219(a int); +create table t220(a int); +create table t221(a int); +create table t222(a int); +create table t223(a int); +create table t224(a int); +create table t225(a int); +create table t226(a int); +create table t227(a int); +create table t228(a int); +create table t229(a int); +create table t230(a int); +create table t231(a int); +create table t232(a int); +create table t233(a int); +create table t234(a int); +create table t235(a int); +create table t236(a int); +create table t237(a int); +create table t238(a int); +create table t239(a int); +create table t240(a int); +create table t241(a int); +create table t242(a int); +create table t243(a int); +create table t244(a int); +create table t245(a int); +create table t246(a int); +create table t247(a int); +create table t248(a int); +create table t249(a int); +create table t250(a int); +create table t251(a int); +create table t252(a int); +create table t253(a int); +create table t254(a int); +create table t255(a int); +create table t256(a int); +create table t00 (a int) type=MERGE UNION=(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256) INSERT_METHOD=FIRST; +insert into t0 values (1),(2); +insert into t1 values (1),(2); +insert into t2 values (1),(2); +insert into t3 values (1),(2); +insert into t4 values (1),(2); +insert into t5 values (1),(2); +insert into t6 values (1),(2); +insert into t7 values (1),(2); +insert into t8 values (1),(2); +insert into t9 values (1),(2); +insert into t10 values (1),(2); +insert into t11 values (1),(2); +insert into t12 values (1),(2); +insert into t13 values (1),(2); +insert into t14 values (1),(2); +insert into t15 values (1),(2); +insert into t16 values (1),(2); +insert into t17 values (1),(2); +insert into t18 values (1),(2); +insert into t19 values (1),(2); +insert into t20 values (1),(2); +insert into t21 values (1),(2); +insert into t22 values (1),(2); +insert into t23 values (1),(2); +insert into t24 values (1),(2); +insert into t25 values (1),(2); +insert into t26 values (1),(2); +insert into t27 values (1),(2); +insert into t28 values (1),(2); +insert into t29 values (1),(2); +insert into t30 values (1),(2); +insert into t31 values (1),(2); +insert into t32 values (1),(2); +insert into t33 values (1),(2); +insert into t34 values (1),(2); +insert into t35 values (1),(2); +insert into t36 values (1),(2); +insert into t37 values (1),(2); +insert into t38 values (1),(2); +insert into t39 values (1),(2); +insert into t40 values (1),(2); +insert into t41 values (1),(2); +insert into t42 values (1),(2); +insert into t43 values (1),(2); +insert into t44 values (1),(2); +insert into t45 values (1),(2); +insert into t46 values (1),(2); +insert into t47 values (1),(2); +insert into t48 values (1),(2); +insert into t49 values (1),(2); +insert into t50 values (1),(2); +insert into t51 values (1),(2); +insert into t52 values (1),(2); +insert into t53 values (1),(2); +insert into t54 values (1),(2); +insert into t55 values (1),(2); +insert into t56 values (1),(2); +insert into t57 values (1),(2); +insert into t58 values (1),(2); +insert into t59 values (1),(2); +insert into t60 values (1),(2); +insert into t61 values (1),(2); +insert into t62 values (1),(2); +insert into t63 values (1),(2); +insert into t64 values (1),(2); +insert into t65 values (1),(2); +insert into t66 values (1),(2); +insert into t67 values (1),(2); +insert into t68 values (1),(2); +insert into t69 values (1),(2); +insert into t70 values (1),(2); +insert into t71 values (1),(2); +insert into t72 values (1),(2); +insert into t73 values (1),(2); +insert into t74 values (1),(2); +insert into t75 values (1),(2); +insert into t76 values (1),(2); +insert into t77 values (1),(2); +insert into t78 values (1),(2); +insert into t79 values (1),(2); +insert into t80 values (1),(2); +insert into t81 values (1),(2); +insert into t82 values (1),(2); +insert into t83 values (1),(2); +insert into t84 values (1),(2); +insert into t85 values (1),(2); +insert into t86 values (1),(2); +insert into t87 values (1),(2); +insert into t88 values (1),(2); +insert into t89 values (1),(2); +insert into t90 values (1),(2); +insert into t91 values (1),(2); +insert into t92 values (1),(2); +insert into t93 values (1),(2); +insert into t94 values (1),(2); +insert into t95 values (1),(2); +insert into t96 values (1),(2); +insert into t97 values (1),(2); +insert into t98 values (1),(2); +insert into t99 values (1),(2); +insert into t100 values (1),(2); +insert into t101 values (1),(2); +insert into t102 values (1),(2); +insert into t103 values (1),(2); +insert into t104 values (1),(2); +insert into t105 values (1),(2); +insert into t106 values (1),(2); +insert into t107 values (1),(2); +insert into t108 values (1),(2); +insert into t109 values (1),(2); +insert into t110 values (1),(2); +insert into t111 values (1),(2); +insert into t112 values (1),(2); +insert into t113 values (1),(2); +insert into t114 values (1),(2); +insert into t115 values (1),(2); +insert into t116 values (1),(2); +insert into t117 values (1),(2); +insert into t118 values (1),(2); +insert into t119 values (1),(2); +insert into t120 values (1),(2); +insert into t121 values (1),(2); +insert into t122 values (1),(2); +insert into t123 values (1),(2); +insert into t124 values (1),(2); +insert into t125 values (1),(2); +insert into t126 values (1),(2); +insert into t127 values (1),(2); +insert into t128 values (1),(2); +insert into t129 values (1),(2); +insert into t130 values (1),(2); +insert into t131 values (1),(2); +insert into t132 values (1),(2); +insert into t133 values (1),(2); +insert into t134 values (1),(2); +insert into t135 values (1),(2); +insert into t136 values (1),(2); +insert into t137 values (1),(2); +insert into t138 values (1),(2); +insert into t139 values (1),(2); +insert into t140 values (1),(2); +insert into t141 values (1),(2); +insert into t142 values (1),(2); +insert into t143 values (1),(2); +insert into t144 values (1),(2); +insert into t145 values (1),(2); +insert into t146 values (1),(2); +insert into t147 values (1),(2); +insert into t148 values (1),(2); +insert into t149 values (1),(2); +insert into t150 values (1),(2); +insert into t151 values (1),(2); +insert into t152 values (1),(2); +insert into t153 values (1),(2); +insert into t154 values (1),(2); +insert into t155 values (1),(2); +insert into t156 values (1),(2); +insert into t157 values (1),(2); +insert into t158 values (1),(2); +insert into t159 values (1),(2); +insert into t160 values (1),(2); +insert into t161 values (1),(2); +insert into t162 values (1),(2); +insert into t163 values (1),(2); +insert into t164 values (1),(2); +insert into t165 values (1),(2); +insert into t166 values (1),(2); +insert into t167 values (1),(2); +insert into t168 values (1),(2); +insert into t169 values (1),(2); +insert into t170 values (1),(2); +insert into t171 values (1),(2); +insert into t172 values (1),(2); +insert into t173 values (1),(2); +insert into t174 values (1),(2); +insert into t175 values (1),(2); +insert into t176 values (1),(2); +insert into t177 values (1),(2); +insert into t178 values (1),(2); +insert into t179 values (1),(2); +insert into t180 values (1),(2); +insert into t181 values (1),(2); +insert into t182 values (1),(2); +insert into t183 values (1),(2); +insert into t184 values (1),(2); +insert into t185 values (1),(2); +insert into t186 values (1),(2); +insert into t187 values (1),(2); +insert into t188 values (1),(2); +insert into t189 values (1),(2); +insert into t190 values (1),(2); +insert into t191 values (1),(2); +insert into t192 values (1),(2); +insert into t193 values (1),(2); +insert into t194 values (1),(2); +insert into t195 values (1),(2); +insert into t196 values (1),(2); +insert into t197 values (1),(2); +insert into t198 values (1),(2); +insert into t199 values (1),(2); +insert into t200 values (1),(2); +insert into t201 values (1),(2); +insert into t202 values (1),(2); +insert into t203 values (1),(2); +insert into t204 values (1),(2); +insert into t205 values (1),(2); +insert into t206 values (1),(2); +insert into t207 values (1),(2); +insert into t208 values (1),(2); +insert into t209 values (1),(2); +insert into t210 values (1),(2); +insert into t211 values (1),(2); +insert into t212 values (1),(2); +insert into t213 values (1),(2); +insert into t214 values (1),(2); +insert into t215 values (1),(2); +insert into t216 values (1),(2); +insert into t217 values (1),(2); +insert into t218 values (1),(2); +insert into t219 values (1),(2); +insert into t220 values (1),(2); +insert into t221 values (1),(2); +insert into t222 values (1),(2); +insert into t223 values (1),(2); +insert into t224 values (1),(2); +insert into t225 values (1),(2); +insert into t226 values (1),(2); +insert into t227 values (1),(2); +insert into t228 values (1),(2); +insert into t229 values (1),(2); +insert into t230 values (1),(2); +insert into t231 values (1),(2); +insert into t232 values (1),(2); +insert into t233 values (1),(2); +insert into t234 values (1),(2); +insert into t235 values (1),(2); +insert into t236 values (1),(2); +insert into t237 values (1),(2); +insert into t238 values (1),(2); +insert into t239 values (1),(2); +insert into t240 values (1),(2); +insert into t241 values (1),(2); +insert into t242 values (1),(2); +insert into t243 values (1),(2); +insert into t244 values (1),(2); +insert into t245 values (1),(2); +insert into t246 values (1),(2); +insert into t247 values (1),(2); +insert into t248 values (1),(2); +insert into t249 values (1),(2); +insert into t250 values (1),(2); +insert into t251 values (1),(2); +insert into t252 values (1),(2); +insert into t253 values (1),(2); +insert into t254 values (1),(2); +insert into t255 values (1),(2); +insert into t256 values (1),(2); +select count(*) from t00; +count(*) +514 +select count(*) from t00; +count(*) +514 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +delete from t256; +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 +drop table t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index fe258b2c7e1..6907a9e8299 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -10,7 +10,7 @@ flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush status; -drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; +drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00,mysqltest.t1; drop database if exists mysqltest; # @@ -450,3 +450,531 @@ select * from t1; show status like "Qcache_queries_in_cache"; SET OPTION SQL_SELECT_LIMIT=DEFAULT; drop table t1; + +# +# more then 255 (257) merged tables test +# +flush status; +create table t0(a int); +create table t1(a int); +create table t2(a int); +create table t3(a int); +create table t4(a int); +create table t5(a int); +create table t6(a int); +create table t7(a int); +create table t8(a int); +create table t9(a int); +create table t10(a int); +create table t11(a int); +create table t12(a int); +create table t13(a int); +create table t14(a int); +create table t15(a int); +create table t16(a int); +create table t17(a int); +create table t18(a int); +create table t19(a int); +create table t20(a int); +create table t21(a int); +create table t22(a int); +create table t23(a int); +create table t24(a int); +create table t25(a int); +create table t26(a int); +create table t27(a int); +create table t28(a int); +create table t29(a int); +create table t30(a int); +create table t31(a int); +create table t32(a int); +create table t33(a int); +create table t34(a int); +create table t35(a int); +create table t36(a int); +create table t37(a int); +create table t38(a int); +create table t39(a int); +create table t40(a int); +create table t41(a int); +create table t42(a int); +create table t43(a int); +create table t44(a int); +create table t45(a int); +create table t46(a int); +create table t47(a int); +create table t48(a int); +create table t49(a int); +create table t50(a int); +create table t51(a int); +create table t52(a int); +create table t53(a int); +create table t54(a int); +create table t55(a int); +create table t56(a int); +create table t57(a int); +create table t58(a int); +create table t59(a int); +create table t60(a int); +create table t61(a int); +create table t62(a int); +create table t63(a int); +create table t64(a int); +create table t65(a int); +create table t66(a int); +create table t67(a int); +create table t68(a int); +create table t69(a int); +create table t70(a int); +create table t71(a int); +create table t72(a int); +create table t73(a int); +create table t74(a int); +create table t75(a int); +create table t76(a int); +create table t77(a int); +create table t78(a int); +create table t79(a int); +create table t80(a int); +create table t81(a int); +create table t82(a int); +create table t83(a int); +create table t84(a int); +create table t85(a int); +create table t86(a int); +create table t87(a int); +create table t88(a int); +create table t89(a int); +create table t90(a int); +create table t91(a int); +create table t92(a int); +create table t93(a int); +create table t94(a int); +create table t95(a int); +create table t96(a int); +create table t97(a int); +create table t98(a int); +create table t99(a int); +create table t100(a int); +create table t101(a int); +create table t102(a int); +create table t103(a int); +create table t104(a int); +create table t105(a int); +create table t106(a int); +create table t107(a int); +create table t108(a int); +create table t109(a int); +create table t110(a int); +create table t111(a int); +create table t112(a int); +create table t113(a int); +create table t114(a int); +create table t115(a int); +create table t116(a int); +create table t117(a int); +create table t118(a int); +create table t119(a int); +create table t120(a int); +create table t121(a int); +create table t122(a int); +create table t123(a int); +create table t124(a int); +create table t125(a int); +create table t126(a int); +create table t127(a int); +create table t128(a int); +create table t129(a int); +create table t130(a int); +create table t131(a int); +create table t132(a int); +create table t133(a int); +create table t134(a int); +create table t135(a int); +create table t136(a int); +create table t137(a int); +create table t138(a int); +create table t139(a int); +create table t140(a int); +create table t141(a int); +create table t142(a int); +create table t143(a int); +create table t144(a int); +create table t145(a int); +create table t146(a int); +create table t147(a int); +create table t148(a int); +create table t149(a int); +create table t150(a int); +create table t151(a int); +create table t152(a int); +create table t153(a int); +create table t154(a int); +create table t155(a int); +create table t156(a int); +create table t157(a int); +create table t158(a int); +create table t159(a int); +create table t160(a int); +create table t161(a int); +create table t162(a int); +create table t163(a int); +create table t164(a int); +create table t165(a int); +create table t166(a int); +create table t167(a int); +create table t168(a int); +create table t169(a int); +create table t170(a int); +create table t171(a int); +create table t172(a int); +create table t173(a int); +create table t174(a int); +create table t175(a int); +create table t176(a int); +create table t177(a int); +create table t178(a int); +create table t179(a int); +create table t180(a int); +create table t181(a int); +create table t182(a int); +create table t183(a int); +create table t184(a int); +create table t185(a int); +create table t186(a int); +create table t187(a int); +create table t188(a int); +create table t189(a int); +create table t190(a int); +create table t191(a int); +create table t192(a int); +create table t193(a int); +create table t194(a int); +create table t195(a int); +create table t196(a int); +create table t197(a int); +create table t198(a int); +create table t199(a int); +create table t200(a int); +create table t201(a int); +create table t202(a int); +create table t203(a int); +create table t204(a int); +create table t205(a int); +create table t206(a int); +create table t207(a int); +create table t208(a int); +create table t209(a int); +create table t210(a int); +create table t211(a int); +create table t212(a int); +create table t213(a int); +create table t214(a int); +create table t215(a int); +create table t216(a int); +create table t217(a int); +create table t218(a int); +create table t219(a int); +create table t220(a int); +create table t221(a int); +create table t222(a int); +create table t223(a int); +create table t224(a int); +create table t225(a int); +create table t226(a int); +create table t227(a int); +create table t228(a int); +create table t229(a int); +create table t230(a int); +create table t231(a int); +create table t232(a int); +create table t233(a int); +create table t234(a int); +create table t235(a int); +create table t236(a int); +create table t237(a int); +create table t238(a int); +create table t239(a int); +create table t240(a int); +create table t241(a int); +create table t242(a int); +create table t243(a int); +create table t244(a int); +create table t245(a int); +create table t246(a int); +create table t247(a int); +create table t248(a int); +create table t249(a int); +create table t250(a int); +create table t251(a int); +create table t252(a int); +create table t253(a int); +create table t254(a int); +create table t255(a int); +create table t256(a int); +create table t00 (a int) type=MERGE UNION=(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256) INSERT_METHOD=FIRST; +insert into t0 values (1),(2); +insert into t1 values (1),(2); +insert into t2 values (1),(2); +insert into t3 values (1),(2); +insert into t4 values (1),(2); +insert into t5 values (1),(2); +insert into t6 values (1),(2); +insert into t7 values (1),(2); +insert into t8 values (1),(2); +insert into t9 values (1),(2); +insert into t10 values (1),(2); +insert into t11 values (1),(2); +insert into t12 values (1),(2); +insert into t13 values (1),(2); +insert into t14 values (1),(2); +insert into t15 values (1),(2); +insert into t16 values (1),(2); +insert into t17 values (1),(2); +insert into t18 values (1),(2); +insert into t19 values (1),(2); +insert into t20 values (1),(2); +insert into t21 values (1),(2); +insert into t22 values (1),(2); +insert into t23 values (1),(2); +insert into t24 values (1),(2); +insert into t25 values (1),(2); +insert into t26 values (1),(2); +insert into t27 values (1),(2); +insert into t28 values (1),(2); +insert into t29 values (1),(2); +insert into t30 values (1),(2); +insert into t31 values (1),(2); +insert into t32 values (1),(2); +insert into t33 values (1),(2); +insert into t34 values (1),(2); +insert into t35 values (1),(2); +insert into t36 values (1),(2); +insert into t37 values (1),(2); +insert into t38 values (1),(2); +insert into t39 values (1),(2); +insert into t40 values (1),(2); +insert into t41 values (1),(2); +insert into t42 values (1),(2); +insert into t43 values (1),(2); +insert into t44 values (1),(2); +insert into t45 values (1),(2); +insert into t46 values (1),(2); +insert into t47 values (1),(2); +insert into t48 values (1),(2); +insert into t49 values (1),(2); +insert into t50 values (1),(2); +insert into t51 values (1),(2); +insert into t52 values (1),(2); +insert into t53 values (1),(2); +insert into t54 values (1),(2); +insert into t55 values (1),(2); +insert into t56 values (1),(2); +insert into t57 values (1),(2); +insert into t58 values (1),(2); +insert into t59 values (1),(2); +insert into t60 values (1),(2); +insert into t61 values (1),(2); +insert into t62 values (1),(2); +insert into t63 values (1),(2); +insert into t64 values (1),(2); +insert into t65 values (1),(2); +insert into t66 values (1),(2); +insert into t67 values (1),(2); +insert into t68 values (1),(2); +insert into t69 values (1),(2); +insert into t70 values (1),(2); +insert into t71 values (1),(2); +insert into t72 values (1),(2); +insert into t73 values (1),(2); +insert into t74 values (1),(2); +insert into t75 values (1),(2); +insert into t76 values (1),(2); +insert into t77 values (1),(2); +insert into t78 values (1),(2); +insert into t79 values (1),(2); +insert into t80 values (1),(2); +insert into t81 values (1),(2); +insert into t82 values (1),(2); +insert into t83 values (1),(2); +insert into t84 values (1),(2); +insert into t85 values (1),(2); +insert into t86 values (1),(2); +insert into t87 values (1),(2); +insert into t88 values (1),(2); +insert into t89 values (1),(2); +insert into t90 values (1),(2); +insert into t91 values (1),(2); +insert into t92 values (1),(2); +insert into t93 values (1),(2); +insert into t94 values (1),(2); +insert into t95 values (1),(2); +insert into t96 values (1),(2); +insert into t97 values (1),(2); +insert into t98 values (1),(2); +insert into t99 values (1),(2); +insert into t100 values (1),(2); +insert into t101 values (1),(2); +insert into t102 values (1),(2); +insert into t103 values (1),(2); +insert into t104 values (1),(2); +insert into t105 values (1),(2); +insert into t106 values (1),(2); +insert into t107 values (1),(2); +insert into t108 values (1),(2); +insert into t109 values (1),(2); +insert into t110 values (1),(2); +insert into t111 values (1),(2); +insert into t112 values (1),(2); +insert into t113 values (1),(2); +insert into t114 values (1),(2); +insert into t115 values (1),(2); +insert into t116 values (1),(2); +insert into t117 values (1),(2); +insert into t118 values (1),(2); +insert into t119 values (1),(2); +insert into t120 values (1),(2); +insert into t121 values (1),(2); +insert into t122 values (1),(2); +insert into t123 values (1),(2); +insert into t124 values (1),(2); +insert into t125 values (1),(2); +insert into t126 values (1),(2); +insert into t127 values (1),(2); +insert into t128 values (1),(2); +insert into t129 values (1),(2); +insert into t130 values (1),(2); +insert into t131 values (1),(2); +insert into t132 values (1),(2); +insert into t133 values (1),(2); +insert into t134 values (1),(2); +insert into t135 values (1),(2); +insert into t136 values (1),(2); +insert into t137 values (1),(2); +insert into t138 values (1),(2); +insert into t139 values (1),(2); +insert into t140 values (1),(2); +insert into t141 values (1),(2); +insert into t142 values (1),(2); +insert into t143 values (1),(2); +insert into t144 values (1),(2); +insert into t145 values (1),(2); +insert into t146 values (1),(2); +insert into t147 values (1),(2); +insert into t148 values (1),(2); +insert into t149 values (1),(2); +insert into t150 values (1),(2); +insert into t151 values (1),(2); +insert into t152 values (1),(2); +insert into t153 values (1),(2); +insert into t154 values (1),(2); +insert into t155 values (1),(2); +insert into t156 values (1),(2); +insert into t157 values (1),(2); +insert into t158 values (1),(2); +insert into t159 values (1),(2); +insert into t160 values (1),(2); +insert into t161 values (1),(2); +insert into t162 values (1),(2); +insert into t163 values (1),(2); +insert into t164 values (1),(2); +insert into t165 values (1),(2); +insert into t166 values (1),(2); +insert into t167 values (1),(2); +insert into t168 values (1),(2); +insert into t169 values (1),(2); +insert into t170 values (1),(2); +insert into t171 values (1),(2); +insert into t172 values (1),(2); +insert into t173 values (1),(2); +insert into t174 values (1),(2); +insert into t175 values (1),(2); +insert into t176 values (1),(2); +insert into t177 values (1),(2); +insert into t178 values (1),(2); +insert into t179 values (1),(2); +insert into t180 values (1),(2); +insert into t181 values (1),(2); +insert into t182 values (1),(2); +insert into t183 values (1),(2); +insert into t184 values (1),(2); +insert into t185 values (1),(2); +insert into t186 values (1),(2); +insert into t187 values (1),(2); +insert into t188 values (1),(2); +insert into t189 values (1),(2); +insert into t190 values (1),(2); +insert into t191 values (1),(2); +insert into t192 values (1),(2); +insert into t193 values (1),(2); +insert into t194 values (1),(2); +insert into t195 values (1),(2); +insert into t196 values (1),(2); +insert into t197 values (1),(2); +insert into t198 values (1),(2); +insert into t199 values (1),(2); +insert into t200 values (1),(2); +insert into t201 values (1),(2); +insert into t202 values (1),(2); +insert into t203 values (1),(2); +insert into t204 values (1),(2); +insert into t205 values (1),(2); +insert into t206 values (1),(2); +insert into t207 values (1),(2); +insert into t208 values (1),(2); +insert into t209 values (1),(2); +insert into t210 values (1),(2); +insert into t211 values (1),(2); +insert into t212 values (1),(2); +insert into t213 values (1),(2); +insert into t214 values (1),(2); +insert into t215 values (1),(2); +insert into t216 values (1),(2); +insert into t217 values (1),(2); +insert into t218 values (1),(2); +insert into t219 values (1),(2); +insert into t220 values (1),(2); +insert into t221 values (1),(2); +insert into t222 values (1),(2); +insert into t223 values (1),(2); +insert into t224 values (1),(2); +insert into t225 values (1),(2); +insert into t226 values (1),(2); +insert into t227 values (1),(2); +insert into t228 values (1),(2); +insert into t229 values (1),(2); +insert into t230 values (1),(2); +insert into t231 values (1),(2); +insert into t232 values (1),(2); +insert into t233 values (1),(2); +insert into t234 values (1),(2); +insert into t235 values (1),(2); +insert into t236 values (1),(2); +insert into t237 values (1),(2); +insert into t238 values (1),(2); +insert into t239 values (1),(2); +insert into t240 values (1),(2); +insert into t241 values (1),(2); +insert into t242 values (1),(2); +insert into t243 values (1),(2); +insert into t244 values (1),(2); +insert into t245 values (1),(2); +insert into t246 values (1),(2); +insert into t247 values (1),(2); +insert into t248 values (1),(2); +insert into t249 values (1),(2); +insert into t250 values (1),(2); +insert into t251 values (1),(2); +insert into t252 values (1),(2); +insert into t253 values (1),(2); +insert into t254 values (1),(2); +insert into t255 values (1),(2); +insert into t256 values (1),(2); +enable_result_log; +select count(*) from t00; +select count(*) from t00; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +delete from t256; +show status like "Qcache_queries_in_cache"; +drop table t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00; diff --git a/sql/sql_cache.h b/sql/sql_cache.h index b15df28f54b..74b1a6cee96 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -61,7 +61,7 @@ #define QUERY_CACHE_PACK_ITERATION 2 #define QUERY_CACHE_PACK_LIMIT (512*1024L) -#define TABLE_COUNTER_TYPE uint8 +#define TABLE_COUNTER_TYPE uint struct Query_cache_block; struct Query_cache_block_table; From c8c7aab6a016678429a276f6cd9e9e498294ba82 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Wed, 30 Jul 2003 16:15:10 +0200 Subject: [PATCH 15/87] Bug#937 myisamchk.c: help text clarified mi_check.c: allow one to "analyze" empty table :) --- myisam/mi_check.c | 11 ++++++----- myisam/myisamchk.c | 10 +++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 6caacd95386..4b28a88fc6e 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -3562,11 +3562,12 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update) uint i, key_parts= mi_uint2korr(share->state.header.key_parts); share->state.rec_per_key_rows=info->state->records; share->state.changed&= ~STATE_NOT_ANALYZED; - for (i=0; istate.rec_per_key_part[i]=param->rec_per_key_part[i])) - share->state.changed|= STATE_NOT_ANALYZED; - } + if (info->state->records) + for (i=0; istate.rec_per_key_part[i]=param->rec_per_key_part[i])) + share->state.changed|= STATE_NOT_ANALYZED; + } } if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC)) { diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 882f868e326..1a27e9debe8 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -357,11 +357,15 @@ static void usage(void) -e, --extend-check Check the table VERY throughly. Only use this in\n\ extreme cases as myisamchk should normally be able to\n\ find out if the table is ok even without this switch\n\ - -F, --fast Check only tables that haven't been closed properly\n\ - -C, --check-only-changed\n\ - Check only tables that have changed since last check\n\ + -F, --fast Check only tables that haven't been closed properly.\n\ + It also applies to other requested actions (e.g. --analyze\n\ + will be ignored if the table is already analyzed).\n\ -f, --force Restart with '-r' if there are any errors in the table.\n\ States will be updated as with '--update-state'\n\ + -C, --check-only-changed\n\ + Check only tables that have changed since last check.\n\ + It also applies to other requested actions (e.g. --analyze\n\ + will be ignored if the table is already analyzed).\n\ -i, --information Print statistics information about table that is checked\n\ -m, --medium-check Faster than extend-check, but only finds 99.99% of\n\ all errors. Should be good enough for most cases\n\ From 99df703bcb688a70f283bf66c5c6a2c4061b9461 Mon Sep 17 00:00:00 2001 From: "wax@mysql.com" <> Date: Thu, 31 Jul 2003 04:14:36 +0600 Subject: [PATCH 16/87] BUG Add functions SetFilePointerEx and SetEndOfFile for huge tables instead of chsize Move chsize to right place --- BitKeeper/etc/logging_ok | 1 + include/config-win.h | 1 + mysys/my_chsize.c | 55 ++++++++++++++++++++++++++++------------ 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index be9d7b77650..a0a2edc0b96 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -109,6 +109,7 @@ vva@eagle.mysql.r18.ru vva@genie.(none) walrus@kishkin.ru walrus@mysql.com +wax@mysql.com worm@altair.is.lan zak@balfor.local zak@linux.local diff --git a/include/config-win.h b/include/config-win.h index 69020636893..cde77a6e0aa 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -276,6 +276,7 @@ inline double ulonglong2double(ulonglong value) #define HAVE_ISAM /* We want to have support for ISAM in 4.0 */ #define HAVE_QUERY_CACHE #define SPRINTF_RETURNS_INT +#define HAVE_SETFILEPOINTER /* SetFilePointer function for huge files */ #ifdef NOT_USED #define HAVE_SNPRINTF /* Gave link error */ diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c index 06e8f159f4a..0840a7a69e4 100644 --- a/mysys/my_chsize.c +++ b/mysys/my_chsize.c @@ -36,24 +36,11 @@ 0 Ok 1 Error */ - int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) { DBUG_ENTER("my_chsize"); DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength, MyFlags)); - -#ifdef HAVE_CHSIZE - if (chsize(fd,(off_t) newlength)) - { - DBUG_PRINT("error",("errno: %d",errno)); - my_errno=errno; - if (MyFlags & MY_WME) - my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); - DBUG_RETURN(1); - } - DBUG_RETURN(0); -#else /* if file is shorter, expand with null, else fill unused part with null */ { my_off_t oldsize; @@ -62,7 +49,42 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE)); DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize)); -#ifdef HAVE_FTRUNCATE +#ifdef HAVE_CHSIZE + if (oldsize > newlength || filler == 0) + { + if (chsize(fd,(off_t) newlength)) + { + DBUG_PRINT("error",("errno: %d",errno)); + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); + DBUG_RETURN(1); + } + else + { + if (filler == 0) + DBUG_RETURN(0); + } + } +#elif defined(HAVE_SETFILEPOINTER) + if (oldsize > newlength) + { + LARGE_INTEGER new_length; + HANDLE win_file; + win_file= (HANDLE)_get_osfhandle(fd); + new_length.QuadPart = newlength; + if (SetFilePointerEx(win_file,new_length,NULL,FILE_BEGIN)) + { + if (SetEndOfFile(win_file)) + DBUG_RETURN(0); + } + DBUG_PRINT("error",("errno: %d",errno)); + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); + DBUG_RETURN(1); + } +#elif defined(HAVE_FTRUNCATE) if (oldsize > newlength) { if (ftruncate(fd, (off_t) newlength)) @@ -99,5 +121,6 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) DBUG_PRINT("error",("errno: %d",my_errno)); DBUG_RETURN(1); } -#endif -} /* my_chsize */ +} /* my_chsize */ + + From fb5a1da62177b5cfe27cdd4c8a9f5e8f6f91db5a Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 31 Jul 2003 13:45:35 +0200 Subject: [PATCH 17/87] bug #942. docid == ftb->lastpos in join on looping over nested table --- myisam/ft_boolean_search.c | 4 ++-- mysql-test/r/fulltext.result | 11 +++++++++++ mysql-test/t/fulltext.test | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index ed6bf1808a9..6a7b7531d4d 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -299,7 +299,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, default_charset_info : info->s->keyinfo[keynr].seg->charset); ftb->with_scan=0; - ftb->lastpos=0; + ftb->lastpos=HA_POS_ERROR; bzero(& ftb->no_dupes, sizeof(TREE)); init_alloc_root(&ftb->mem_root, 1024, 1024); @@ -543,7 +543,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) if (!ftb->queue.elements) return 0; - if (ftb->state != INDEX_SEARCH && docid < ftb->lastpos) + if (ftb->state != INDEX_SEARCH && docid <= ftb->lastpos) { FTB_EXPR *x; uint i; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 646c1a7bee2..737390865f1 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -256,3 +256,14 @@ select ref_mag from t1 where match ref_mag against ('+test' in boolean mode); ref_mag test drop table t1; +create table t1 (t1_id int(11) primary key, name varchar(32)); +insert into t1 values (1, 'data1'); +insert into t1 values (2, 'data2'); +create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)); +insert into t2 values (1, 1, 'xxfoo'); +insert into t2 values (2, 1, 'xxbar'); +insert into t2 values (3, 1, 'xxbuz'); +select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); +t1_id name t2_id t1_id name +1 data1 1 1 xxfoo +drop table t1,t2; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 942552f5e98..387a36f1f52 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -189,7 +189,7 @@ select * from t1 where match (a) against ('aaaa'); drop table t1; # -# bug 283 by jocelyn fournier +# bug #283 by jocelyn fournier # FULLTEXT index on a TEXT filed converted to a CHAR field doesn't work anymore # @@ -201,3 +201,17 @@ alter table t1 change ref_mag ref_mag char (255) not null; select ref_mag from t1 where match ref_mag against ('+test' in boolean mode); drop table t1; +# +# bug #942: JOIN +# + +create table t1 (t1_id int(11) primary key, name varchar(32)); +insert into t1 values (1, 'data1'); +insert into t1 values (2, 'data2'); +create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)); +insert into t2 values (1, 1, 'xxfoo'); +insert into t2 values (2, 1, 'xxbar'); +insert into t2 values (3, 1, 'xxbuz'); +select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); +drop table t1,t2; + From 216ca1e15d4abff653ff22c549a33c2e4c8905f8 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Fri, 1 Aug 2003 10:09:23 +0200 Subject: [PATCH 18/87] - fixed BUG#968 ("test: argument expected" error) - thanks to Alex Kiernan for the patch --- scripts/mysql_fix_privilege_tables.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 526b7ac91b3..7ba42e560bb 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -4,7 +4,7 @@ root_password="$1" host="localhost" user="root" -if test -z $1 ; then +if test -z "$1" ; then cmd="@bindir@/mysql -f --user=$user --host=$host mysql" else root_password="$1" From 3c007c3de99def8c2294b67669132fcacd82d657 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Fri, 1 Aug 2003 10:21:41 +0200 Subject: [PATCH 19/87] - portability fixes: put string tests in double quotes (BUG#974). Thanks to Alex Kiernan for the hint. --- acinclude.m4 | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index b558e952543..3b9b7ce13b6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -50,7 +50,7 @@ mysql_cv_btype_last_arg_accept=none ], [int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0); return (a != 0);], mysql_cv_btype_last_arg_accept=socklen_t)] -if test $mysql_cv_btype_last_arg_accept = none; then +if test "$mysql_cv_btype_last_arg_accept" = "none"; then [AC_TRY_COMPILE([#if defined(inline) #undef inline #endif @@ -61,7 +61,7 @@ if test $mysql_cv_btype_last_arg_accept = none; then [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0); return (a != 0);], mysql_cv_btype_last_arg_accept=size_t)] fi -if test $mysql_cv_btype_last_arg_accept = none; then +if test "$mysql_cv_btype_last_arg_accept" = "none"; then mysql_cv_btype_last_arg_accept=int fi) AC_LANG_RESTORE @@ -353,11 +353,11 @@ AC_CACHE_VAL(mysql_cv_termcap_lib, [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap, mysql_cv_termcap_lib=NOT_FOUND)])])]) AC_MSG_CHECKING(for termcap functions library) -if test $mysql_cv_termcap_lib = NOT_FOUND; then +if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then AC_MSG_ERROR([No curses/termcap library found]) -elif test $mysql_cv_termcap_lib = libtermcap; then +elif test "$mysql_cv_termcap_lib" = "libtermcap"; then TERMCAP_LIB=-ltermcap -elif test $mysql_cv_termcap_lib = libncurses; then +elif test "$mysql_cv_termcap_lib" = "libncurses"; then TERMCAP_LIB=-lncurses else TERMCAP_LIB=-lcurses @@ -413,7 +413,7 @@ AC_CACHE_VAL(mysql_cv_can_redecl_getpw, extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();], mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)]) AC_MSG_RESULT($mysql_cv_can_redecl_getpw) -if test $mysql_cv_can_redecl_getpw = no; then +if test "$mysql_cv_can_redecl_getpw" = "no"; then AC_DEFINE(HAVE_GETPW_DECLS) fi ]) @@ -425,7 +425,7 @@ AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl, #include ], [int x = TIOCGWINSZ;], mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)]) AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl) -if test $mysql_cv_tiocgwinsz_in_ioctl = yes; then +if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then AC_DEFINE(GWINSZ_IN_SYS_IOCTL) fi ]) @@ -437,7 +437,7 @@ AC_CACHE_VAL(mysql_cv_fionread_in_ioctl, #include ], [int x = FIONREAD;], mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)]) AC_MSG_RESULT($mysql_cv_fionread_in_ioctl) -if test $mysql_cv_fionread_in_ioctl = yes; then +if test "$mysql_cv_fionread_in_ioctl" = "yes"; then AC_DEFINE(FIONREAD_IN_SYS_IOCTL) fi ]) @@ -449,7 +449,7 @@ AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl, #include ], [int x = TIOCSTAT;], mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)]) AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl) -if test $mysql_cv_tiocstat_in_ioctl = yes; then +if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL) fi ]) @@ -482,7 +482,7 @@ AC_CACHE_VAL(mysql_cv_dirent_has_dino, struct dirent d; int z; z = d.d_ino; ], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)]) AC_MSG_RESULT($mysql_cv_dirent_has_dino) -if test $mysql_cv_dirent_has_dino = yes; then +if test "$mysql_cv_dirent_has_dino" = "yes"; then AC_DEFINE(STRUCT_DIRENT_HAS_D_INO) fi ]) @@ -501,7 +501,7 @@ extern "C" void (*signal ()) ();], [int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl AC_MSG_RESULT($mysql_cv_void_sighandler) -if test $mysql_cv_void_sighandler = yes; then +if test "$mysql_cv_void_sighandler" = "yes"; then AC_DEFINE(VOID_SIGHANDLER) fi ]) @@ -560,7 +560,7 @@ then AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h, [AC_TRY_LINK([#include ], [char *p = alloca(2 * sizeof(int));], ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)]) - if test $ac_cv_header_alloca_h = yes + if test "$ac_cv_header_alloca_h" = "yes" then AC_DEFINE(HAVE_ALLOCA) fi @@ -584,11 +584,11 @@ then #endif ], [char *p = (char *) alloca(1);], ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)]) - if test $ac_cv_func_alloca_works = yes; then + if test "$ac_cv_func_alloca_works" = "yes"; then AC_DEFINE(HAVE_ALLOCA) fi - if test $ac_cv_func_alloca_works = no; then + if test "$ac_cv_func_alloca_works" = "no"; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, @@ -604,7 +604,7 @@ then wenotbecray #endif ], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) - if test $ac_cv_os_cray = yes; then + if test "$ac_cv_os_cray" = "yes"; then for ac_func in _getb67 GETB67 getb67; do AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func) break]) @@ -812,7 +812,7 @@ AC_MSG_CHECKING(for OpenSSL) case "$CLIENT_EXTRA_LDFLAGS $MYSQLD_EXTRA_LDFLAGS" in *-all-static*) using_static="yes" ;; esac - if test $using_static = "yes" + if test "$using_static" = "yes" then echo "You can't use the --all-static link option when using openssl." exit 1 From 14f2fc28b6a1c8c8c29d1aef4b9021a571fc2c51 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Fri, 1 Aug 2003 12:13:52 +0300 Subject: [PATCH 20/87] log0log.c: Fix assertion failure reported by Alex Kiernan when we compile with the SUN Forte Developer 7 C 5.4 compiler --- innobase/log/log0log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 99827da5bf5..1c7a79525e3 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -500,7 +500,7 @@ log_group_calc_lsn_offset( offset = (gr_lsn_size_offset + difference) % group_size; - ut_a(offset <= 0xFFFFFFFF); + ut_a(offset < (((ib_longlong) 1) << 32)); /* offset must be < 4 GB */ /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); From f131bd53d410286725d06e98827d7bb9172ecdd0 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 1 Aug 2003 14:58:03 +0200 Subject: [PATCH 21/87] replace mi_rrnd() in myrg_rkey family to more intelligent (HA_KEYREAD-aware) read function --- myisammrg/myrg_def.h | 2 ++ myisammrg/myrg_queue.c | 12 ++++++++++-- myisammrg/myrg_rfirst.c | 2 +- myisammrg/myrg_rkey.c | 4 ++-- myisammrg/myrg_rlast.c | 2 +- myisammrg/myrg_rnext.c | 2 +- myisammrg/myrg_rprev.c | 2 +- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/myisammrg/myrg_def.h b/myisammrg/myrg_def.h index d56cf4aa8d8..00e7950bccf 100644 --- a/myisammrg/myrg_def.h +++ b/myisammrg/myrg_def.h @@ -29,3 +29,5 @@ extern pthread_mutex_t THR_LOCK_open; #endif int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); +int _myrg_mi_read_record(MI_INFO *info, byte *buf); + diff --git a/myisammrg/myrg_queue.c b/myisammrg/myrg_queue.c index b4f729fc2cf..5ec382feb91 100644 --- a/myisammrg/myrg_queue.c +++ b/myisammrg/myrg_queue.c @@ -14,8 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Read record based on a key */ - #include "myrg_def.h" static int queue_key_cmp(void *keyseg, byte *a, byte *b) @@ -55,3 +53,13 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag) } return error; } + +int _myrg_mi_read_record(MI_INFO *info, byte *buf) +{ + if (!(*info->read_record)(info,info->lastpos,buf)) + { + info->update|= HA_STATE_AKTIV; /* Record is read */ + return 0; + } + return my_errno; +} diff --git a/myisammrg/myrg_rfirst.c b/myisammrg/myrg_rfirst.c index 2ee9c015a84..9ba07686c47 100644 --- a/myisammrg/myrg_rfirst.c +++ b/myisammrg/myrg_rfirst.c @@ -45,5 +45,5 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx) return HA_ERR_END_OF_FILE; mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; - return mi_rrnd(mi,buf,mi->lastpos); + return _myrg_mi_read_record(mi,buf); } diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c index ba042352a51..fbfa7f24921 100644 --- a/myisammrg/myrg_rkey.c +++ b/myisammrg/myrg_rkey.c @@ -36,7 +36,7 @@ SerG */ -int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, +int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, uint key_len, enum ha_rkey_function search_flag) { byte *key_buff; @@ -83,5 +83,5 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, return HA_ERR_KEY_NOT_FOUND; mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; - return mi_rrnd(mi,record,mi->lastpos); + return _myrg_mi_read_record(mi,buf); } diff --git a/myisammrg/myrg_rlast.c b/myisammrg/myrg_rlast.c index e03a07c295a..96bb798bd4f 100644 --- a/myisammrg/myrg_rlast.c +++ b/myisammrg/myrg_rlast.c @@ -45,6 +45,6 @@ int myrg_rlast(MYRG_INFO *info, byte *buf, int inx) return HA_ERR_END_OF_FILE; mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; - return mi_rrnd(mi,buf,mi->lastpos); + return _myrg_mi_read_record(mi,buf); } diff --git a/myisammrg/myrg_rnext.c b/myisammrg/myrg_rnext.c index 6d657b5926c..0929c63fc1d 100644 --- a/myisammrg/myrg_rnext.c +++ b/myisammrg/myrg_rnext.c @@ -49,5 +49,5 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) /* now, mymerge's read_next is as simple as one queue_top */ mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; - return mi_rrnd(mi,buf,mi->lastpos); + return _myrg_mi_read_record(mi,buf); } diff --git a/myisammrg/myrg_rprev.c b/myisammrg/myrg_rprev.c index c21ca06dacd..797993e903d 100644 --- a/myisammrg/myrg_rprev.c +++ b/myisammrg/myrg_rprev.c @@ -49,5 +49,5 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) /* now, mymerge's read_prev is as simple as one queue_top */ mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; - return mi_rrnd(mi,buf,mi->lastpos); + return _myrg_mi_read_record(mi,buf); } From 119d3f039df335923787d519083b06e2268c8037 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Fri, 1 Aug 2003 22:29:38 +0200 Subject: [PATCH 22/87] Backporting the changeset below from 4.0, because a customer hits the bug with 3.23. ChangeSet@1.1416.113.1, 2003-03-22 15:22:59+01:00, guilhem@mysql.com Fix for #178 Replicating INSERT VALUES(USER()) crashes (SEGV) the slave Now it does not SEGV, but USER() is still badly replicated (it is replicated to ""), which is a lower priority bug. --- sql/item_strfunc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 323810398ec..9e37a5a18e5 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1094,7 +1094,8 @@ String *Item_func_database::val_str(String *str) String *Item_func_user::val_str(String *str) { THD *thd=current_thd; - if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) || + if (!(thd->user) || // for system threads (e.g. replication thread) + str->copy((const char*) thd->user,(uint) strlen(thd->user)) || str->append('@') || str->append(thd->host ? thd->host : thd->ip ? thd->ip : "")) return &empty_string; From fa1d0098ec15ced624ab0d05f189a0e9a3849c1e Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sat, 2 Aug 2003 16:10:26 +0200 Subject: [PATCH 23/87] Mark tables 'updating' in sql_acl.cc (mysql_grant(), mysql_table_grant()) so that tables_ok() does not ignore them. This fixes random bug #980. --- sql/sql_acl.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 755a72bec32..d73e8b236e5 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2107,8 +2107,17 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, 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); + if (thd->slave_thread && table_rules_on) + { + /* + The tables must be marked "updating" so that tables_ok() takes them into + account in tests. + */ + tables[0].updating=tables[1].updating=tables[2].updating=1; + if (!tables_ok(0, tables)) + DBUG_RETURN(0); + tables[0].updating=tables[1].updating=tables[2].updating=0; + } #endif if (open_and_lock_tables(thd,tables)) @@ -2279,8 +2288,17 @@ int mysql_grant (THD *thd, const char *db, List &list, 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); + if (thd->slave_thread && table_rules_on) + { + /* + The tables must be marked "updating" so that tables_ok() takes them into + account in tests. + */ + tables[0].updating=tables[1].updating=1; + if (!tables_ok(0, tables)) + DBUG_RETURN(0); + tables[0].updating=tables[1].updating=0; + } #endif if (open_and_lock_tables(thd,tables)) From 41865cf3a670ffee10d0cf263c33e12bd7b8c2da Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sat, 2 Aug 2003 23:46:26 +0200 Subject: [PATCH 24/87] Fix so that SET PASSWORD is not replicated by the slave if running with replicate-*-table rules which exclude 'mysql' tables (e.g. replicate-wild-ignore-table=mysql.%). This was already the behaviour for GRANT/REVOKE, I'm extending it to SET PASSWORD because it seems very logical (the contrary seems illogical). 2 new tests: - one to test if GRANT and SET PASSWORD are replicated - one to test if they are not replicated if replicate-wild-ignore-table=mysql.% The 2nd is also a testcase for BUG#980. --- mysql-test/r/rpl_do_grant.result | 26 +++++++++++ mysql-test/r/rpl_ignore_grant.result | 37 ++++++++++++++++ mysql-test/t/rpl_do_grant.test | 46 ++++++++++++++++++++ mysql-test/t/rpl_ignore_grant-slave.opt | 1 + mysql-test/t/rpl_ignore_grant.test | 57 +++++++++++++++++++++++++ sql/sql_acl.cc | 19 +++++++++ 6 files changed, 186 insertions(+) create mode 100644 mysql-test/r/rpl_do_grant.result create mode 100644 mysql-test/r/rpl_ignore_grant.result create mode 100644 mysql-test/t/rpl_do_grant.test create mode 100644 mysql-test/t/rpl_ignore_grant-slave.opt create mode 100644 mysql-test/t/rpl_ignore_grant.test diff --git a/mysql-test/r/rpl_do_grant.result b/mysql-test/r/rpl_do_grant.result new file mode 100644 index 00000000000..fec935ae7ac --- /dev/null +++ b/mysql-test/r/rpl_do_grant.result @@ -0,0 +1,26 @@ +slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +slave start; +delete from mysql.user where user='rpl_do_grant'; +delete from mysql.db where user='rpl_do_grant'; +flush privileges; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; +grant select on *.* to rpl_do_grant@localhost; +grant drop on test.* to rpl_do_grant@localhost; +show grants for rpl_do_grant@localhost; +Grants for rpl_do_grant@localhost +GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost' +GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost' +set password for rpl_do_grant@localhost=password("does it work?"); +select password<>'' from mysql.user where user='rpl_do_grant'; +password<>'' +1 +delete from mysql.user where user='rpl_do_grant'; +delete from mysql.db where user='rpl_do_grant'; +flush privileges; +flush privileges; diff --git a/mysql-test/r/rpl_ignore_grant.result b/mysql-test/r/rpl_ignore_grant.result new file mode 100644 index 00000000000..6cd7d5b4c00 --- /dev/null +++ b/mysql-test/r/rpl_ignore_grant.result @@ -0,0 +1,37 @@ +slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +slave start; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; +grant select on *.* to rpl_ignore_grant@localhost; +grant drop on test.* to rpl_ignore_grant@localhost; +show grants for rpl_ignore_grant@localhost; +Grants for rpl_ignore_grant@localhost +GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost' +GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost' +show grants for rpl_ignore_grant@localhost; +There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost' +select count(*) from mysql.user where user='rpl_ignore_grant'; +count(*) +0 +select count(*) from mysql.db where user='rpl_ignore_grant'; +count(*) +0 +grant select on *.* to rpl_ignore_grant@localhost; +set password for rpl_ignore_grant@localhost=password("does it work?"); +select password<>'' from mysql.user where user='rpl_ignore_grant'; +password<>'' +0 +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; diff --git a/mysql-test/t/rpl_do_grant.test b/mysql-test/t/rpl_do_grant.test new file mode 100644 index 00000000000..89ff1afb5c9 --- /dev/null +++ b/mysql-test/t/rpl_do_grant.test @@ -0,0 +1,46 @@ +# Test that GRANT and SET PASSWORD are replicated to the slave + +source include/master-slave.inc; + +# do not be influenced by other tests. +connection master; +delete from mysql.user where user='rpl_do_grant'; +delete from mysql.db where user='rpl_do_grant'; +flush privileges; +save_master_pos; +connection slave; +sync_with_master; +# if these DELETE did nothing on the master, we need to do them manually on the +# slave. +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; + +# test replication of GRANT +connection master; +grant select on *.* to rpl_do_grant@localhost; +grant drop on test.* to rpl_do_grant@localhost; +save_master_pos; +connection slave; +sync_with_master; +show grants for rpl_do_grant@localhost; + +# test replication of SET PASSWORD +connection master; +set password for rpl_do_grant@localhost=password("does it work?"); +save_master_pos; +connection slave; +sync_with_master; +select password<>'' from mysql.user where user='rpl_do_grant'; + +# clear what we have done, to not influence other tests. +connection master; +delete from mysql.user where user='rpl_do_grant'; +delete from mysql.db where user='rpl_do_grant'; +flush privileges; +save_master_pos; +connection slave; +sync_with_master; +# no need to delete manually, as the DELETEs must have done some real job on +# master (updated binlog) +flush privileges; diff --git a/mysql-test/t/rpl_ignore_grant-slave.opt b/mysql-test/t/rpl_ignore_grant-slave.opt new file mode 100644 index 00000000000..e931bfbd37e --- /dev/null +++ b/mysql-test/t/rpl_ignore_grant-slave.opt @@ -0,0 +1 @@ +--replicate-wild-ignore-table=mysql.% diff --git a/mysql-test/t/rpl_ignore_grant.test b/mysql-test/t/rpl_ignore_grant.test new file mode 100644 index 00000000000..2fd7f186b3e --- /dev/null +++ b/mysql-test/t/rpl_ignore_grant.test @@ -0,0 +1,57 @@ +# Test that GRANT is not replicated to the slave +# when --replicate-wild-ignore-table=mysql.% +# In BUG#980, this test would _randomly_ fail. + +source include/master-slave.inc; + +# do not be influenced by other tests. +connection master; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; +save_master_pos; +connection slave; +sync_with_master; +# as these DELETE were not replicated, we need to do them manually on the +# slave. +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; + +# test non-replication of GRANT +connection master; +grant select on *.* to rpl_ignore_grant@localhost; +grant drop on test.* to rpl_ignore_grant@localhost; +show grants for rpl_ignore_grant@localhost; +save_master_pos; +connection slave; +sync_with_master; +--error 1141 #("no such grant for user") +show grants for rpl_ignore_grant@localhost; +# check it another way +select count(*) from mysql.user where user='rpl_ignore_grant'; +select count(*) from mysql.db where user='rpl_ignore_grant'; + +# test non-replication of SET PASSWORD +# first force creation of the user on slave (because as the user does not exist +# on slave, the SET PASSWORD may be replicated but silently do nothing; this is +# not what we want; we want it to be not-replicated). +grant select on *.* to rpl_ignore_grant@localhost; +connection master; +set password for rpl_ignore_grant@localhost=password("does it work?"); +save_master_pos; +connection slave; +sync_with_master; +select password<>'' from mysql.user where user='rpl_ignore_grant'; + +# clear what we have done, to not influence other tests. +connection master; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; +save_master_pos; +connection slave; +sync_with_master; +delete from mysql.user where user='rpl_ignore_grant'; +delete from mysql.db where user='rpl_ignore_grant'; +flush privileges; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index fd7ea5aac51..3a3de2abf10 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1233,6 +1233,25 @@ static bool update_user_table(THD *thd, const char *host, const char *user, bzero((char*) &tables,sizeof(tables)); tables.alias=tables.real_name=(char*) "user"; tables.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) + { + /* + The tables must be marked "updating" so that tables_ok() takes them into + account in tests. + */ + tables.updating=1; + /* Thanks to bzero, tables.next==0 */ + if (!tables_ok(0, &tables)) + DBUG_RETURN(0); + tables.updating=0; + } +#endif + if (!(table=open_ltable(thd,&tables,TL_WRITE))) DBUG_RETURN(1); /* purecov: deadcode */ table->field[0]->store(host,(uint) strlen(host)); From 9724a2590127891b503ed8e5abc4dcd6ddad1ccc Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Sun, 3 Aug 2003 16:33:04 +0300 Subject: [PATCH 25/87] Cleaned up code comment --- sql/item_strfunc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 9e37a5a18e5..ff01d841e78 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1094,7 +1094,8 @@ String *Item_func_database::val_str(String *str) String *Item_func_user::val_str(String *str) { THD *thd=current_thd; - if (!(thd->user) || // for system threads (e.g. replication thread) + // For a replication thread user may be a null pointer (To be fixed) + if (!thd->user || str->copy((const char*) thd->user,(uint) strlen(thd->user)) || str->append('@') || str->append(thd->host ? thd->host : thd->ip ? thd->ip : "")) From bb12d905cb75a813bfed1bc05c82c02e91762b59 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Mon, 4 Aug 2003 10:59:44 +0200 Subject: [PATCH 26/87] 2 bugfixes: - Bug #985: "Between RESET SLAVE and START SLAVE, SHOW SLAVE STATUS is wrong." Now RESET SLAVE puts correct info in mi->host etc. A new test rpl_reset_slave for that. - Bug #986: "CHANGE MASTER & START SLAVE do not reset error columns in SHOW SLAVE STATUS". Now these reset the errors. --- mysql-test/r/rpl_loaddata.result | 26 ++++++++++++++ mysql-test/r/rpl_reset_slave.result | 22 ++++++++++++ mysql-test/t/rpl_loaddata.test | 53 +++++++++++++++++++++++++++++ mysql-test/t/rpl_reset_slave.test | 26 ++++++++++++++ sql/slave.cc | 40 ++++++++++++++++------ sql/slave.h | 2 ++ sql/sql_repl.cc | 17 +++++---- 7 files changed, 169 insertions(+), 17 deletions(-) create mode 100644 mysql-test/r/rpl_reset_slave.result create mode 100644 mysql-test/t/rpl_reset_slave.test diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index b5154ca95cf..05bdad0fb84 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -25,3 +25,29 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data infile '../../std_data/rpl_loaddata.dat' into table t1; +set global sql_slave_skip_counter=1; +start slave; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 1311 slave-relay-bin.002 1352 master-bin.001 Yes Yes 0 0 1311 1352 +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +stop slave; +change master to master_user='test'; +change master to master_user='root'; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4 +set global sql_slave_skip_counter=1; +start slave; +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +stop slave; +reset slave; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_reset_slave.result new file mode 100644 index 00000000000..c1bc1e8e483 --- /dev/null +++ b/mysql-test/r/rpl_reset_slave.result @@ -0,0 +1,22 @@ +slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +slave start; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120 +stop slave; +change master to master_user='test'; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 test MASTER_PORT 1 master-bin.001 79 slave-relay-bin.001 4 master-bin.001 No No 0 0 79 4 +reset slave; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 +start slave; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120 diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index 96a4eb3fb76..0a07dd7549b 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -6,6 +6,9 @@ # # check if duplicate entries trigger an error (they should unless IGNORE or # REPLACE was used on the master) (bug 571). +# +# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and +# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986). source include/master-slave.inc; @@ -44,3 +47,53 @@ save_master_pos; connection slave; # The SQL slave thread should be stopped now. wait_for_slave_to_stop; + +# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START +# SLAVE, even though we are not executing any event (as sql_slave_skip_counter +# takes us directly to the end of the relay log). + +set global sql_slave_skip_counter=1; +start slave; +sync_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +# Trigger error again to test CHANGE MASTER + +connection master; +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +save_master_pos; +connection slave; +# The SQL slave thread should be stopped now. +wait_for_slave_to_stop; + +# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS. +stop slave; +change master to master_user='test'; +change master to master_user='root'; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +# Trigger error again to test RESET SLAVE + +set global sql_slave_skip_counter=1; +start slave; +sync_with_master; +connection master; +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +save_master_pos; +connection slave; +# The SQL slave thread should be stopped now. +wait_for_slave_to_stop; + +# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS. +stop slave; +reset slave; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; diff --git a/mysql-test/t/rpl_reset_slave.test b/mysql-test/t/rpl_reset_slave.test new file mode 100644 index 00000000000..9c58ac0c787 --- /dev/null +++ b/mysql-test/t/rpl_reset_slave.test @@ -0,0 +1,26 @@ +# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the +# --master-* options from mysqld, as this is what is going to be used next time +# slave threads will be started). In bug 985, it displayed old values (of before +# RESET SLAVE). + +source include/master-slave.inc; +connection master; +save_master_pos; +connection slave; +sync_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +stop slave; +change master to master_user='test'; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +reset slave; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +start slave; +sync_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; diff --git a/sql/slave.cc b/sql/slave.cc index b4fa11f456e..7c7e1760169 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1476,6 +1476,27 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli) DBUG_RETURN(0); } +void init_master_info_with_options(MASTER_INFO* mi) +{ + mi->master_log_name[0] = 0; + mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number + + if (master_host) + strmake(mi->host, master_host, sizeof(mi->host) - 1); + if (master_user) + strmake(mi->user, master_user, sizeof(mi->user) - 1); + if (master_password) + strmake(mi->password, master_password, HASH_PASSWORD_LENGTH); + mi->port = master_port; + mi->connect_retry = master_connect_retry; +} + +void clear_last_slave_error(RELAY_LOG_INFO* rli) +{ + //Clear the errors displayed by SHOW SLAVE STATUS + rli->last_slave_error[0]=0; + rli->last_slave_errno=0; +} int init_master_info(MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, @@ -1529,18 +1550,9 @@ file '%s')", fname); goto err; } - mi->master_log_name[0] = 0; - mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number mi->fd = fd; - - if (master_host) - strmake(mi->host, master_host, sizeof(mi->host) - 1); - if (master_user) - strmake(mi->user, master_user, sizeof(mi->user) - 1); - if (master_password) - strmake(mi->password, master_password, HASH_PASSWORD_LENGTH); - mi->port = master_port; - mi->connect_retry = master_connect_retry; + init_master_info_with_options(mi); + } else // file exists { @@ -2611,6 +2623,12 @@ slave_begin: pthread_cond_broadcast(&rli->start_cond); // This should always be set to 0 when the slave thread is started rli->pending = 0; + /* + Reset errors for a clean start (otherwise, if the master is idle, the SQL + thread may execute no Query_log_event, so the error will remain even + though there's no problem anymore). + */ + clear_last_slave_error(rli); //tell the I/O thread to take relay_log_space_limit into account from now on pthread_mutex_lock(&rli->log_space_lock); diff --git a/sql/slave.h b/sql/slave.h index d1fd54d3c04..193b0ab9dd7 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -389,6 +389,8 @@ void skip_load_data_infile(NET* net); void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); void end_slave(); /* clean up */ +void init_master_info_with_options(MASTER_INFO* mi); +void clear_last_slave_error(RELAY_LOG_INFO* rli); int init_master_info(MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index faa18b146bb..cdd0bca4a0e 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -769,12 +769,15 @@ int reset_slave(THD *thd, MASTER_INFO* mi) &errmsg))) goto err; - //Clear master's log coordinates (only for good display of SHOW SLAVE STATUS) - mi->master_log_name[0]= 0; - mi->master_log_pos= BIN_LOG_HEADER_SIZE; - //Clear the errors displayed by SHOW SLAVE STATUS - mi->rli.last_slave_error[0]=0; - mi->rli.last_slave_errno=0; + /* + Clear master's log coordinates and reset host/user/etc to the values + specified in mysqld's options (only for good display of SHOW SLAVE STATUS; + next init_master_info() (in start_slave() for example) would have set them + the same way; but here this is for the case where the user does SHOW SLAVE + STATUS; before doing START SLAVE; + */ + init_master_info_with_options(mi); + clear_last_slave_error(&mi->rli); //close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0 end_master_info(mi); //and delete these two files @@ -965,6 +968,8 @@ int change_master(THD* thd, MASTER_INFO* mi) pthread_mutex_lock(&mi->rli.data_lock); mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */ + /* Clear the error, for a clean start. */ + clear_last_slave_error(&mi->rli); /* If we don't write new coordinates to disk now, then old will remain in relay-log.info until START SLAVE is issued; but if mysqld is shutdown From be123fe5a792ccbd147e44fc93aa48529dd80a81 Mon Sep 17 00:00:00 2001 From: "miguel@hegel.local" <> Date: Mon, 4 Aug 2003 09:44:26 -0300 Subject: [PATCH 27/87] Fix VC++ compiler error --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b9e9c0a14fa..728810fcf7f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5333,7 +5333,7 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit) Impossible range (for example lookup on NULL on not null field) Create empty result set */ - if (!(table->record_pointers= my_malloc(1, MYF(MY_WME)))) + if (!(table->record_pointers= (uchar*) my_malloc(1, MYF(MY_WME)))) goto err; table->found_records= 0; goto end; From c0317ce66c2c5e5c228a294a5fae45e1ebd1db61 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 5 Aug 2003 16:29:09 +0200 Subject: [PATCH 28/87] make it clear for optimizer that XOR's are not optimizable at the moment (BUG#992) --- mysql-test/r/func_test.result | 5 +++++ mysql-test/t/func_test.test | 5 +++++ sql/item_cmpfunc.h | 10 ++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 8cfae44b9dd..e1c27daa9a7 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -46,6 +46,11 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL; 1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL 0 1 1 0 NULL NULL NULL +create table t1 (a int); +insert t1 values (1); +select * from t1 where 1 xor 1; +a +drop table t1; select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 0 1 diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index f5ad2e21c73..700fab97f5e 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -18,6 +18,11 @@ select -1.49 or -1.49,0.6 or 0.6; select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL; +create table t1 (a int); +insert t1 values (1); +select * from t1 where 1 xor 1; +drop table t1; + # # Wrong usage of functions # diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 536ac9dc3d4..58c7ea8d00d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -28,7 +28,7 @@ public: Item_bool_func(Item *a) :Item_int_func(a) {} Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {} void fix_length_and_dec() { decimals=0; max_length=1; } - unsigned int size_of() { return sizeof(*this);} + unsigned int size_of() { return sizeof(*this);} }; class Item_bool_func2 :public Item_int_func @@ -595,7 +595,7 @@ public: void print(String *str); void split_sum_func(List &fields); friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); - unsigned int size_of() { return sizeof(*this);} + unsigned int size_of() { return sizeof(*this);} void top_level_item() { abort_on_null=1; } }; @@ -634,12 +634,18 @@ inline Item *and_conds(Item *a,Item *b) return cond; } +/* + XOR is Item_cond, not an Item_int_func bevause we could like to + optimize (a XOR b) later on. It's low prio, though +*/ class Item_cond_xor :public Item_cond { public: Item_cond_xor() :Item_cond() {} Item_cond_xor(Item *i1,Item *i2) :Item_cond(i1,i2) {} enum Functype functype() const { return COND_XOR_FUNC; } + /* TODO: remove the next line when implementing XOR optimization */ + enum Type type() const { return FUNC_ITEM; } longlong val_int(); const char *func_name() const { return "xor"; } }; From 27fde36d1512c4b74edca48d3361050bd226876e Mon Sep 17 00:00:00 2001 From: "miguel@hegel.local" <> Date: Tue, 5 Aug 2003 22:57:44 -0300 Subject: [PATCH 29/87] Fix an erronous cast for GCC introduced for to fix VC++ compiler error --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 728810fcf7f..1230dffcaa9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5333,7 +5333,7 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit) Impossible range (for example lookup on NULL on not null field) Create empty result set */ - if (!(table->record_pointers= (uchar*) my_malloc(1, MYF(MY_WME)))) + if (!(table->record_pointers= (byte*) my_malloc(1, MYF(MY_WME)))) goto err; table->found_records= 0; goto end; From b8e5f7f119c62001762cba2d62d68f0f8bae7af6 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Wed, 6 Aug 2003 11:42:48 +0200 Subject: [PATCH 30/87] Some fixes for the RPM spec file: - Fixed BUG#959 (libmysqld not being compiled properly) - Fixed BUG#998 (RPM build errors): added missing files to the distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow, mysql_fix_privilege_tables.1), removed "-n" from %install section. --- support-files/mysql.spec.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 15127edeef4..0a33ae397e4 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -216,7 +216,6 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --infodir=%{_infodir} \ --includedir=%{_includedir} \ --mandir=%{_mandir} \ - --with-embedded-server \ --enable-thread-safe-client \ --with-comment=\"Official MySQL RPM\"; # Add this for more debugging support @@ -245,7 +244,7 @@ MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} # Clean up the BuildRoot first [ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR; -mkdir -p $RBR +mkdir -p $RBR%{_libdir}/mysql # # Use MYSQL_BUILD_PATH so that we can use a dedicated version of gcc @@ -267,6 +266,7 @@ BuildMySQL "--enable-shared \ --with-berkeley-db \ --with-innodb \ --with-raid \ + --with-embedded-server \ --with-server-suffix='-Max'" # Save everything for debug @@ -276,6 +276,9 @@ BuildMySQL "--enable-shared \ mv sql/mysqld sql/mysqld-max nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym +# Install embedded server library in the build root +install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql + # Save libraries (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) (cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) @@ -295,13 +298,14 @@ BuildMySQL "--disable-shared \ --with-client-ldflags='-all-static' \ $USE_OTHER_LIBC_DIR \ --with-server-suffix='%{server_suffix}' \ + --without-embedded-server \ --without-berkeley-db \ --with-innodb \ --without-vio \ --without-openssl" nm --numeric-sort sql/mysqld > sql/mysqld.sym -%install -n mysql-%{mysql_version} +%install RBR=$RPM_BUILD_ROOT MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} @@ -319,7 +323,7 @@ install -d $RBR%{_sbindir} make install-strip DESTDIR=$RBR benchdir_root=%{_datadir} # Install shared libraries (Disable for architectures that don't support it) -(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar) +(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar) # install saved mysqld-max install -s -m755 $MBD/sql/mysqld-max $RBR%{_sbindir}/mysqld-max @@ -447,6 +451,7 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/isamlog.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* %doc %attr(644, root, man) %{_mandir}/man1/perror.1* @@ -462,6 +467,7 @@ fi %attr(755, root, root) %{_bindir}/myisampack %attr(755, root, root) %{_bindir}/mysql_convert_table_format %attr(755, root, root) %{_bindir}/mysql_explain_log +%attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables %attr(755, root, root) %{_bindir}/mysql_install_db %attr(755, root, root) %{_bindir}/mysql_secure_installation @@ -492,12 +498,14 @@ fi %attr(755, root, root) %{_bindir}/msql2mysql %attr(755, root, root) %{_bindir}/mysql %attr(755, root, root) %{_bindir}/mysql_find_rows +%attr(755, root, root) %{_bindir}/mysql_tableinfo %attr(755, root, root) %{_bindir}/mysql_waitpid %attr(755, root, root) %{_bindir}/mysqlaccess %attr(755, root, root) %{_bindir}/mysqladmin %attr(755, root, root) %{_bindir}/mysqlbinlog %attr(755, root, root) %{_bindir}/mysqlcheck %attr(755, root, root) %{_bindir}/mysqldump +%attr(755, root, root) %{_bindir}/mysqldumpslow %attr(755, root, root) %{_bindir}/mysqlimport %attr(755, root, root) %{_bindir}/mysqlshow @@ -554,6 +562,13 @@ fi %attr(644, root, root) %{_libdir}/mysql/libmysqld.a %changelog +* Tue Aug 05 2003 Lenz Grimmer + +- Fixed BUG#959 (libmysqld not being compiled properly) +- Fixed BUG#998 (RPM build errors): added missing files to the + distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow, + mysql_fix_privilege_tables.1), removed "-n" from %install section. + * Wed Jul 09 2003 Lenz Grimmer - removed the GIF Icon (file was not included in the sources anyway) From 3d5d56cea9961971f7d72d9f7cd6c4ed66ed7bdb Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Wed, 6 Aug 2003 12:13:08 +0200 Subject: [PATCH 31/87] - try harder to obtain the FQDN with "hostname -f", if possible (BUG#897) Unfortunately the returned value of "hostname" is inconsistent on various platforms - some return the host name only, others return the FQDN by default. On Linux, one can use option "-f" to enable the output of the FQDN. Use it, if available. --- scripts/mysql_install_db.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 64fdd0dfebb..ffb857933cd 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -107,7 +107,13 @@ then fi fi -hostname=`@HOSTNAME@` # Install this too in the user table +# Try to determine the fully qualified domain name (FQDN) +HOSTNAME="@HOSTNAME@" +if $HOSTNAME -f > /dev/null 2>&1 ; then + hostname=`$HOSTNAME -f` +else + hostname=`$HOSTNAME` +fi # Check if hostname is valid if test "$IN_RPM" -eq 0 -a $force -eq 0 From 73bb79dbea335cd82f35ee610d01ca3d1d5a7527 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Wed, 6 Aug 2003 15:37:22 +0200 Subject: [PATCH 32/87] Bug #792 combination of date-interval and between with mixed constant and non-constant --- mysql-test/r/type_date.result | 2 ++ mysql-test/t/type_date.test | 1 + sql/item_timefunc.cc | 10 ++++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 214328eab47..8dfe14bc1a2 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -32,6 +32,8 @@ datum 2000-01-02 2000-01-03 2000-01-04 +SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND datum - INTERVAL 100 DAY; +datum DROP TABLE t1; CREATE TABLE t1 ( user_id char(10), diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 68c2d55aac9..bd6d8c49c22 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -34,6 +34,7 @@ INSERT INTO t1 VALUES ( "2000-1-3" ); INSERT INTO t1 VALUES ( "2000-1-4" ); INSERT INTO t1 VALUES ( "2000-1-5" ); SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND "2000-1-4"; +SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND datum - INTERVAL 100 DAY; DROP TABLE t1; # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 84e7a44ac61..caea79314de 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1058,14 +1058,12 @@ String *Item_date_add_interval::val_str(String *str) longlong Item_date_add_interval::val_int() { TIME ltime; + longlong date; if (Item_date_add_interval::get_date(<ime,0)) return (longlong) 0; - return ((longlong) (((ulong) ltime.year)*10000L+ - (((uint) ltime.month)*100+ - (uint) ltime.day))*(longlong) 1000000L+ - (longlong) ((ulong) ((uint) ltime.hour)*10000L+ - (ulong) (((uint)ltime.minute)*100L+ - (uint) ltime.second))); + date = (ltime.year*100L + ltime.month)*100L + ltime.day; + return ltime.time_type == TIMESTAMP_DATE ? date : + ((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second; } void Item_extract::fix_length_and_dec() From d527253d04da2c6b0b778732b9d1c4917335672e Mon Sep 17 00:00:00 2001 From: "greg@gcw.ath.cx" <> Date: Wed, 6 Aug 2003 22:57:14 -0400 Subject: [PATCH 33/87] Copied Venu's make_win_src_distribution script from 4.1 tree --- scripts/Makefile.am | 1 + scripts/make_win_src_distribution.sh | 404 +++++++++++++++++++++++++++ 2 files changed, 405 insertions(+) create mode 100755 scripts/make_win_src_distribution.sh diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 8f17d8519b8..f1ca6023fbe 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -35,6 +35,7 @@ bin_SCRIPTS = @server_scripts@ \ mysqld_multi EXTRA_SCRIPTS = make_binary_distribution.sh \ + make_win_src_distribution.sh \ msql2mysql.sh \ mysql_config.sh \ mysql_fix_privilege_tables.sh \ diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh new file mode 100755 index 00000000000..d2b50e06f54 --- /dev/null +++ b/scripts/make_win_src_distribution.sh @@ -0,0 +1,404 @@ +#!/bin/sh + +# +# Script to create a Windows src package +# + +version=@VERSION@ +export version +SOURCE=`pwd` +CP="cp -p" + +DEBUG=0 +SILENT=0 +SUFFIX="" +DIRNAME="" +OUTTAR=0 + +# +# This script must run from MySQL top directory +# + +if [ ! -f scripts/make_win_src_distribution ]; then + echo "ERROR : You must run this script from the MySQL top-level directory" + exit 1 +fi + +# +# Check for source compilation/configuration +# + +if [ ! -f sql/sql_yacc.cc ]; then + echo "ERROR : Sorry, you must run this script after the complete build," + echo " hope you know what you are trying to do !!" + exit 1 +fi + +# +# Debug print of the status +# + +print_debug() +{ + for statement + do + if [ "$DEBUG" = "1" ] ; then + echo $statement + fi + done +} + +# +# Usage of the script +# + +show_usage() +{ + echo "MySQL utility script to create a Windows src package, and it takes" + echo "the following arguments:" + echo "" + echo " --debug Debug, without creating the package" + echo " --tmp Specify the temporary location" + echo " --suffix Suffix name for the package" + echo " --dirname Directory name to copy files (intermediate)" + echo " --silent Do not list verbosely files processed" + echo " --tar Create tar.gz package instead of .zip" + echo " --help Show this help message" + + exit 0 +} + +# +# Parse the input arguments +# + +parse_arguments() { + for arg do + case "$arg" in + --debug) DEBUG=1;; + --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; + --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; + --dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;; + --silent) SILENT=1 ;; + --tar) OUTTAR=1 ;; + --help) show_usage ;; + *) + echo "Unknown argument '$arg'" + exit 1 + ;; + esac + done +} + +parse_arguments "$@" + +# +# Assign the tmp directory if it was set from the environment variables +# + +for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp +do + if [ "$i" ]; then + print_debug "Setting TMP to '$i'" + TMP=$i + break + fi +done + + +# + +# +# Create a tmp dest directory to copy files +# + +BASE=$TMP/my_win_dist$SUFFIX + +if [ -d $BASE ] ; then + print_debug "Destination directory '$BASE' already exists, deleting it" + rm -r -f $BASE +fi + +$CP -r $SOURCE/VC++Files $BASE +( +find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print +)|( + while read v + do + print_debug "Replacing LF -> CRLF from '$v'" + + # ^M -> type CTRL V + CTRL M + cat $v | sed 's/ +//' | sed 's/$/ +/' > $v.tmp + rm $v + mv $v.tmp $v + done +) + +# +# Move all error message files to root directory +# + +$CP -r $SOURCE/sql/share $BASE/ +rm -r -f "$BASE/share/Makefile" +rm -r -f "$BASE/share/Makefile.in" +rm -r -f "$BASE/share/Makefile.am" + +# +# Clean up if we did this from a bk tree +# + +if [ -d $BASE/SCCS ] +then + find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f +fi + +mkdir $BASE/Docs $BASE/extra $BASE/include + + +# +# Copy directory files +# + +copy_dir_files() +{ + for arg do + print_debug "Copying files from directory '$arg'" + cd $SOURCE/$arg + if [ ! -d $BASE/$arg ]; then + print_debug "Creating directory '$arg'" + mkdir $BASE/$arg + fi + for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \ + README INSTALL* LICENSE + do + if [ -f $i ] + then + $CP $SOURCE/$arg/$i $BASE/$arg/$i + fi + done + for i in *.cc + do + if [ -f $i ] + then + i=`echo $i | sed 's/.cc$//g'` + $CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp + fi + done + done +} + +# +# Copy directory contents recursively +# + +copy_dir_dirs() { + + for arg do + + basedir=$arg + + if [ ! -d $BASE/$arg ]; then + mkdir $BASE/$arg + fi + + copy_dir_files $arg + + cd $SOURCE/$arg/ + for i in * + do + if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then + copy_dir_files $basedir/$i + fi + done + done +} + +# +# Input directories to be copied +# + +for i in client dbug extra heap include isam \ + libmysql libmysqld merge myisam \ + myisammrg mysys regex sql strings \ + vio zlib +do + copy_dir_files $i +done + +# +# Input directories to be copied recursively +# + +for i in bdb innobase +do + copy_dir_dirs $i +done + +# +# Create dummy innobase configure header +# + +if [ -f $BASE/innobase/ib_config.h ]; then + rm -f $BASE/innobase/ib_config.h +fi +touch $BASE/innobase/ib_config.h + + +# +# Copy miscellaneous files +# + +cd $SOURCE +for i in COPYING ChangeLog README \ + INSTALL-SOURCE INSTALL-WIN \ + INSTALL-WIN-SOURCE \ + Docs/manual_toc.html Docs/manual.html \ + Docs/mysqld_error.txt Docs/INSTALL-BINARY + +do + print_debug "Copying file '$i'" + if [ -f $i ] + then + $CP $i $BASE/$i + fi +done + +# +# Fix some windows files +# + +./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp + +# +# Initialize the initial data directory +# + +if [ -f scripts/mysql_install_db ]; then + print_debug "Initializing the 'data' directory" + scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data +fi + +# +# Specify the distribution package name and copy it +# + +if test -z $DIRNAME +then + NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX +else + NEW_DIR_NAME=$DIRNAME +fi +NEW_NAME=$NEW_DIR_NAME-win-src + +BASE2=$TMP/$NEW_DIR_NAME +rm -r -f $BASE2 +mv $BASE $BASE2 +BASE=$BASE2 + +# +# If debugging, don't create a zip/tar/gz +# + +if [ "$DEBUG" = "1" ] ; then + echo "Please check the distribution files from $BASE" + echo "Exiting (without creating the package).." + exit +fi + +# +# This is needed to prefere gnu tar instead of tar because tar can't +# always handle long filenames +# + +PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` +which_1 () +{ + for cmd + do + for d in $PATH_DIRS + do + for file in $d/$cmd + do + if test -x $file -a ! -d $file + then + echo $file + exit 0 + fi + done + done + done + exit 1 +} + +# +# Create the result zip/tar file +# + +set_tarzip_options() +{ + for arg + do + if [ "$arg" = "tar" ]; then + ZIPFILE1=gnutar + ZIPFILE2=gtar + OPT=cvf + EXT=".tar" + NEED_COMPRESS=1 + if [ "$SILENT" = "1" ] ; then + OPT=cf + fi + else + ZIPFILE1=zip + ZIPFILE2="" + OPT="-r" + EXT=".zip" + NEED_COMPRESS=0 + if [ "$SILENT" = "1" ] ; then + OPT="$OPT -q" + fi + fi + done +} + +if [ "$OUTTAR" = "1" ]; then + set_tarzip_options 'tar' +else + set_tarzip_options 'zip' +fi + +tar=`which_1 $ZIPFILE1 $ZIPFILE2` +if test "$?" = "1" -o "$tar" = "" +then + print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'" + tar=tar + set_tarzip_options 'tar' +fi + +# +# Create the archive +# + +print_debug "Using $tar to create archive" + +cd $TMP + +rm -f $SOURCE/$NEW_NAME$EXT +$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME +cd $SOURCE + +if [ "$NEED_COMPRESS" = "1" ] +then + print_debug "Compressing archive" + gzip -9 $NEW_NAME$EXT + EXT="$EXT.gz" +fi + +print_debug "Removing temporary directory" +rm -r -f $BASE + +if [ "$SILENT" = "0" ] ; then + echo "$NEW_NAME$EXT created successfully !!" +fi +# End of script From e177eba89b552516138b5ae69fb054ccb4cb94bd Mon Sep 17 00:00:00 2001 From: "greg@gcw.ath.cx" <> Date: Thu, 7 Aug 2003 01:14:45 -0400 Subject: [PATCH 34/87] New option for Bootstrap: -w | --win-dist to create Windows source package --- Build-tools/Bootstrap | 23 ++++++++++++++++++++--- scripts/Makefile.am | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 20cd5a089bd..15dfb31dfdd 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -43,6 +43,7 @@ $opt_suffix= ""; $opt_test= undef; $opt_skip_check= undef; $opt_skip_manual= undef; +$opt_win_dist= undef; $version= "unknown"; $major=$minor=$release=0; @@ -62,7 +63,8 @@ GetOptions( "skip-manual", "suffix=s", "test|t", - "verbose|v" + "verbose|v", + "win-dist|w" ) || print_help(""); # @@ -303,7 +305,21 @@ $command= "make dist"; &run_command($command, "make dist failed!"); # -# Run "make distcheck" to verify the source archive +# Package the Windows source +# +if ($opt_win_dist) +{ + &logger ("Creating Windows source package"); + chdir("scripts"); + $command= "make make_win_src_distribution"; + &run_command($command, "make make_win_src_distribution failed!"); + chdir(".."); + $command= "./scripts/make_win_src_distibution"; + &run_command($command, "make_win_src_distribution failed!"); +} + +# +# Run "make distcheck" to verify the source archive # if (!$opt_skip_check) { @@ -330,7 +346,7 @@ sub print_help print "ERROR: $message\n"; } print < Checks out (exports) a clear-text version of the given local BitKeeper @@ -376,6 +392,7 @@ Options: (e.g. "-20020518"). -t, --test Run the test suite after build -v, --verbose Be verbose +-w, --win-dist Also make Windows source distribution Example: diff --git a/scripts/Makefile.am b/scripts/Makefile.am index f1ca6023fbe..d6f59cb1ae9 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -65,6 +65,7 @@ pkgdata_DATA = make_binary_distribution # failures with it. CLEANFILES = @server_scripts@ \ make_binary_distribution \ + make_win_src_distribution \ msql2mysql \ mysql_config \ mysql_fix_privilege_tables \ From 4235268bef661c9095f4034a7f409daf711c9a35 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 7 Aug 2003 11:16:34 +0200 Subject: [PATCH 35/87] fixed password buffer overflow --- sql/sql_acl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f36e39b0645..554417322a4 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -206,10 +206,10 @@ int acl_init(bool dont_read_acl_tables) "Found old style password for user '%s'. Ignoring user. (You may want to restart using --old-protocol)", user.user ? user.user : ""); /* purecov: tested */ } - else if (length % 8) // This holds true for passwords + else if (length % 8 || length > 16) { sql_print_error( - "Found invalid password for user: '%s@%s'; Ignoring user", + "Found invalid password for user: '%s'@'%s'; Ignoring user", user.user ? user.user : "", user.host.hostname ? user.host.hostname : ""); /* purecov: tested */ continue; /* purecov: tested */ From 7da378f1d1f4acf9cd22ead124c3eab666d886b3 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 7 Aug 2003 13:39:53 +0200 Subject: [PATCH 36/87] PRIMARY KEY can erroneously have HA_NULL_PART_KEY flag that breaks correct key sorting --- sql/sql_table.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index cf430aec35d..c55015f7aa5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -602,13 +602,14 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, sql_field->flags|= NOT_NULL_FLAG; sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL; } + else + key_info->flags|= HA_NULL_PART_KEY; if (!(file->table_flags() & HA_NULL_KEY)) { my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX), MYF(0),column->field_name); DBUG_RETURN(-1); } - key_info->flags|= HA_NULL_PART_KEY; } if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) { From 3f5faaaff923ffd4172d56d2de736b2ff1b1b1cf Mon Sep 17 00:00:00 2001 From: "dlenev@build.mysql.com" <> Date: Thu, 7 Aug 2003 15:20:15 +0200 Subject: [PATCH 37/87] openssl_1.result, openssl_1.test: Aligned test with regenerated SSL certs Many files: Regenerated expired certificates --- BitKeeper/etc/logging_ok | 1 + SSL/cacert.pem | 37 +++++++-------- SSL/client-cert.pem | 87 ++++++++++++++++++----------------- SSL/client-key.pem | 26 +++++------ SSL/client-req.pem | 38 ++++----------- SSL/server-cert.pem | 86 +++++++++++++++++----------------- SSL/server-key.pem | 26 +++++------ SSL/server-req.pem | 38 ++++----------- mysql-test/r/openssl_1.result | 4 +- mysql-test/t/openssl_1.test | 4 +- 10 files changed, 158 insertions(+), 189 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index edb3f4141da..ccc94722e41 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -15,6 +15,7 @@ bell@laptop.sanja.is.com.ua bell@sanja.is.com.ua bk@admin.bk davida@isil.mysql.com +dlenev@build.mysql.com dlenev@mysql.com gluh@gluh.(none) gluh@gluh.mysql.r18.ru diff --git a/SSL/cacert.pem b/SSL/cacert.pem index 698784b49f9..b939a037c30 100644 --- a/SSL/cacert.pem +++ b/SSL/cacert.pem @@ -1,20 +1,21 @@ -----BEGIN CERTIFICATE----- -MIIDQjCCAqugAwIBAgIBADANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJSVTET -MBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoT -CE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1 -c0BteXNxbC5jb20wHhcNMDIwODAyMjE1NTUzWhcNMDMwODAyMjE1NTUzWjB6MQsw -CQYDVQQGEwJSVTETMBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1 -cmcxETAPBgNVBAoTCE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG -9w0BCQEWEHdhbHJ1c0BteXNxbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ -AoGBALFLPDNDeq213XvhBP3TxhC0NcGKJ/sWzaHkNmunQ8sTbV8AfdFafvP7cSHk -O3jh7smpVWnxmcIbq1dpsbb7X5vQVc8ru07Z8VhCJWx6H8kgI95Am6wbm2ho2Lok -9ODG8f/lA4kLv8Vo0hqtfV5T1mnZpSzkh6G4b0yPzHu8gtObAgMBAAGjgdcwgdQw -HQYDVR0OBBYEFNnYan2rzhBiGhb86Wr03PFmrNC5MIGkBgNVHSMEgZwwgZmAFNnY -an2rzhBiGhb86Wr03PFmrNC5oX6kfDB6MQswCQYDVQQGEwJSVTETMBEGA1UECBMK -U29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoTCE15U1FMIEFC -MQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1c0BteXNxbC5j -b22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQADeMZEA5Rh4PDq -DmS9cYyogjb9gkuLHeo/pqfU8iSZVsSaf6Uqh6TWKQOuK3I4R1K8iMo4cW6LhxxH -HLFrVIQn6xhLvfC0T6Zl7G0w6rAY2+QlbEhjnsgHtLGrB5xjSYLq6Uz3gAMbEsA4 -rCpQJECDe2PzoUXZj9mE2sdljiGcvQ== +MIIDcTCCAtqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux +EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB +YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0 +Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwODA3MTEyMTQwWhcNMDMw +OTA2MTEyMTQwWjCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP +BgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9w +ZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNx +bC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALgbnH12rP8XEJsRuy69 +9n412tEOucpQyxkpNiDgLRvlYEGIJutK2LAqPHoPg7Em2+WJ+vrFh/BVx4hOUHmk +tJ94qTHLLCCj07cjzcoADjzPT9254VqSuQy/JvDNamKEOEdXU8l4/bc26VKVZ99x +iqXbHLiIWNa+UUwyRDSkERepAgMBAAGjgegwgeUwHQYDVR0OBBYEFJVKQT7xXBK0 +ez6fOwwjZpA9f07YMIG1BgNVHSMEga0wgaqAFJVKQT7xXBK0ez6fOwwjZpA9f07Y +oYGOpIGLMIGIMQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UE +ChMITXlTUUwgQUIxITAfBgNVBAMTGEFic3RyYWN0IE15U1FMIERldmVsb3BlcjEx +MC8GCSqGSIb3DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNv +bYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4GBAJFucCIj0wREcF9P +vOaKVbvcaBwgit6oXOf7ZOPcIUQxQJOnXLVkWIdMP2mP/zHAUsCmXT2k8aXWRegB +6kh/PjV/vSYFbGtE/vh/12x/nSIUU+Y9B1EwvoeskuOwu34Ih514Y1z1bPMNt18N +4LGzMEBeklJ3gxBPlRXER9BSUpRH -----END CERTIFICATE----- diff --git a/SSL/client-cert.pem b/SSL/client-cert.pem index 729379babdc..54b173baae2 100644 --- a/SSL/client-cert.pem +++ b/SSL/client-cert.pem @@ -3,24 +3,24 @@ Certificate: Version: 3 (0x2) Serial Number: 2 (0x2) Signature Algorithm: md5WithRSAEncryption - Issuer: C=RU, ST=Some-State, L=Orenburg, O=MySQL AB, CN=Walrus/Email=walrus@mysql.com + Issuer: C=SE, L=Uppsala, O=MySQL AB, CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com Validity - Not Before: Aug 2 22:08:07 2002 GMT - Not After : Aug 2 22:08:07 2003 GMT - Subject: C=RU, L=orenburg, O=MySQL AB, OU=client, CN=walrus/Email=walrus@mysql.com + Not Before: Aug 7 11:41:56 2003 GMT + Not After : Aug 4 11:41:56 2013 GMT + Subject: C=SE, L=Uppsala, O=MySQL AB, CN=MySQL Client/Email=abstract.mysql.developer@mysql.com Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (1024 bit) Modulus (1024 bit): - 00:ab:27:e4:1e:f0:34:8b:a9:50:df:0a:b0:55:20: - b3:1f:0f:cf:f1:51:1e:66:48:a6:f8:4e:0d:d4:49: - f4:ea:d3:41:6b:7e:06:78:3c:29:9d:8e:d3:33:4d: - 0b:fc:34:4d:18:88:48:61:af:11:da:db:84:c0:92: - 91:81:6a:b6:21:d5:8e:9b:f2:6f:d8:06:ad:d6:77: - f6:8b:bd:07:d5:b7:fb:c6:f0:64:e6:3f:58:f0:6a: - 1e:81:73:97:6d:9d:c6:ec:b0:5e:1e:c6:57:82:b0: - 98:9c:ae:26:84:43:0d:98:6c:b4:d8:52:13:70:15: - 79:61:40:84:19:ea:f6:63:3f + 00:c4:03:0a:ee:e3:b1:12:fc:ee:b4:19:f4:e1:60: + 1d:e0:28:c3:96:2d:df:82:69:cd:74:7c:54:58:d0: + ae:b3:59:3f:0c:19:1c:99:10:a6:12:c9:cf:3a:64: + 05:43:8e:bf:d2:65:36:80:91:0b:65:b0:27:26:38: + c9:23:d8:36:a2:4a:f0:f7:c0:2f:68:38:70:01:27: + 29:ff:b2:c5:52:e1:6b:f1:c8:d7:c3:5c:ee:f0:37: + 6c:2a:9b:96:1a:05:9e:eb:33:a2:39:5a:77:66:62: + 27:75:1f:2f:6f:38:da:e5:9f:78:af:ca:6b:22:3f: + 57:2b:bc:a6:8f:47:d1:99:6f Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -28,39 +28,40 @@ Certificate: Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: - A6:D9:70:92:AC:2B:F6:48:A5:FB:29:CF:78:4A:57:B5:3B:43:97:EE + 80:81:A9:22:EB:AB:D6:CA:7E:3F:8D:BB:D1:AC:2A:F4:87:9D:13:29 X509v3 Authority Key Identifier: - keyid:D9:D8:6A:7D:AB:CE:10:62:1A:16:FC:E9:6A:F4:DC:F1:66:AC:D0:B9 - DirName:/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com + keyid:95:4A:41:3E:F1:5C:12:B4:7B:3E:9F:3B:0C:23:66:90:3D:7F:4E:D8 + DirName:/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com serial:00 Signature Algorithm: md5WithRSAEncryption - 15:96:43:10:89:e0:a6:82:a4:91:0f:7e:2e:d8:80:54:ba:63: - e2:8f:b0:aa:ea:be:35:2c:8f:0d:03:a9:86:2e:32:51:33:8a: - cc:b2:5e:b3:12:cb:b7:42:06:40:89:ce:92:87:40:f1:6a:79: - 0c:3e:00:1d:06:bf:3c:c1:da:f6:3b:e1:42:e6:55:4c:31:e1: - b9:79:f3:99:14:f6:68:9e:67:2b:e3:71:88:6b:2b:e2:08:bd: - 67:79:ea:0e:7d:34:0d:41:22:3a:f4:8f:4d:51:07:6f:5a:44: - 34:05:d1:b3:ca:cf:09:2b:43:25:a1:7f:ac:f4:54:f1:e3:93: - 47:44 + 6d:8a:af:34:07:ac:95:72:a4:78:fe:f8:b8:30:9a:e0:d9:74: + 82:34:5c:fd:11:15:dd:63:fd:65:20:04:7e:b5:8f:2e:26:ef: + ab:b9:10:5f:9b:40:65:76:ab:ed:bd:bf:d5:bc:89:7f:19:d8: + a7:b5:9e:24:bd:c7:ac:8e:16:35:83:c8:ce:8d:85:7c:b4:36: + 28:dd:3a:97:e5:b2:dd:8f:88:4d:5b:50:bd:97:28:61:8e:e7: + 05:5c:c2:bb:46:a1:ac:7e:ee:ac:7d:72:d5:a7:07:4e:1d:68: + 4e:80:e2:35:7d:db:24:73:be:bc:0d:ca:f4:ae:4e:21:52:3b: + ae:81 -----BEGIN CERTIFICATE----- -MIIDajCCAtOgAwIBAgIBAjANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJSVTET -MBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoT -CE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1 -c0BteXNxbC5jb20wHhcNMDIwODAyMjIwODA3WhcNMDMwODAyMjIwODA3WjB2MQsw -CQYDVQQGEwJSVTERMA8GA1UEBxMIb3JlbmJ1cmcxETAPBgNVBAoTCE15U1FMIEFC -MQ8wDQYDVQQLEwZjbGllbnQxDzANBgNVBAMTBndhbHJ1czEfMB0GCSqGSIb3DQEJ -ARYQd2FscnVzQG15c3FsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA -qyfkHvA0i6lQ3wqwVSCzHw/P8VEeZkim+E4N1En06tNBa34GeDwpnY7TM00L/DRN -GIhIYa8R2tuEwJKRgWq2IdWOm/Jv2Aat1nf2i70H1bf7xvBk5j9Y8GoegXOXbZ3G -7LBeHsZXgrCYnK4mhEMNmGy02FITcBV5YUCEGer2Yz8CAwEAAaOCAQIwgf8wCQYD -VR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlm -aWNhdGUwHQYDVR0OBBYEFKbZcJKsK/ZIpfspz3hKV7U7Q5fuMIGkBgNVHSMEgZww -gZmAFNnYan2rzhBiGhb86Wr03PFmrNC5oX6kfDB6MQswCQYDVQQGEwJSVTETMBEG -A1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoTCE15 -U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1c0Bt -eXNxbC5jb22CAQAwDQYJKoZIhvcNAQEEBQADgYEAFZZDEIngpoKkkQ9+LtiAVLpj -4o+wquq+NSyPDQOphi4yUTOKzLJesxLLt0IGQInOkodA8Wp5DD4AHQa/PMHa9jvh -QuZVTDHhuXnzmRT2aJ5nK+NxiGsr4gi9Z3nqDn00DUEiOvSPTVEHb1pENAXRs8rP -CStDJaF/rPRU8eOTR0Q= +MIIDkTCCAvqgAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux +EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB +YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0 +Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwODA3MTE0MTU2WhcNMTMw +ODA0MTE0MTU2WjB8MQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8G +A1UEChMITXlTUUwgQUIxFTATBgNVBAMTDE15U1FMIENsaWVudDExMC8GCSqGSIb3 +DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNvbTCBnzANBgkq +hkiG9w0BAQEFAAOBjQAwgYkCgYEAxAMK7uOxEvzutBn04WAd4CjDli3fgmnNdHxU +WNCus1k/DBkcmRCmEsnPOmQFQ46/0mU2gJELZbAnJjjJI9g2okrw98AvaDhwAScp +/7LFUuFr8cjXw1zu8DdsKpuWGgWe6zOiOVp3ZmIndR8vbzja5Z94r8prIj9XK7ym +j0fRmW8CAwEAAaOCARQwggEQMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w +ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBSAgaki66vWyn4/ +jbvRrCr0h50TKTCBtQYDVR0jBIGtMIGqgBSVSkE+8VwStHs+nzsMI2aQPX9O2KGB +jqSBizCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoT +CE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAv +BgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb22C +AQAwDQYJKoZIhvcNAQEEBQADgYEAbYqvNAeslXKkeP74uDCa4Nl0gjRc/REV3WP9 +ZSAEfrWPLibvq7kQX5tAZXar7b2/1byJfxnYp7WeJL3HrI4WNYPIzo2FfLQ2KN06 +l+Wy3Y+ITVtQvZcoYY7nBVzCu0ahrH7urH1y1acHTh1oToDiNX3bJHO+vA3K9K5O +IVI7roE= -----END CERTIFICATE----- diff --git a/SSL/client-key.pem b/SSL/client-key.pem index feff11bfdb7..58fa805e620 100644 --- a/SSL/client-key.pem +++ b/SSL/client-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQCrJ+Qe8DSLqVDfCrBVILMfD8/xUR5mSKb4Tg3USfTq00FrfgZ4 -PCmdjtMzTQv8NE0YiEhhrxHa24TAkpGBarYh1Y6b8m/YBq3Wd/aLvQfVt/vG8GTm -P1jwah6Bc5dtncbssF4exleCsJicriaEQw2YbLTYUhNwFXlhQIQZ6vZjPwIDAQAB -AoGAChyxPaKzeAzo2kSnZmAoNQ2aG4fPY/um4cS6zHASKE2S7+biOvhS/RwTHlTP -AHeWlnx2yk6tn2CY10fRkPPdDsnyj7FpuZmjhmFtprOn+1Mwft7gNTMdKN2EV46/ -hMQxm8/Wu9ejm6IhOeg3Q7lBFwE9tY0kgMzU4zDI3A0HDQECQQDUcxFgxIrOi4Gw -EGxmJgopL+NjG7/4PdT2FM5z1bbwOtfsD1fHKWSiODbfpK8eMwBReI4wfDQ7ViND -xmuDykFDAkEAzj3QH9s8Ej3Vgt88326OhY1W5jTH6M0XkuZ0YatELz3MvLwFhIF4 -puouLJQVo3pQBLV+Tmnh2LQqkii7xA7oVQJBALZxzvW0M6QmyAvEPuMGPema94KQ -PS7ZIr7lpVpyqTTqw600i+Q8VvC8p9stmTmtANP2XN2kfFKMqaI1jvVRxvMCQDJE -8sOxBjVUCQS7MPUs12RKDRJTbx6ZTtOphFiCDD6Pi6W9FoMzo5rbnaGT/qo4F+Tt -7/lg6YGOeInjj9C76XkCQQC2m6j8NeX9E4Pimp1GDE93N2JJ+biJxLI8yFqruv7N -B2M/28JKLGLjam6YVJy4eSA9clXVqwWNxii3fb8qQ7u6 +MIICXQIBAAKBgQDEAwru47ES/O60GfThYB3gKMOWLd+Cac10fFRY0K6zWT8MGRyZ +EKYSyc86ZAVDjr/SZTaAkQtlsCcmOMkj2DaiSvD3wC9oOHABJyn/ssVS4WvxyNfD +XO7wN2wqm5YaBZ7rM6I5WndmYid1Hy9vONrln3ivymsiP1crvKaPR9GZbwIDAQAB +AoGAcR7IaoGhKbIrGGl6d67+zuT3q24h9aOV3Mn7653TlNHGnvbHGFcRYPpyy+H5 +X7m8XnHm+F+80hzNGzPecP9Q12oPOyoZgeQn6bTK73OFkNcX7FAkNdyH4xVhf2aK +YOzTcQfq3gRCqXtVIg4qBShTMjJLE31R8H430Or62XmJgFECQQDjP+Kz+ecQwuTB +HADLm+GQgceIB1kLgdQoZ3deUxGvqtVImuDRViSM0F2srfJ4GfkEDhc27UI5f6ir +ZTOw4ww7AkEA3M9wCPgWNtbOXbYjaNA0IzHcjMDxQDVvJAmb3EiZlKQp4EfrESxR +ly/u08TyfwrK6q5WS7xE0ad8+95G1af4XQJBAI9+3ME20SB1YItMCniHYwSj3oHX +2fN5NKWax/Zoz+c0IV+qZMHq+kNso2oRoOUTyXk1CJWndcTnBnPMALr2c9cCQQCZ +VL7Cq6uZVx6kemcqUHH0AprZbt3YLYLI7pc5p3xmeHzPzoEQQstBhjp8+aU+zPrN +blRkcQ8E2x5yNA7SLLrNAkAhzkA+EK8hc0f9W3ncy+py0Rn0i5Ay0N3T715vkThf +CfOHE3L91dLlmYpL5xVqOpugY/2sHyxwctv97DgS6tHZ -----END RSA PRIVATE KEY----- diff --git a/SSL/client-req.pem b/SSL/client-req.pem index ef11a22165f..b3667fb5ec6 100644 --- a/SSL/client-req.pem +++ b/SSL/client-req.pem @@ -1,30 +1,12 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,8CE2AB38FB50D4B9 - -rrnYZLUKlzV4U7+wqe5CWzTd4RLJb5h4M77aBRQfuHGejSaRsskN2ffpO8uQEAYM -WTJSRC+NO+jDMBZhzt1ktWqCs8d6l6azHoBybIrMJsbUhwybm+OiOfp23RrbNoS/ -S4fsgNdAAGhsRvKDdsItCyYvdH8nTzn+g9r/z2V4tOOXd6MYuT42XA6Uz2tis2SZ -GWEGa7mAweApzSiibE+pzjPS+fdX4E12n6NCVYLhn1JuvzVva/KFSebs4Wh75miC -WvRgkt/5eDQn+vkV67hE3I6p9pPcLh1+PMfaQ25U8VM/r7ejnVFWm7teGH6GKPKJ -cU+PYfblyWcgtiO/fwfGMIqSyNtHj/C3VFVie5D1MTJzBopiPGEcfz00LjBccjjh -j1meTRVN8pMZTgkxlnIFwbU6TPPvx8a9urFVQIJ4z8r2EMvYh5Cqpq87+lH9Pn0C -vzCl78Tz5QLghXNnMbbdD2aPP0PwPEXgh86iZxo06g85n0l26WUzYJlWzBYD4DrF -SbnEUAftTujEOm6MqJNLpJN6UPOtq/HvSaHl1bykGK+zU4gqHj0ur03HlF0l4xNg -OfsoNsJV+O9RUUJ0+D5eqUALJjN8TCV1wNMXOVzr/ue3QCVdlWVfZY4RPffwK9Yp -Fh52T7a2v+shhqZUQNtFDAg50Ac7deUthSWNmi5N680POnJg9KdtBdMhYLa1j3rP -D9oasSK0ugevHuQ6wUiD/95CzZlJXE9K4kTTYmaRk5MTWXhFQxdqHZo1v+pGtaNI -f+/E7q7BiNesSt31U/vkX0Tm3oJ1dgOnS8M2uxiYiKH2mJ/E32tZKw== ------END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE REQUEST----- -MIIB0jCCATsCAQAwgZExCzAJBgNVBAYTAkVFMRMwEQYDVQQIEwpTb21lLVN0YXRl -MRAwDgYDVQQHEwdUYWxsaW5uMSYwJAYDVQQKEx1NeVNRTCBkZW1vIGNsaWVudCBj -ZXJ0aWZpY2F0ZTEUMBIGA1UEAxMLVG9udSBTYW11ZWwxHTAbBgkqhkiG9w0BCQEW -DnRvbnVAbXlzcWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo1FLN -TruWFjrwiWuQTNvgMHVaAnJiv+3avgnogNuAVDDWde3jEKUVRFspkRL+DLd2Telf -VlxFPK2ycS1qesu8BIAIdNZ99nxcdts1xPb12NSJn53MP04/c8E+QX5OCb/qGtmi -Ew3RDNrY9Ju4VCEXrtezAmGHqQH/9P6cevxnQwIDAQABoAAwDQYJKoZIhvcNAQEE -BQADgYEAvENK1JAQfC8xnrFGw2IxfUmUwlRidiRtYTgtVfTr7vA+m4WaaKioni6E -PQXjcvl6kfyRoxc4qWsGi3T7QM2RnvCtbwR2NGSIKX1cBTS31RMr12NSAeXn6Twz -ZwSZ55EHj9N2hArTPNlVjxvDQX3D6/ZBi6JnHAxXigzDqhArgjU= +MIIBvDCCASUCAQAwfDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP +BgNVBAoTCE15U1FMIEFCMRUwEwYDVQQDEwxNeVNRTCBDbGllbnQxMTAvBgkqhkiG +9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAMQDCu7jsRL87rQZ9OFgHeAow5Yt34JpzXR8 +VFjQrrNZPwwZHJkQphLJzzpkBUOOv9JlNoCRC2WwJyY4ySPYNqJK8PfAL2g4cAEn +Kf+yxVLha/HI18Nc7vA3bCqblhoFnuszojlad2ZiJ3UfL2842uWfeK/KayI/Vyu8 +po9H0ZlvAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQAnKdk68dGJXvlj/GXwBUWN +oXWF7hq4fDmwyhmcFUqk8qZKPKFUxkcER0GLzYeUgvD2URSfaS3/YW0d7K7kXGwP +rB5edb+suaYf6mjm/w37xw/EJI9rdSKcB/3SSu8mALds7sUHDAO+MO0WkA/9d7t0 +LOsUqcDvMkKpZuYwNILwLw== -----END CERTIFICATE REQUEST----- diff --git a/SSL/server-cert.pem b/SSL/server-cert.pem index b15bd04a25c..9ce296482db 100644 --- a/SSL/server-cert.pem +++ b/SSL/server-cert.pem @@ -3,24 +3,24 @@ Certificate: Version: 3 (0x2) Serial Number: 1 (0x1) Signature Algorithm: md5WithRSAEncryption - Issuer: C=RU, ST=Some-State, L=Orenburg, O=MySQL AB, CN=Walrus/Email=walrus@mysql.com + Issuer: C=SE, L=Uppsala, O=MySQL AB, CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com Validity - Not Before: Aug 2 21:59:26 2002 GMT - Not After : Aug 2 21:59:26 2003 GMT - Subject: C=RU, L=Orenburg, O=MySQL AB, CN=server/Email=walrus@mysql.com + Not Before: Aug 7 11:39:27 2003 GMT + Not After : Aug 4 11:39:27 2013 GMT + Subject: C=SE, L=Uppsala, O=MySQL AB, CN=MySQL Server/Email=abstract.mysql.developer@mysql.com Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (1024 bit) Modulus (1024 bit): - 00:bd:7d:f1:91:51:38:fe:4b:79:b5:ff:e0:41:ae: - 0e:a8:bb:7b:60:42:95:01:75:e7:22:74:55:7d:74: - 4d:50:51:0c:5e:09:4b:2b:0c:8e:3f:9f:14:3f:5e: - d9:25:36:9b:cc:77:35:30:e9:8c:bf:3b:bd:da:62: - 85:4c:90:c8:de:71:2c:0a:7b:dc:e6:85:fd:b4:24: - 88:a7:8f:03:3d:15:7c:59:3d:f8:73:f0:36:2a:b8: - 80:7c:d8:c7:d6:1f:6d:b2:b7:b7:48:9f:24:56:81: - 2c:2e:9c:b9:95:48:50:56:9f:1a:60:96:c4:c0:eb: - 8d:2d:55:38:3f:6b:82:bc:b3 + 00:e9:86:7a:55:84:88:4c:be:a4:f8:92:73:30:12: + 49:0b:7a:85:87:39:34:39:0d:7d:0b:8d:18:c2:17: + 95:13:52:d2:3f:55:10:57:c8:3f:5a:f5:b2:fa:8b: + d0:67:49:cc:aa:82:fc:9f:ce:00:b4:73:f3:36:d2: + 3a:d3:c2:b0:0e:14:c3:d4:b2:21:74:a1:f0:31:81: + 60:87:98:73:5c:10:c1:b1:1a:4d:f1:f3:b0:98:3f: + f0:d7:97:9b:2b:fd:d5:21:79:b2:2f:eb:64:15:c9: + 9b:9d:fc:9e:2d:d4:f8:04:5b:ea:a9:75:4b:42:c3: + 3d:0e:4d:2a:a8:b8:ca:99:8d Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -28,38 +28,40 @@ Certificate: Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: - C9:D0:D2:F7:17:79:27:1C:4B:C9:E7:92:D5:5E:8C:7E:F2:FE:A7:B7 + 6E:E4:9B:6A:C5:EA:E4:E6:C7:EF:D7:1E:C8:63:45:60:2B:1B:D4:D4 X509v3 Authority Key Identifier: - keyid:D9:D8:6A:7D:AB:CE:10:62:1A:16:FC:E9:6A:F4:DC:F1:66:AC:D0:B9 - DirName:/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com + keyid:95:4A:41:3E:F1:5C:12:B4:7B:3E:9F:3B:0C:23:66:90:3D:7F:4E:D8 + DirName:/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com serial:00 Signature Algorithm: md5WithRSAEncryption - 62:77:bc:16:dc:4c:70:63:4d:03:ce:19:5e:c4:6c:31:0e:57: - 26:d8:6e:25:08:f2:01:ae:98:59:0a:ba:b7:32:c0:39:69:b8: - 4b:aa:59:7c:97:72:4e:50:02:ee:ef:d6:d6:62:b8:25:36:91: - b6:3b:8f:6f:2f:3c:d8:9d:b7:cf:8f:f6:29:50:e9:31:54:77: - 2b:7b:21:72:0f:60:4c:d4:1c:bb:c4:46:e5:fd:a7:5f:ea:46: - e4:df:e9:95:77:2d:91:f8:3b:33:78:83:5d:10:de:98:7c:38: - 91:27:f6:52:8a:b6:54:f1:0f:7a:f0:1d:da:a5:22:d2:75:cc: - 4c:c3 + 7c:b6:9c:fc:ea:9e:e6:88:32:f5:24:81:9b:89:c0:13:fa:75: + 18:51:af:77:ae:b8:4e:12:5f:48:ab:0c:e6:c5:a4:87:93:6e: + 98:97:f5:f3:d3:0b:e0:fc:5e:34:3e:f2:93:58:73:97:b6:a7: + 66:96:81:cd:73:48:f3:75:24:64:61:13:78:3e:ed:df:7c:4d: + fa:2e:3a:64:99:12:24:9e:a2:51:5c:23:85:0b:0c:bb:f5:8e: + 89:80:27:ba:7c:d2:68:90:ff:1f:68:2e:1b:fd:06:bc:c8:41: + d7:b2:be:9c:94:5c:6d:1e:96:3b:75:bc:12:f0:44:bd:36:00: + 84:cd -----BEGIN CERTIFICATE----- -MIIDWTCCAsKgAwIBAgIBATANBgkqhkiG9w0BAQQFADB6MQswCQYDVQQGEwJSVTET -MBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoT -CE15U1FMIEFCMQ8wDQYDVQQDEwZXYWxydXMxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1 -c0BteXNxbC5jb20wHhcNMDIwODAyMjE1OTI2WhcNMDMwODAyMjE1OTI2WjBlMQsw -CQYDVQQGEwJSVTERMA8GA1UEBxMIT3JlbmJ1cmcxETAPBgNVBAoTCE15U1FMIEFC -MQ8wDQYDVQQDEwZzZXJ2ZXIxHzAdBgkqhkiG9w0BCQEWEHdhbHJ1c0BteXNxbC5j -b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL198ZFROP5LebX/4EGuDqi7 -e2BClQF15yJ0VX10TVBRDF4JSysMjj+fFD9e2SU2m8x3NTDpjL87vdpihUyQyN5x -LAp73OaF/bQkiKePAz0VfFk9+HPwNiq4gHzYx9YfbbK3t0ifJFaBLC6cuZVIUFaf -GmCWxMDrjS1VOD9rgryzAgMBAAGjggECMIH/MAkGA1UdEwQCMAAwLAYJYIZIAYb4 -QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTJ -0NL3F3knHEvJ55LVXox+8v6ntzCBpAYDVR0jBIGcMIGZgBTZ2Gp9q84QYhoW/Olq -9NzxZqzQuaF+pHwwejELMAkGA1UEBhMCUlUxEzARBgNVBAgTClNvbWUtU3RhdGUx -ETAPBgNVBAcTCE9yZW5idXJnMREwDwYDVQQKEwhNeVNRTCBBQjEPMA0GA1UEAxMG -V2FscnVzMR8wHQYJKoZIhvcNAQkBFhB3YWxydXNAbXlzcWwuY29tggEAMA0GCSqG -SIb3DQEBBAUAA4GBAGJ3vBbcTHBjTQPOGV7EbDEOVybYbiUI8gGumFkKurcywDlp -uEuqWXyXck5QAu7v1tZiuCU2kbY7j28vPNidt8+P9ilQ6TFUdyt7IXIPYEzUHLvE -RuX9p1/qRuTf6ZV3LZH4OzN4g10Q3ph8OJEn9lKKtlTxD3rwHdqlItJ1zEzD +MIIDkTCCAvqgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux +EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB +YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0 +Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwODA3MTEzOTI3WhcNMTMw +ODA0MTEzOTI3WjB8MQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8G +A1UEChMITXlTUUwgQUIxFTATBgNVBAMTDE15U1FMIFNlcnZlcjExMC8GCSqGSIb3 +DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNvbTCBnzANBgkq +hkiG9w0BAQEFAAOBjQAwgYkCgYEA6YZ6VYSITL6k+JJzMBJJC3qFhzk0OQ19C40Y +wheVE1LSP1UQV8g/WvWy+ovQZ0nMqoL8n84AtHPzNtI608KwDhTD1LIhdKHwMYFg +h5hzXBDBsRpN8fOwmD/w15ebK/3VIXmyL+tkFcmbnfyeLdT4BFvqqXVLQsM9Dk0q +qLjKmY0CAwEAAaOCARQwggEQMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w +ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRu5Jtqxerk5sfv +1x7IY0VgKxvU1DCBtQYDVR0jBIGtMIGqgBSVSkE+8VwStHs+nzsMI2aQPX9O2KGB +jqSBizCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoT +CE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAv +BgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb22C +AQAwDQYJKoZIhvcNAQEEBQADgYEAfLac/Oqe5ogy9SSBm4nAE/p1GFGvd664ThJf +SKsM5sWkh5NumJf189ML4PxeND7yk1hzl7anZpaBzXNI83UkZGETeD7t33xN+i46 +ZJkSJJ6iUVwjhQsMu/WOiYAnunzSaJD/H2guG/0GvMhB17K+nJRcbR6WO3W8EvBE +vTYAhM0= -----END CERTIFICATE----- diff --git a/SSL/server-key.pem b/SSL/server-key.pem index 5afd717e07c..4292dc79929 100644 --- a/SSL/server-key.pem +++ b/SSL/server-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQC9ffGRUTj+S3m1/+BBrg6ou3tgQpUBdecidFV9dE1QUQxeCUsr -DI4/nxQ/XtklNpvMdzUw6Yy/O73aYoVMkMjecSwKe9zmhf20JIinjwM9FXxZPfhz -8DYquIB82MfWH22yt7dInyRWgSwunLmVSFBWnxpglsTA640tVTg/a4K8swIDAQAB -AoGARciG2NRHn+aduPe1V5rJDTyWD/oVM8d+ykJ7ZUsaWdSvMEZN51mlXSqxYzED -2N+GesL/1LZ9vcM7hJw5qNu9DQOc7CtMT4k/bmhPJsT226roKKVbw/ocOEY5dK8+ -T9/x8qgo7zC3Qk/bKgjj61m8cQ7Mz/J7ZCEMmDNNrORCzRECQQDrcvJlsBTALilr -MaAqNyaa0tykEabzg2mUFx5uvmzlwNx9ApSidoU5Xop9c6u00zgCDpsDlcwjhOs1 -jcqRkBTrAkEAzggY7BeN3FnW8tsV0Wq4LL6vK30pe0JIylxrKsFjY4LTo9t/8TKK -6ZOEETVtM7sepIkxECw5RCBi9sxi3NClWQJAbrA5WKjw+HA7NJO98lq/IWYkKFXM -IQsUpXRA8FtBormKbpK6Aa6qbxANF3E7teTencj0Azl3IPOqCCFCrDAKRQJAc6bv -9ncyVqLHmgOJN8ikIdnYEp1rj5khqxY9wf5UgCOMEcrBAu/QMlVwKQjIh+VdyhaI -x/9LFgboBomsZS9p4QJBAIXaX/WoqL/wgBGS2UroianFFXL6/Bt//CUoGpYgKQYQ -+x+8heMRppmM0to2J7j9nGE83ikMWfPUwMi4TbyWH3Q= +MIICXgIBAAKBgQDphnpVhIhMvqT4knMwEkkLeoWHOTQ5DX0LjRjCF5UTUtI/VRBX +yD9a9bL6i9BnScyqgvyfzgC0c/M20jrTwrAOFMPUsiF0ofAxgWCHmHNcEMGxGk3x +87CYP/DXl5sr/dUhebIv62QVyZud/J4t1PgEW+qpdUtCwz0OTSqouMqZjQIDAQAB +AoGBALTq11nrjIEQbdSZ+R1z/R0kddB2U+wjdA3/6P9tr7PBxVsFdtzbKaI5mcib +iwCKX0J2qmrP+SHUdsexBZxLR4KV/Z55v9Pym99Dy+DxDA95zURyCMKRBIzlU5uN +F7USEQoltLUCsmZwNWdit0gfxSWdddkHNuI0uxTzHwuDcUlNAkEA/76zVremngNL +DlekM9NPn/8E/TXBHN1b1jdUKd7WymSJykdcm3viU98dFNZFWF8B0jiTcuBKXgpR +vTShNab/swJBAOnCGp554BLhioTyyk8qjRLt3xEsjsDljJULHVLYWcUqIkMf97GL +VLBhl6ZEI9i0WduqvgZ+Bacd0uHqIHz1Yb8CQQDm1CjqTDiGxlIoT9JVNJTZxEOs +h6gVdXY+kxHT+N3FL5luiZp8fAR7zxVgiUVtzdLG+2madfapiobcT3RyCJkhAkBI +64AaR7KasTjg2Ew7/e4cJZAcb2XozrLYG6t+GHeIhehCQEqoW+qDSy5fc4orI7eU +SuMUa2OgCjGqv7p6wKFJAkEAznmum/MbVOBpC4FsdnIGkxyFKIbh2OLY2aUb2KkK +Ouf4S8Y5Ldgszi0fnDPRaxWJzewwZKvcff2zj+mYZeAXbA== -----END RSA PRIVATE KEY----- diff --git a/SSL/server-req.pem b/SSL/server-req.pem index 4cd6610e735..7c3db0660ad 100644 --- a/SSL/server-req.pem +++ b/SSL/server-req.pem @@ -1,30 +1,12 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,6CBD09E71246DC01 - -byRzq5+j3r8FX2kQerTUZT5Bw/N6zrN3cmH6NHGJcrqD+vcPdtWf+Rk+mpNXgSQn -ldkfmniU/htzJ0cUV+KE229Qx10Hx9mIJIbf0Y/rBCUBuaXWVrQB36W9w3rkNPFA -EEuRMkreOJF42RD16+NBJv+RcHIGzGejXecJKUGF5DKlN0U8YHXnkXTQl54kIdr0 -H7rTrvJygwPk9/ik0M9/vmwduAMvTaHDmvgeolpMlJkxwz8vYkbUnFFJZhB6XNCb -1w3lJ0EmRJicK5BnZmCEmgt8xiv0PAtg00jBbwddQbn1reAyViBtBT9iXdusHXS5 -Po63rSt7r3MO8aetcMQ6FkklH+ChuS/vFoNY57AwrzF4uEI4GSoZP0ESrRC5Ar5W -Lzg/HrQAWbPCRlb6Jj3db1woRzFS8joOashROsZdeV/5P4Emhc6J7QMTvB1OHAhQ -ugOJazJtxjg0DN8+9cM1wtHI7N89PLHhOg13LZNLeeehzIlPwKI2JLqXUc6oR407 -i+S7GCqu7wU+if0Enux8Dj7yrvnTUiqVCL2dyKTS3sBq0Cm2UhbecHclor13y6no -y1o50TKKD6Zig2hZmSpqKznMxGMVIT36BE0aOMQUmk+aVnRuROclwTTL0ZNLzA+g -QRTRfQ6iNMf34ypqAMdAMPzDGLPycKuFdxVQxFEVaM2/mrdWFwVAqFsLvzyGvdrh -nkNyRgTWR/pfH9b3mXLqf6gMPNs764WhFIcZIDk9a4XBBUm2YDb2CxDzDCo/EUMA -jvIiU0Jt132SEHHF/wAka6d2DnwZ3vexRp6Tebv/uy9IlMLPE+68dw== ------END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE REQUEST----- -MIIB0jCCATsCAQAwgZExCzAJBgNVBAYTAkVFMRMwEQYDVQQIEwpTb21lLVN0YXRl -MRAwDgYDVQQHEwdUYWxsaW5uMSYwJAYDVQQKEx1NeVNRTCBzZXJ2ZXIgZGVtbyBj -ZXJ0aWZpY2F0ZTEUMBIGA1UEAxMLVG9udSBTYW11ZWwxHTAbBgkqhkiG9w0BCQEW -DnRvbnVAbXlzcWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCerI3Y -HZyy/YiWLLpCU/pdvYWK5crTD8ABPPKSRk/ZgK4qic/v6NRl/Pb1OiZMKdsG+jSh -h/OXtTyU8YQFrK1XJdkC2wBx4KmqtB0pNl6ppA3yRbmDdCtF8+IjvOdc5hG29t3E -rO1lQiw5RyrJ619FAxCrI7zKXIKat7NtZxjSxwIDAQABoAAwDQYJKoZIhvcNAQEE -BQADgYEAlrUnGX4LYIiVjztHA4gUcOSVeEHCci2qEUq+7yY1JhAw54YDa2MLTTwa -cH+rXLHjN0MTNfv9tRxdSX+trk3pyvhgFjssD100dJkF83RfVv2tKg9kscVOGQp7 -MkwOnJjfAjQBlTbTOQM46BTjv2FgvsppkO3ViryI//YxKvj/628= +MIIBvDCCASUCAQAwfDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP +BgNVBAoTCE15U1FMIEFCMRUwEwYDVQQDEwxNeVNRTCBTZXJ2ZXIxMTAvBgkqhkiG +9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAOmGelWEiEy+pPiSczASSQt6hYc5NDkNfQuN +GMIXlRNS0j9VEFfIP1r1svqL0GdJzKqC/J/OALRz8zbSOtPCsA4Uw9SyIXSh8DGB +YIeYc1wQwbEaTfHzsJg/8NeXmyv91SF5si/rZBXJm538ni3U+ARb6ql1S0LDPQ5N +Kqi4ypmNAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQCagJxGHBC+G5aSh3OguFn6 +z+qAC7u3B181kPBgNv20zMgLeq7YiAh3iNx4XO2+QXRGzMznFKx1tFr/mavCpgLs +p3+dCvQt5FHEFFK1D1pDeXy4146X07hOTtC9jc/jSWeVnH4ujuX5gMtZqisOyYWV +/gpw6dBtkTYlhS+y86kM/Q== -----END CERTIFICATE REQUEST----- diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 65b882c0a9b..f6c7bf5bc79 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -3,8 +3,8 @@ create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com"; -grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com" ISSUER "/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com"; +grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; +grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; flush privileges; select * from t1; f1 diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 3af7406cef3..25790f24738 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -8,8 +8,8 @@ insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com"; -grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=RU/L=orenburg/O=MySQL AB/OU=client/CN=walrus/Email=walrus@mysql.com" ISSUER "/C=RU/ST=Some-State/L=Orenburg/O=MySQL AB/CN=Walrus/Email=walrus@mysql.com"; +grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; +grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; flush privileges; connect (con1,localhost,ssl_user1,,); connect (con2,localhost,ssl_user2,,); From d5547ad13bc1a0b74bb137039c78431efb606bf0 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Thu, 7 Aug 2003 18:54:59 +0200 Subject: [PATCH 38/87] - some fixed for make_win_src_distribution to work properly --- Build-tools/Bootstrap | 4 ---- scripts/Makefile.am | 1 + scripts/make_win_src_distribution.sh | 36 +++++++++++++--------------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 15dfb31dfdd..33eca958ae0 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -310,10 +310,6 @@ $command= "make dist"; if ($opt_win_dist) { &logger ("Creating Windows source package"); - chdir("scripts"); - $command= "make make_win_src_distribution"; - &run_command($command, "make make_win_src_distribution failed!"); - chdir(".."); $command= "./scripts/make_win_src_distibution"; &run_command($command, "make_win_src_distribution failed!"); } diff --git a/scripts/Makefile.am b/scripts/Makefile.am index d6f59cb1ae9..72fc73ef28b 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -17,6 +17,7 @@ ## Process this file with automake to create Makefile.in bin_SCRIPTS = @server_scripts@ \ + make_win_src_distribution \ msql2mysql \ mysql_config \ mysql_fix_privilege_tables \ diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index d2b50e06f54..8f8ee344e93 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -38,9 +38,9 @@ fi # Debug print of the status # -print_debug() +print_debug() { - for statement + for statement do if [ "$DEBUG" = "1" ] ; then echo $statement @@ -52,7 +52,7 @@ print_debug() # Usage of the script # -show_usage() +show_usage() { echo "MySQL utility script to create a Windows src package, and it takes" echo "the following arguments:" @@ -98,14 +98,14 @@ parse_arguments "$@" for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp do - if [ "$i" ]; then + if [ "$i" ]; then print_debug "Setting TMP to '$i'" - TMP=$i + TMP=$i break fi done - + # # @@ -123,14 +123,12 @@ $CP -r $SOURCE/VC++Files $BASE ( find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print )|( - while read v + while read v do print_debug "Replacing LF -> CRLF from '$v'" - # ^M -> type CTRL V + CTRL M - cat $v | sed 's/ -//' | sed 's/$/ -/' > $v.tmp + # ^M -> type CTRL V + CTRL M + cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp rm $v mv $v.tmp $v done @@ -149,7 +147,7 @@ rm -r -f "$BASE/share/Makefile.am" # Clean up if we did this from a bk tree # -if [ -d $BASE/SCCS ] +if [ -d $BASE/SCCS ] then find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f fi @@ -171,9 +169,9 @@ copy_dir_files() mkdir $BASE/$arg fi for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \ - README INSTALL* LICENSE - do - if [ -f $i ] + README INSTALL* LICENSE + do + if [ -f $i ] then $CP $SOURCE/$arg/$i $BASE/$arg/$i fi @@ -198,14 +196,14 @@ copy_dir_dirs() { for arg do basedir=$arg - + if [ ! -d $BASE/$arg ]; then mkdir $BASE/$arg fi - + copy_dir_files $arg - - cd $SOURCE/$arg/ + + cd $SOURCE/$arg/ for i in * do if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then From 8f08c511ee781a99b63a74957ecb8547ac334f06 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Thu, 7 Aug 2003 20:16:37 +0300 Subject: [PATCH 39/87] Review of changesets since last pull. (Mostly code cleanups) --- include/my_sys.h | 1 - myisam/mi_check.c | 2 + mysql-test/t/rpl_insert_id.test | 1 + mysys/mf_format.c | 10 +---- sql/log_event.cc | 79 +++++++++++++++++---------------- sql/mini_client.cc | 2 +- sql/mysqld.cc | 64 +++++++++++++++++--------- sql/slave.cc | 38 ++++++++-------- sql/slave.h | 4 +- sql/sql_acl.cc | 11 ++--- vio/viosslfactories.c | 2 +- 11 files changed, 114 insertions(+), 100 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index acce118c7b8..7f8b8a80a1c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -100,7 +100,6 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_RETURN_REAL_PATH 32 /* return full path for file */ #define MY_SAFE_PATH 64 /* Return NULL if too long path */ #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ -#define MY_QUOTE_SPACES 256 /* quote when the path has spaces */ /* My seek flags */ #define MY_SEEK_SET 0 diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 4b28a88fc6e..0d7d7fae628 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -3563,11 +3563,13 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update) share->state.rec_per_key_rows=info->state->records; share->state.changed&= ~STATE_NOT_ANALYZED; if (info->state->records) + { for (i=0; istate.rec_per_key_part[i]=param->rec_per_key_part[i])) share->state.changed|= STATE_NOT_ANALYZED; } + } } if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC)) { diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test index d91bd02883e..49fefae72b8 100644 --- a/mysql-test/t/rpl_insert_id.test +++ b/mysql-test/t/rpl_insert_id.test @@ -4,6 +4,7 @@ # We also check how the foreign_key_check variable is replicated source include/master-slave.inc; +source include/have_innodb.inc connection master; drop table if exists t1; create table t1(a int auto_increment, key(a)); diff --git a/mysys/mf_format.c b/mysys/mf_format.c index 36d3908d310..937904847ee 100644 --- a/mysys/mf_format.c +++ b/mysys/mf_format.c @@ -111,15 +111,7 @@ my_string fn_format(my_string to, const char *name, const char *dir, strmov(buff,to); (void) my_readlink(to, buff, MYF(0)); } - if ( flag & MY_QUOTE_SPACES) - if ( strchr(to, ' ')) - { - char tmp_buff[FN_REFLEN]; - tmp_buff[0]='"'; - strxmov(tmp_buff+1,to,"\"",NullS); - strmov(to,tmp_buff); - } - DBUG_RETURN (to); + DBUG_RETURN(to); } /* fn_format */ diff --git a/sql/log_event.cc b/sql/log_event.cc index 96bcf0a2779..f7955be3b09 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -593,8 +593,9 @@ err: UNLOCK_MUTEX; if (error) { - sql_print_error("Error in Log_event::read_log_event(): '%s', \ -data_len=%d,event_type=%d",error,data_len,head[EVENT_TYPE_OFFSET]); + sql_print_error("\ +Error in Log_event::read_log_event(): '%s', data_len: %d, event_type: %d", + error,data_len,head[EVENT_TYPE_OFFSET]); my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); /* The SQL slave thread will check if file->error<0 to know @@ -1433,8 +1434,8 @@ void Slave_log_event::print(FILE* file, bool short_form, char* last_db) return; print_header(file); fputc('\n', file); - fprintf(file, "Slave: master_host: '%s' master_port: %d \ -master_log: '%s' master_pos: %s\n", + fprintf(file, "\ +Slave: master_host: '%s' master_port: %d master_log: '%s' master_pos: %s\n", master_host, master_port, master_log, llstr(master_pos, llbuff)); } @@ -1755,7 +1756,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) { int expected_error, actual_error= 0; init_sql_alloc(&thd->mem_root, 8192,0); - thd->db = rewrite_db((char*)db); + thd->db= (char*) rewrite_db(db); /* InnoDB internally stores the master log position it has processed so far; @@ -1811,15 +1812,16 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) !ignored_error_code(expected_error)) { slave_print_error(rli, 0, - "Query '%s' did not get the same error as the query \ -got on master - got on master: '%s' (%d), got on slave: '%s' (%d) \ -(default database was '%s')", + "\ +Query '%s' caused different errors on master and slave. \ +Error on master: '%s' (%d), Error on slave: '%s' (%d). \ +Default database: '%s'", query, ER_SAFE(expected_error), expected_error, actual_error ? thd->net.last_error: "no error", actual_error, - print_slave_db_safe((char*)db)); + print_slave_db_safe(db)); thd->query_error= 1; } /* @@ -1837,11 +1839,12 @@ got on master - got on master: '%s' (%d), got on slave: '%s' (%d) \ */ else if (thd->query_error || thd->fatal_error) { - slave_print_error(rli,actual_error, "Error '%s' on query '%s' \ -(default database was '%s')", - actual_error ? thd->net.last_error : - "unexpected success or fatal error", query, - print_slave_db_safe((char*)db)); + slave_print_error(rli,actual_error, + "Error '%s' on query '%s'. Default database: '%s'", + (actual_error ? thd->net.last_error : + "unexpected success or fatal error"), + query, + print_slave_db_safe(db)); thd->query_error= 1; } } @@ -1896,7 +1899,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, bool use_rli_only_for_errors) { init_sql_alloc(&thd->mem_root, 8192,0); - thd->db = rewrite_db((char*)db); + thd->db= (char*) rewrite_db(db); DBUG_ASSERT(thd->query == 0); thd->query = 0; // Should not be needed thd->query_error = 0; @@ -1978,17 +1981,15 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, if (mysql_load(thd, &ex, &tables, field_list, handle_dup, net != 0, TL_WRITE)) thd->query_error = 1; + /* log_pos is the position of the LOAD event in the master log */ if (thd->cuted_fields) - /* - log_pos is the position of the LOAD - event in the master log - */ - sql_print_error("Slave: load data infile at position %s in log \ -'%s' produced %d warning(s) (loaded table was '%s', database was '%s')", + sql_print_error("\ +Slave: load data infile on table '%s' at log position %s in log \ +'%s' produced %ld warning(s). Default database: '%s'", + (char*) table_name, llstr(log_pos,llbuff), RPL_LOG_NAME, - thd->cuted_fields, - (char*)table_name, - print_slave_db_safe((char*)db)); + (ulong) thd->cuted_fields, + print_slave_db_safe(db)); if (net) net->pkt_nr= thd->net.pkt_nr; } @@ -2019,10 +2020,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, sql_errno=ER_UNKNOWN_ERROR; err=ER(sql_errno); } - slave_print_error(rli,sql_errno, - "Error '%s' running load data infile \ -(loaded table was '%s', database was '%s')", - err, (char*)table_name, print_slave_db_safe((char*)db)); + slave_print_error(rli,sql_errno,"\ +Error '%s' running lOAD DATA INFILE on table '%s'. Default database: '%s'", + err, (char*)table_name, print_slave_db_safe(db)); free_root(&thd->mem_root,0); return 1; } @@ -2030,10 +2030,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, if (thd->fatal_error) { - slave_print_error(rli,ER_UNKNOWN_ERROR, -"Fatal error running \ -LOAD DATA INFILE (loaded table was '%s', database was '%s')", - (char*)table_name, print_slave_db_safe((char*)db)); + slave_print_error(rli,ER_UNKNOWN_ERROR, "\ +Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'", + (char*)table_name, print_slave_db_safe(db)); return 1; } @@ -2339,13 +2338,15 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) What we want instead is add the filename to the current error message. */ char *tmp= my_strdup(rli->last_slave_error,MYF(MY_WME)); - if (!tmp) - goto err; - slave_print_error(rli,rli->last_slave_errno, /* ok to re-use the error code */ - "%s. Failed executing load from '%s'", - tmp, fname); - my_free(tmp,MYF(0)); - thd->options = save_options; + if (tmp) + { + slave_print_error(rli, + rli->last_slave_errno, /* ok to re-use error code */ + "%s. Failed executing load from '%s'", + tmp, fname); + my_free(tmp,MYF(0)); + } + thd->options= save_options; goto err; } thd->options = save_options; diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 1b625a81b0c..a8a0c639abd 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -30,8 +30,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 41807285acc..d9ba97ad11a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2506,6 +2506,19 @@ int mysql_service(void *p) return 0; } + +/* Quote string if it contains space, else copy */ + +static char *add_quoted_string(char *to, const char *from, char *to_end) +{ + uint length= (uint) (to_end-to); + + if (!strchr(from, ' ')) + return strnmov(to, from, length); + return strxnmov(to, length, "\"", from, "\"", NullS); +} + + /* Handle basic handling of services, like installation and removal @@ -2515,25 +2528,41 @@ int mysql_service(void *p) servicename Internal name of service displayname Display name of service (in taskbar ?) file_path Path to this program + startup_option Startup option to mysqld RETURN VALUES 0 option handled 1 Could not handle option */ -bool default_service_handling(char **argv, - const char *servicename, - const char *displayname, - const char *file_path) +static bool +default_service_handling(char **argv, + const char *servicename, + const char *displayname, + const char *file_path, + const char *extra_opt) { + char path_and_service[FN_REFLEN+FN_REFLEN+32], *pos, *end; + end= path_and_service + sizeof(path_and_service)-1; + + /* We have to quote filename if it contains spaces */ + pos= add_quoted_string(path_and_service, file_path, end); + if (*extra_opt) + { + /* Add (possible quoted) option after file_path */ + *pos++= ' '; + pos= add_quoted_string(pos, extra_opt, end); + } + *pos= 0; // Ensure end null + if (Service.got_service_option(argv, "install")) { - Service.Install(1, servicename, displayname, file_path); + Service.Install(1, servicename, displayname, path_and_service); return 0; } if (Service.got_service_option(argv, "install-manual")) { - Service.Install(0, servicename, displayname, file_path); + Service.Install(0, servicename, displayname, path_and_service); return 0; } if (Service.got_service_option(argv, "remove")) @@ -2560,12 +2589,11 @@ int main(int argc, char **argv) char file_path[FN_REFLEN]; my_path(file_path, argv[0], ""); /* Find name in path */ fn_format(file_path,argv[0],file_path,"",MY_REPLACE_DIR+ - MY_UNPACK_FILENAME+MY_RESOLVE_SYMLINKS+MY_QUOTE_SPACES); - + MY_UNPACK_FILENAME | MY_RESOLVE_SYMLINKS); if (argc == 2) { - if (!default_service_handling(argv,MYSQL_SERVICENAME, MYSQL_SERVICENAME, - file_path)) + if (!default_service_handling(argv, MYSQL_SERVICENAME, MYSQL_SERVICENAME, + file_path, "")) return 0; if (Service.IsService(argv[1])) { @@ -2578,12 +2606,8 @@ int main(int argc, char **argv) } else if (argc == 3) /* install or remove any optional service */ { - /* Add service name after filename */ - uint length=strlen(file_path); - *strxnmov(file_path + length, sizeof(file_path)-length-2, " ", - argv[2], NullS)= '\0'; - - if (!default_service_handling(argv, argv[2], argv[2], file_path)) + if (!default_service_handling(argv, argv[2], argv[2], file_path, + argv[2])) return 0; if (Service.IsService(argv[2])) { @@ -2605,12 +2629,8 @@ int main(int argc, char **argv) Install an optional service with optional config file mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini */ - uint length=strlen(file_path); - char tmp_path[FN_REFLEN]; - fn_format(tmp_path,argv[3],tmp_path,"",MY_QUOTE_SPACES); - *strxnmov(file_path + length, sizeof(file_path)-length-2, " ", - tmp_path, " ", argv[2], NullS)= '\0'; - if (!default_service_handling(argv, argv[2], argv[2], file_path)) + if (!default_service_handling(argv, argv[2], argv[2], file_path, + argv[3])) return 0; } else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME)) diff --git a/sql/slave.cc b/sql/slave.cc index b4fa11f456e..d7c8c6d5fd3 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -828,6 +828,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) return rli->abort_slave || abort_loop || thd->killed; } + /* Writes an error message to rli->last_slave_error and rli->last_slave_errno (which will be displayed by SHOW SLAVE STATUS), and prints it to stderr. @@ -842,7 +843,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) RETURN VALUES void - */ +*/ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...) { @@ -853,11 +854,11 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...) rli->last_slave_errno = err_code; /* If the error string ends with '.', do not add a ',' it would be ugly */ if (rli->last_slave_error[0] && - (rli->last_slave_error[strlen(rli->last_slave_error)-1] == '.')) - sql_print_error("Slave: %s Error_code=%d", rli->last_slave_error, + (*(strend(rli->last_slave_error)-1) == '.')) + sql_print_error("Slave: %s Error_code: %d", rli->last_slave_error, err_code); else - sql_print_error("Slave: %s, error_code=%d", rli->last_slave_error, + sql_print_error("Slave: %s, Error_code: %d", rli->last_slave_error, err_code); } @@ -872,7 +873,7 @@ void skip_load_data_infile(NET* net) } -char* rewrite_db(char* db) +const char *rewrite_db(const char* db) { if (replicate_rewrite_db.is_empty() || !db) return db; @@ -889,13 +890,14 @@ char* rewrite_db(char* db) /* From other comments and tests in code, it looks like - sometimes Query_log_event and Load_log_event can have db==0 + sometimes Query_log_event and Load_log_event can have db == 0 (see rewrite_db() above for example) (cases where this happens are unclear; it may be when the master is 3.23). */ -char* print_slave_db_safe(char* db) + +const char *print_slave_db_safe(const char* db) { - return (db ? rewrite_db(db) : (char*) ""); + return (db ? rewrite_db(db) : ""); } /* @@ -1303,8 +1305,8 @@ file '%s', errno %d)", fname, my_errno); if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0, MYF(MY_WME))) { - sql_print_error("Failed to create a cache on relay log info file (\ -file '%s')", fname); + sql_print_error("Failed to create a cache on relay log info file '%s'", + fname); msg= current_thd->net.last_error; goto err; } @@ -1313,8 +1315,7 @@ file '%s')", fname); if (init_relay_log_pos(rli,NullS,BIN_LOG_HEADER_SIZE,0 /* no data lock */, &msg)) { - sql_print_error("Failed to open the relay log (relay_log_name='FIRST', \ -relay_log_pos=4)"); + sql_print_error("Failed to open the relay log 'FIRST' (relay_log_pos 4"); goto err; } rli->master_log_name[0]= 0; @@ -1330,15 +1331,16 @@ relay_log_pos=4)"); int error=0; if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0) { - sql_print_error("Failed to open the existing relay log info file (\ -file '%s', errno %d)", fname, my_errno); + sql_print_error("\ +Failed to open the existing relay log info file '%s' (errno %d)", + fname, my_errno); error= 1; } else if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME))) { - sql_print_error("Failed to create a cache on relay log info file (\ -file '%s')", fname); + sql_print_error("Failed to create a cache on relay log info file '%s'", + fname); error= 1; } if (error) @@ -1377,8 +1379,8 @@ file '%s')", fname); &msg)) { char llbuf[22]; - sql_print_error("Failed to open the relay log (relay_log_name='%s', \ -relay_log_pos=%s)", rli->relay_log_name, llstr(rli->relay_log_pos, llbuf)); + sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)", + rli->relay_log_name, llstr(rli->relay_log_pos, llbuf)); goto err; } } diff --git a/sql/slave.h b/sql/slave.h index d1fd54d3c04..42776061545 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -382,8 +382,8 @@ int add_table_rule(HASH* h, const char* table_spec); int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); -char* rewrite_db(char* db); -char* print_slave_db_safe(char* db); +const char *rewrite_db(const char* db); +const char *print_slave_db_safe(const char* db); int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code); void skip_load_data_infile(NET* net); void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 3a3de2abf10..877eab74110 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1242,13 +1242,12 @@ static bool update_user_table(THD *thd, const char *host, const char *user, { /* The tables must be marked "updating" so that tables_ok() takes them into - account in tests. + account in tests. It's ok to leave 'updating' set after tables_ok. */ - tables.updating=1; + tables.updating= 1; /* Thanks to bzero, tables.next==0 */ if (!tables_ok(0, &tables)) DBUG_RETURN(0); - tables.updating=0; } #endif @@ -2138,10 +2137,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, The tables must be marked "updating" so that tables_ok() takes them into account in tests. */ - tables[0].updating=tables[1].updating=tables[2].updating=1; + tables[0].updating= tables[1].updating= tables[2].updating= 1; if (!tables_ok(0, tables)) DBUG_RETURN(0); - tables[0].updating=tables[1].updating=tables[2].updating=0; } #endif @@ -2319,10 +2317,9 @@ int mysql_grant (THD *thd, const char *db, List &list, The tables must be marked "updating" so that tables_ok() takes them into account in tests. */ - tables[0].updating=tables[1].updating=1; + tables[0].updating= tables[1].updating= 1; if (!tables_ok(0, tables)) DBUG_RETURN(0); - tables[0].updating=tables[1].updating=0; } #endif diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 72ac915d14e..69d4f3007b8 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -18,8 +18,8 @@ #ifdef HAVE_OPENSSL -#include #include +#include #include From f96d57d3020bb8dbd5495b37a65ebac342d50db2 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 8 Aug 2003 18:49:22 +0200 Subject: [PATCH 40/87] between tests added bugfixes will follow --- mysql-test/r/range.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/range.test | 17 +++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 26d9d7869c6..5a4d2228778 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -226,3 +226,31 @@ insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"), select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1; id1 idnull drop table t1; +create table t1 (x int, y int, index(x), index(y)); +insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9); +update t1 set y=x; +explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0; +table type possible_keys key key_len ref rows Extra +t1 ref y y 5 const 1 Using where +t2 ALL x NULL NULL NULL 9 Using where +explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0; +table type possible_keys key key_len ref rows Extra +t1 ref y y 5 const 1 Using where +t2 range x x 5 NULL 4 Using where +explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; +table type possible_keys key key_len ref rows Extra +t1 ref y y 5 const 1 Using where +t2 ALL x NULL NULL NULL 9 Using where +explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; +table type possible_keys key key_len ref rows Extra +t1 ref y y 5 const 1 Using where +t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1) +explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; +table type possible_keys key key_len ref rows Extra +t1 ref y y 5 const 1 Using where +t2 ALL x NULL NULL NULL 9 Using where +explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; +table type possible_keys key key_len ref rows Extra +t1 ref y y 5 const 1 Using where +t2 range x x 5 NULL 2 Using where +drop table t1; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index bb0e696ea11..521709eddee 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -183,3 +183,20 @@ insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"), select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1; drop table t1; +# +# BETWEEN problems +# +create table t1 (x int, y int, index(x), index(y)); +insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9); +update t1 set y=x; +# between with only one end fixed +explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0; +explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0; +# between with both expressions on both ends +explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; +explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; +# equation propagation +explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; +explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; +drop table t1; + From df8b7799cbf94403dc37ad1e3f79310c11da52d9 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 8 Aug 2003 19:13:27 +0200 Subject: [PATCH 41/87] between range optimization bug (between with const on one end only) --- mysql-test/r/range.result | 2 +- sql/opt_range.cc | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 5a4d2228778..4e0476fdacd 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -232,7 +232,7 @@ update t1 set y=x; explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0; table type possible_keys key key_len ref rows Extra t1 ref y y 5 const 1 Using where -t2 ALL x NULL NULL NULL 9 Using where +t2 range x x 5 NULL 4 Using where explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0; table type possible_keys key key_len ref rows Extra t1 ref y y 5 const 1 Using where diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2d949810b63..c7bad3b18f3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -794,18 +794,15 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond) DBUG_RETURN(new SEL_TREE(SEL_TREE::ALWAYS)); DBUG_RETURN(new SEL_TREE(SEL_TREE::IMPOSSIBLE)); } + table_map ref_tables=cond->used_tables(); - if (ref_tables & ~(param->prev_tables | param->read_tables | - param->current_table)) - DBUG_RETURN(0); // Can't be calculated yet if (cond->type() != Item::FUNC_ITEM) { // Should be a field if (ref_tables & param->current_table) DBUG_RETURN(0); DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); } - if (!(ref_tables & param->current_table)) - DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true + Item_func *cond_func= (Item_func*) cond; if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE) DBUG_RETURN(0); // Can't be calculated @@ -847,6 +844,12 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond) DBUG_RETURN(0); // Can't optimize this IN } + if (ref_tables & ~(param->prev_tables | param->read_tables | + param->current_table)) + DBUG_RETURN(0); // Can't be calculated yet + if (!(ref_tables & param->current_table)) + DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true + /* check field op const */ /* btw, ft_func's arguments()[0] isn't FIELD_ITEM. SerG*/ if (cond_func->arguments()[0]->type() == Item::FIELD_ITEM) From ddd3ee8b279ef5a5531a039d09460b6ec53b720c Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Fri, 8 Aug 2003 23:27:22 +0300 Subject: [PATCH 42/87] rewritten test using loop (BUG#930) removed unused field (now it is in variables) --- mysql-test/r/query_cache.result | 519 +------------------------------ mysql-test/t/query_cache.test | 530 +------------------------------- sql/sql_class.h | 1 - 3 files changed, 14 insertions(+), 1036 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index e1fd5443580..48df3b4b563 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2,7 +2,7 @@ flush query cache; flush query cache; reset query cache; flush status; -drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00,mysqltest.t1; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00,mysqltest.t1; drop database if exists mysqltest; create table t1 (a int not null); insert into t1 values (1),(2),(3); @@ -641,521 +641,6 @@ Qcache_queries_in_cache 2 SET OPTION SQL_SELECT_LIMIT=DEFAULT; drop table t1; flush status; -create table t0(a int); -create table t1(a int); -create table t2(a int); -create table t3(a int); -create table t4(a int); -create table t5(a int); -create table t6(a int); -create table t7(a int); -create table t8(a int); -create table t9(a int); -create table t10(a int); -create table t11(a int); -create table t12(a int); -create table t13(a int); -create table t14(a int); -create table t15(a int); -create table t16(a int); -create table t17(a int); -create table t18(a int); -create table t19(a int); -create table t20(a int); -create table t21(a int); -create table t22(a int); -create table t23(a int); -create table t24(a int); -create table t25(a int); -create table t26(a int); -create table t27(a int); -create table t28(a int); -create table t29(a int); -create table t30(a int); -create table t31(a int); -create table t32(a int); -create table t33(a int); -create table t34(a int); -create table t35(a int); -create table t36(a int); -create table t37(a int); -create table t38(a int); -create table t39(a int); -create table t40(a int); -create table t41(a int); -create table t42(a int); -create table t43(a int); -create table t44(a int); -create table t45(a int); -create table t46(a int); -create table t47(a int); -create table t48(a int); -create table t49(a int); -create table t50(a int); -create table t51(a int); -create table t52(a int); -create table t53(a int); -create table t54(a int); -create table t55(a int); -create table t56(a int); -create table t57(a int); -create table t58(a int); -create table t59(a int); -create table t60(a int); -create table t61(a int); -create table t62(a int); -create table t63(a int); -create table t64(a int); -create table t65(a int); -create table t66(a int); -create table t67(a int); -create table t68(a int); -create table t69(a int); -create table t70(a int); -create table t71(a int); -create table t72(a int); -create table t73(a int); -create table t74(a int); -create table t75(a int); -create table t76(a int); -create table t77(a int); -create table t78(a int); -create table t79(a int); -create table t80(a int); -create table t81(a int); -create table t82(a int); -create table t83(a int); -create table t84(a int); -create table t85(a int); -create table t86(a int); -create table t87(a int); -create table t88(a int); -create table t89(a int); -create table t90(a int); -create table t91(a int); -create table t92(a int); -create table t93(a int); -create table t94(a int); -create table t95(a int); -create table t96(a int); -create table t97(a int); -create table t98(a int); -create table t99(a int); -create table t100(a int); -create table t101(a int); -create table t102(a int); -create table t103(a int); -create table t104(a int); -create table t105(a int); -create table t106(a int); -create table t107(a int); -create table t108(a int); -create table t109(a int); -create table t110(a int); -create table t111(a int); -create table t112(a int); -create table t113(a int); -create table t114(a int); -create table t115(a int); -create table t116(a int); -create table t117(a int); -create table t118(a int); -create table t119(a int); -create table t120(a int); -create table t121(a int); -create table t122(a int); -create table t123(a int); -create table t124(a int); -create table t125(a int); -create table t126(a int); -create table t127(a int); -create table t128(a int); -create table t129(a int); -create table t130(a int); -create table t131(a int); -create table t132(a int); -create table t133(a int); -create table t134(a int); -create table t135(a int); -create table t136(a int); -create table t137(a int); -create table t138(a int); -create table t139(a int); -create table t140(a int); -create table t141(a int); -create table t142(a int); -create table t143(a int); -create table t144(a int); -create table t145(a int); -create table t146(a int); -create table t147(a int); -create table t148(a int); -create table t149(a int); -create table t150(a int); -create table t151(a int); -create table t152(a int); -create table t153(a int); -create table t154(a int); -create table t155(a int); -create table t156(a int); -create table t157(a int); -create table t158(a int); -create table t159(a int); -create table t160(a int); -create table t161(a int); -create table t162(a int); -create table t163(a int); -create table t164(a int); -create table t165(a int); -create table t166(a int); -create table t167(a int); -create table t168(a int); -create table t169(a int); -create table t170(a int); -create table t171(a int); -create table t172(a int); -create table t173(a int); -create table t174(a int); -create table t175(a int); -create table t176(a int); -create table t177(a int); -create table t178(a int); -create table t179(a int); -create table t180(a int); -create table t181(a int); -create table t182(a int); -create table t183(a int); -create table t184(a int); -create table t185(a int); -create table t186(a int); -create table t187(a int); -create table t188(a int); -create table t189(a int); -create table t190(a int); -create table t191(a int); -create table t192(a int); -create table t193(a int); -create table t194(a int); -create table t195(a int); -create table t196(a int); -create table t197(a int); -create table t198(a int); -create table t199(a int); -create table t200(a int); -create table t201(a int); -create table t202(a int); -create table t203(a int); -create table t204(a int); -create table t205(a int); -create table t206(a int); -create table t207(a int); -create table t208(a int); -create table t209(a int); -create table t210(a int); -create table t211(a int); -create table t212(a int); -create table t213(a int); -create table t214(a int); -create table t215(a int); -create table t216(a int); -create table t217(a int); -create table t218(a int); -create table t219(a int); -create table t220(a int); -create table t221(a int); -create table t222(a int); -create table t223(a int); -create table t224(a int); -create table t225(a int); -create table t226(a int); -create table t227(a int); -create table t228(a int); -create table t229(a int); -create table t230(a int); -create table t231(a int); -create table t232(a int); -create table t233(a int); -create table t234(a int); -create table t235(a int); -create table t236(a int); -create table t237(a int); -create table t238(a int); -create table t239(a int); -create table t240(a int); -create table t241(a int); -create table t242(a int); -create table t243(a int); -create table t244(a int); -create table t245(a int); -create table t246(a int); -create table t247(a int); -create table t248(a int); -create table t249(a int); -create table t250(a int); -create table t251(a int); -create table t252(a int); -create table t253(a int); -create table t254(a int); -create table t255(a int); -create table t256(a int); -create table t00 (a int) type=MERGE UNION=(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256) INSERT_METHOD=FIRST; -insert into t0 values (1),(2); -insert into t1 values (1),(2); -insert into t2 values (1),(2); -insert into t3 values (1),(2); -insert into t4 values (1),(2); -insert into t5 values (1),(2); -insert into t6 values (1),(2); -insert into t7 values (1),(2); -insert into t8 values (1),(2); -insert into t9 values (1),(2); -insert into t10 values (1),(2); -insert into t11 values (1),(2); -insert into t12 values (1),(2); -insert into t13 values (1),(2); -insert into t14 values (1),(2); -insert into t15 values (1),(2); -insert into t16 values (1),(2); -insert into t17 values (1),(2); -insert into t18 values (1),(2); -insert into t19 values (1),(2); -insert into t20 values (1),(2); -insert into t21 values (1),(2); -insert into t22 values (1),(2); -insert into t23 values (1),(2); -insert into t24 values (1),(2); -insert into t25 values (1),(2); -insert into t26 values (1),(2); -insert into t27 values (1),(2); -insert into t28 values (1),(2); -insert into t29 values (1),(2); -insert into t30 values (1),(2); -insert into t31 values (1),(2); -insert into t32 values (1),(2); -insert into t33 values (1),(2); -insert into t34 values (1),(2); -insert into t35 values (1),(2); -insert into t36 values (1),(2); -insert into t37 values (1),(2); -insert into t38 values (1),(2); -insert into t39 values (1),(2); -insert into t40 values (1),(2); -insert into t41 values (1),(2); -insert into t42 values (1),(2); -insert into t43 values (1),(2); -insert into t44 values (1),(2); -insert into t45 values (1),(2); -insert into t46 values (1),(2); -insert into t47 values (1),(2); -insert into t48 values (1),(2); -insert into t49 values (1),(2); -insert into t50 values (1),(2); -insert into t51 values (1),(2); -insert into t52 values (1),(2); -insert into t53 values (1),(2); -insert into t54 values (1),(2); -insert into t55 values (1),(2); -insert into t56 values (1),(2); -insert into t57 values (1),(2); -insert into t58 values (1),(2); -insert into t59 values (1),(2); -insert into t60 values (1),(2); -insert into t61 values (1),(2); -insert into t62 values (1),(2); -insert into t63 values (1),(2); -insert into t64 values (1),(2); -insert into t65 values (1),(2); -insert into t66 values (1),(2); -insert into t67 values (1),(2); -insert into t68 values (1),(2); -insert into t69 values (1),(2); -insert into t70 values (1),(2); -insert into t71 values (1),(2); -insert into t72 values (1),(2); -insert into t73 values (1),(2); -insert into t74 values (1),(2); -insert into t75 values (1),(2); -insert into t76 values (1),(2); -insert into t77 values (1),(2); -insert into t78 values (1),(2); -insert into t79 values (1),(2); -insert into t80 values (1),(2); -insert into t81 values (1),(2); -insert into t82 values (1),(2); -insert into t83 values (1),(2); -insert into t84 values (1),(2); -insert into t85 values (1),(2); -insert into t86 values (1),(2); -insert into t87 values (1),(2); -insert into t88 values (1),(2); -insert into t89 values (1),(2); -insert into t90 values (1),(2); -insert into t91 values (1),(2); -insert into t92 values (1),(2); -insert into t93 values (1),(2); -insert into t94 values (1),(2); -insert into t95 values (1),(2); -insert into t96 values (1),(2); -insert into t97 values (1),(2); -insert into t98 values (1),(2); -insert into t99 values (1),(2); -insert into t100 values (1),(2); -insert into t101 values (1),(2); -insert into t102 values (1),(2); -insert into t103 values (1),(2); -insert into t104 values (1),(2); -insert into t105 values (1),(2); -insert into t106 values (1),(2); -insert into t107 values (1),(2); -insert into t108 values (1),(2); -insert into t109 values (1),(2); -insert into t110 values (1),(2); -insert into t111 values (1),(2); -insert into t112 values (1),(2); -insert into t113 values (1),(2); -insert into t114 values (1),(2); -insert into t115 values (1),(2); -insert into t116 values (1),(2); -insert into t117 values (1),(2); -insert into t118 values (1),(2); -insert into t119 values (1),(2); -insert into t120 values (1),(2); -insert into t121 values (1),(2); -insert into t122 values (1),(2); -insert into t123 values (1),(2); -insert into t124 values (1),(2); -insert into t125 values (1),(2); -insert into t126 values (1),(2); -insert into t127 values (1),(2); -insert into t128 values (1),(2); -insert into t129 values (1),(2); -insert into t130 values (1),(2); -insert into t131 values (1),(2); -insert into t132 values (1),(2); -insert into t133 values (1),(2); -insert into t134 values (1),(2); -insert into t135 values (1),(2); -insert into t136 values (1),(2); -insert into t137 values (1),(2); -insert into t138 values (1),(2); -insert into t139 values (1),(2); -insert into t140 values (1),(2); -insert into t141 values (1),(2); -insert into t142 values (1),(2); -insert into t143 values (1),(2); -insert into t144 values (1),(2); -insert into t145 values (1),(2); -insert into t146 values (1),(2); -insert into t147 values (1),(2); -insert into t148 values (1),(2); -insert into t149 values (1),(2); -insert into t150 values (1),(2); -insert into t151 values (1),(2); -insert into t152 values (1),(2); -insert into t153 values (1),(2); -insert into t154 values (1),(2); -insert into t155 values (1),(2); -insert into t156 values (1),(2); -insert into t157 values (1),(2); -insert into t158 values (1),(2); -insert into t159 values (1),(2); -insert into t160 values (1),(2); -insert into t161 values (1),(2); -insert into t162 values (1),(2); -insert into t163 values (1),(2); -insert into t164 values (1),(2); -insert into t165 values (1),(2); -insert into t166 values (1),(2); -insert into t167 values (1),(2); -insert into t168 values (1),(2); -insert into t169 values (1),(2); -insert into t170 values (1),(2); -insert into t171 values (1),(2); -insert into t172 values (1),(2); -insert into t173 values (1),(2); -insert into t174 values (1),(2); -insert into t175 values (1),(2); -insert into t176 values (1),(2); -insert into t177 values (1),(2); -insert into t178 values (1),(2); -insert into t179 values (1),(2); -insert into t180 values (1),(2); -insert into t181 values (1),(2); -insert into t182 values (1),(2); -insert into t183 values (1),(2); -insert into t184 values (1),(2); -insert into t185 values (1),(2); -insert into t186 values (1),(2); -insert into t187 values (1),(2); -insert into t188 values (1),(2); -insert into t189 values (1),(2); -insert into t190 values (1),(2); -insert into t191 values (1),(2); -insert into t192 values (1),(2); -insert into t193 values (1),(2); -insert into t194 values (1),(2); -insert into t195 values (1),(2); -insert into t196 values (1),(2); -insert into t197 values (1),(2); -insert into t198 values (1),(2); -insert into t199 values (1),(2); -insert into t200 values (1),(2); -insert into t201 values (1),(2); -insert into t202 values (1),(2); -insert into t203 values (1),(2); -insert into t204 values (1),(2); -insert into t205 values (1),(2); -insert into t206 values (1),(2); -insert into t207 values (1),(2); -insert into t208 values (1),(2); -insert into t209 values (1),(2); -insert into t210 values (1),(2); -insert into t211 values (1),(2); -insert into t212 values (1),(2); -insert into t213 values (1),(2); -insert into t214 values (1),(2); -insert into t215 values (1),(2); -insert into t216 values (1),(2); -insert into t217 values (1),(2); -insert into t218 values (1),(2); -insert into t219 values (1),(2); -insert into t220 values (1),(2); -insert into t221 values (1),(2); -insert into t222 values (1),(2); -insert into t223 values (1),(2); -insert into t224 values (1),(2); -insert into t225 values (1),(2); -insert into t226 values (1),(2); -insert into t227 values (1),(2); -insert into t228 values (1),(2); -insert into t229 values (1),(2); -insert into t230 values (1),(2); -insert into t231 values (1),(2); -insert into t232 values (1),(2); -insert into t233 values (1),(2); -insert into t234 values (1),(2); -insert into t235 values (1),(2); -insert into t236 values (1),(2); -insert into t237 values (1),(2); -insert into t238 values (1),(2); -insert into t239 values (1),(2); -insert into t240 values (1),(2); -insert into t241 values (1),(2); -insert into t242 values (1),(2); -insert into t243 values (1),(2); -insert into t244 values (1),(2); -insert into t245 values (1),(2); -insert into t246 values (1),(2); -insert into t247 values (1),(2); -insert into t248 values (1),(2); -insert into t249 values (1),(2); -insert into t250 values (1),(2); -insert into t251 values (1),(2); -insert into t252 values (1),(2); -insert into t253 values (1),(2); -insert into t254 values (1),(2); -insert into t255 values (1),(2); -insert into t256 values (1),(2); select count(*) from t00; count(*) 514 @@ -1172,4 +657,4 @@ delete from t256; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -drop table t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00; +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 6907a9e8299..f72a4a504a0 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -10,7 +10,7 @@ flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush status; -drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00,mysqltest.t1; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00,mysqltest.t1; drop database if exists mysqltest; # @@ -455,526 +455,20 @@ drop table t1; # more then 255 (257) merged tables test # flush status; -create table t0(a int); -create table t1(a int); -create table t2(a int); -create table t3(a int); -create table t4(a int); -create table t5(a int); -create table t6(a int); -create table t7(a int); -create table t8(a int); -create table t9(a int); -create table t10(a int); -create table t11(a int); -create table t12(a int); -create table t13(a int); -create table t14(a int); -create table t15(a int); -create table t16(a int); -create table t17(a int); -create table t18(a int); -create table t19(a int); -create table t20(a int); -create table t21(a int); -create table t22(a int); -create table t23(a int); -create table t24(a int); -create table t25(a int); -create table t26(a int); -create table t27(a int); -create table t28(a int); -create table t29(a int); -create table t30(a int); -create table t31(a int); -create table t32(a int); -create table t33(a int); -create table t34(a int); -create table t35(a int); -create table t36(a int); -create table t37(a int); -create table t38(a int); -create table t39(a int); -create table t40(a int); -create table t41(a int); -create table t42(a int); -create table t43(a int); -create table t44(a int); -create table t45(a int); -create table t46(a int); -create table t47(a int); -create table t48(a int); -create table t49(a int); -create table t50(a int); -create table t51(a int); -create table t52(a int); -create table t53(a int); -create table t54(a int); -create table t55(a int); -create table t56(a int); -create table t57(a int); -create table t58(a int); -create table t59(a int); -create table t60(a int); -create table t61(a int); -create table t62(a int); -create table t63(a int); -create table t64(a int); -create table t65(a int); -create table t66(a int); -create table t67(a int); -create table t68(a int); -create table t69(a int); -create table t70(a int); -create table t71(a int); -create table t72(a int); -create table t73(a int); -create table t74(a int); -create table t75(a int); -create table t76(a int); -create table t77(a int); -create table t78(a int); -create table t79(a int); -create table t80(a int); -create table t81(a int); -create table t82(a int); -create table t83(a int); -create table t84(a int); -create table t85(a int); -create table t86(a int); -create table t87(a int); -create table t88(a int); -create table t89(a int); -create table t90(a int); -create table t91(a int); -create table t92(a int); -create table t93(a int); -create table t94(a int); -create table t95(a int); -create table t96(a int); -create table t97(a int); -create table t98(a int); -create table t99(a int); -create table t100(a int); -create table t101(a int); -create table t102(a int); -create table t103(a int); -create table t104(a int); -create table t105(a int); -create table t106(a int); -create table t107(a int); -create table t108(a int); -create table t109(a int); -create table t110(a int); -create table t111(a int); -create table t112(a int); -create table t113(a int); -create table t114(a int); -create table t115(a int); -create table t116(a int); -create table t117(a int); -create table t118(a int); -create table t119(a int); -create table t120(a int); -create table t121(a int); -create table t122(a int); -create table t123(a int); -create table t124(a int); -create table t125(a int); -create table t126(a int); -create table t127(a int); -create table t128(a int); -create table t129(a int); -create table t130(a int); -create table t131(a int); -create table t132(a int); -create table t133(a int); -create table t134(a int); -create table t135(a int); -create table t136(a int); -create table t137(a int); -create table t138(a int); -create table t139(a int); -create table t140(a int); -create table t141(a int); -create table t142(a int); -create table t143(a int); -create table t144(a int); -create table t145(a int); -create table t146(a int); -create table t147(a int); -create table t148(a int); -create table t149(a int); -create table t150(a int); -create table t151(a int); -create table t152(a int); -create table t153(a int); -create table t154(a int); -create table t155(a int); -create table t156(a int); -create table t157(a int); -create table t158(a int); -create table t159(a int); -create table t160(a int); -create table t161(a int); -create table t162(a int); -create table t163(a int); -create table t164(a int); -create table t165(a int); -create table t166(a int); -create table t167(a int); -create table t168(a int); -create table t169(a int); -create table t170(a int); -create table t171(a int); -create table t172(a int); -create table t173(a int); -create table t174(a int); -create table t175(a int); -create table t176(a int); -create table t177(a int); -create table t178(a int); -create table t179(a int); -create table t180(a int); -create table t181(a int); -create table t182(a int); -create table t183(a int); -create table t184(a int); -create table t185(a int); -create table t186(a int); -create table t187(a int); -create table t188(a int); -create table t189(a int); -create table t190(a int); -create table t191(a int); -create table t192(a int); -create table t193(a int); -create table t194(a int); -create table t195(a int); -create table t196(a int); -create table t197(a int); -create table t198(a int); -create table t199(a int); -create table t200(a int); -create table t201(a int); -create table t202(a int); -create table t203(a int); -create table t204(a int); -create table t205(a int); -create table t206(a int); -create table t207(a int); -create table t208(a int); -create table t209(a int); -create table t210(a int); -create table t211(a int); -create table t212(a int); -create table t213(a int); -create table t214(a int); -create table t215(a int); -create table t216(a int); -create table t217(a int); -create table t218(a int); -create table t219(a int); -create table t220(a int); -create table t221(a int); -create table t222(a int); -create table t223(a int); -create table t224(a int); -create table t225(a int); -create table t226(a int); -create table t227(a int); -create table t228(a int); -create table t229(a int); -create table t230(a int); -create table t231(a int); -create table t232(a int); -create table t233(a int); -create table t234(a int); -create table t235(a int); -create table t236(a int); -create table t237(a int); -create table t238(a int); -create table t239(a int); -create table t240(a int); -create table t241(a int); -create table t242(a int); -create table t243(a int); -create table t244(a int); -create table t245(a int); -create table t246(a int); -create table t247(a int); -create table t248(a int); -create table t249(a int); -create table t250(a int); -create table t251(a int); -create table t252(a int); -create table t253(a int); -create table t254(a int); -create table t255(a int); -create table t256(a int); -create table t00 (a int) type=MERGE UNION=(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256) INSERT_METHOD=FIRST; -insert into t0 values (1),(2); -insert into t1 values (1),(2); -insert into t2 values (1),(2); -insert into t3 values (1),(2); -insert into t4 values (1),(2); -insert into t5 values (1),(2); -insert into t6 values (1),(2); -insert into t7 values (1),(2); -insert into t8 values (1),(2); -insert into t9 values (1),(2); -insert into t10 values (1),(2); -insert into t11 values (1),(2); -insert into t12 values (1),(2); -insert into t13 values (1),(2); -insert into t14 values (1),(2); -insert into t15 values (1),(2); -insert into t16 values (1),(2); -insert into t17 values (1),(2); -insert into t18 values (1),(2); -insert into t19 values (1),(2); -insert into t20 values (1),(2); -insert into t21 values (1),(2); -insert into t22 values (1),(2); -insert into t23 values (1),(2); -insert into t24 values (1),(2); -insert into t25 values (1),(2); -insert into t26 values (1),(2); -insert into t27 values (1),(2); -insert into t28 values (1),(2); -insert into t29 values (1),(2); -insert into t30 values (1),(2); -insert into t31 values (1),(2); -insert into t32 values (1),(2); -insert into t33 values (1),(2); -insert into t34 values (1),(2); -insert into t35 values (1),(2); -insert into t36 values (1),(2); -insert into t37 values (1),(2); -insert into t38 values (1),(2); -insert into t39 values (1),(2); -insert into t40 values (1),(2); -insert into t41 values (1),(2); -insert into t42 values (1),(2); -insert into t43 values (1),(2); -insert into t44 values (1),(2); -insert into t45 values (1),(2); -insert into t46 values (1),(2); -insert into t47 values (1),(2); -insert into t48 values (1),(2); -insert into t49 values (1),(2); -insert into t50 values (1),(2); -insert into t51 values (1),(2); -insert into t52 values (1),(2); -insert into t53 values (1),(2); -insert into t54 values (1),(2); -insert into t55 values (1),(2); -insert into t56 values (1),(2); -insert into t57 values (1),(2); -insert into t58 values (1),(2); -insert into t59 values (1),(2); -insert into t60 values (1),(2); -insert into t61 values (1),(2); -insert into t62 values (1),(2); -insert into t63 values (1),(2); -insert into t64 values (1),(2); -insert into t65 values (1),(2); -insert into t66 values (1),(2); -insert into t67 values (1),(2); -insert into t68 values (1),(2); -insert into t69 values (1),(2); -insert into t70 values (1),(2); -insert into t71 values (1),(2); -insert into t72 values (1),(2); -insert into t73 values (1),(2); -insert into t74 values (1),(2); -insert into t75 values (1),(2); -insert into t76 values (1),(2); -insert into t77 values (1),(2); -insert into t78 values (1),(2); -insert into t79 values (1),(2); -insert into t80 values (1),(2); -insert into t81 values (1),(2); -insert into t82 values (1),(2); -insert into t83 values (1),(2); -insert into t84 values (1),(2); -insert into t85 values (1),(2); -insert into t86 values (1),(2); -insert into t87 values (1),(2); -insert into t88 values (1),(2); -insert into t89 values (1),(2); -insert into t90 values (1),(2); -insert into t91 values (1),(2); -insert into t92 values (1),(2); -insert into t93 values (1),(2); -insert into t94 values (1),(2); -insert into t95 values (1),(2); -insert into t96 values (1),(2); -insert into t97 values (1),(2); -insert into t98 values (1),(2); -insert into t99 values (1),(2); -insert into t100 values (1),(2); -insert into t101 values (1),(2); -insert into t102 values (1),(2); -insert into t103 values (1),(2); -insert into t104 values (1),(2); -insert into t105 values (1),(2); -insert into t106 values (1),(2); -insert into t107 values (1),(2); -insert into t108 values (1),(2); -insert into t109 values (1),(2); -insert into t110 values (1),(2); -insert into t111 values (1),(2); -insert into t112 values (1),(2); -insert into t113 values (1),(2); -insert into t114 values (1),(2); -insert into t115 values (1),(2); -insert into t116 values (1),(2); -insert into t117 values (1),(2); -insert into t118 values (1),(2); -insert into t119 values (1),(2); -insert into t120 values (1),(2); -insert into t121 values (1),(2); -insert into t122 values (1),(2); -insert into t123 values (1),(2); -insert into t124 values (1),(2); -insert into t125 values (1),(2); -insert into t126 values (1),(2); -insert into t127 values (1),(2); -insert into t128 values (1),(2); -insert into t129 values (1),(2); -insert into t130 values (1),(2); -insert into t131 values (1),(2); -insert into t132 values (1),(2); -insert into t133 values (1),(2); -insert into t134 values (1),(2); -insert into t135 values (1),(2); -insert into t136 values (1),(2); -insert into t137 values (1),(2); -insert into t138 values (1),(2); -insert into t139 values (1),(2); -insert into t140 values (1),(2); -insert into t141 values (1),(2); -insert into t142 values (1),(2); -insert into t143 values (1),(2); -insert into t144 values (1),(2); -insert into t145 values (1),(2); -insert into t146 values (1),(2); -insert into t147 values (1),(2); -insert into t148 values (1),(2); -insert into t149 values (1),(2); -insert into t150 values (1),(2); -insert into t151 values (1),(2); -insert into t152 values (1),(2); -insert into t153 values (1),(2); -insert into t154 values (1),(2); -insert into t155 values (1),(2); -insert into t156 values (1),(2); -insert into t157 values (1),(2); -insert into t158 values (1),(2); -insert into t159 values (1),(2); -insert into t160 values (1),(2); -insert into t161 values (1),(2); -insert into t162 values (1),(2); -insert into t163 values (1),(2); -insert into t164 values (1),(2); -insert into t165 values (1),(2); -insert into t166 values (1),(2); -insert into t167 values (1),(2); -insert into t168 values (1),(2); -insert into t169 values (1),(2); -insert into t170 values (1),(2); -insert into t171 values (1),(2); -insert into t172 values (1),(2); -insert into t173 values (1),(2); -insert into t174 values (1),(2); -insert into t175 values (1),(2); -insert into t176 values (1),(2); -insert into t177 values (1),(2); -insert into t178 values (1),(2); -insert into t179 values (1),(2); -insert into t180 values (1),(2); -insert into t181 values (1),(2); -insert into t182 values (1),(2); -insert into t183 values (1),(2); -insert into t184 values (1),(2); -insert into t185 values (1),(2); -insert into t186 values (1),(2); -insert into t187 values (1),(2); -insert into t188 values (1),(2); -insert into t189 values (1),(2); -insert into t190 values (1),(2); -insert into t191 values (1),(2); -insert into t192 values (1),(2); -insert into t193 values (1),(2); -insert into t194 values (1),(2); -insert into t195 values (1),(2); -insert into t196 values (1),(2); -insert into t197 values (1),(2); -insert into t198 values (1),(2); -insert into t199 values (1),(2); -insert into t200 values (1),(2); -insert into t201 values (1),(2); -insert into t202 values (1),(2); -insert into t203 values (1),(2); -insert into t204 values (1),(2); -insert into t205 values (1),(2); -insert into t206 values (1),(2); -insert into t207 values (1),(2); -insert into t208 values (1),(2); -insert into t209 values (1),(2); -insert into t210 values (1),(2); -insert into t211 values (1),(2); -insert into t212 values (1),(2); -insert into t213 values (1),(2); -insert into t214 values (1),(2); -insert into t215 values (1),(2); -insert into t216 values (1),(2); -insert into t217 values (1),(2); -insert into t218 values (1),(2); -insert into t219 values (1),(2); -insert into t220 values (1),(2); -insert into t221 values (1),(2); -insert into t222 values (1),(2); -insert into t223 values (1),(2); -insert into t224 values (1),(2); -insert into t225 values (1),(2); -insert into t226 values (1),(2); -insert into t227 values (1),(2); -insert into t228 values (1),(2); -insert into t229 values (1),(2); -insert into t230 values (1),(2); -insert into t231 values (1),(2); -insert into t232 values (1),(2); -insert into t233 values (1),(2); -insert into t234 values (1),(2); -insert into t235 values (1),(2); -insert into t236 values (1),(2); -insert into t237 values (1),(2); -insert into t238 values (1),(2); -insert into t239 values (1),(2); -insert into t240 values (1),(2); -insert into t241 values (1),(2); -insert into t242 values (1),(2); -insert into t243 values (1),(2); -insert into t244 values (1),(2); -insert into t245 values (1),(2); -insert into t246 values (1),(2); -insert into t247 values (1),(2); -insert into t248 values (1),(2); -insert into t249 values (1),(2); -insert into t250 values (1),(2); -insert into t251 values (1),(2); -insert into t252 values (1),(2); -insert into t253 values (1),(2); -insert into t254 values (1),(2); -insert into t255 values (1),(2); -insert into t256 values (1),(2); -enable_result_log; +disable_query_log; +let $1 = 257; +while ($1) +{ + eval create table t$1(a int); + eval insert into t$1 values (1),(2); + dec $1; +} +create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; +enable_query_log; select count(*) from t00; select count(*) from t00; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; delete from t256; show status like "Qcache_queries_in_cache"; -drop table t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t00; +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00; diff --git a/sql/sql_class.h b/sql/sql_class.h index dcc839e13b1..c4511652b23 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -452,7 +452,6 @@ public: /* variables.transaction_isolation is reset to this after each commit */ enum_tx_isolation session_tx_isolation; char scramble[9]; - uint8 query_cache_type; // type of query cache processing bool slave_thread; bool set_query_id,locked,count_cuted_fields,some_tables_deleted; bool no_errors, allow_sum_func, password, fatal_error; From 083acc29bbae58af407eec6567322fce9af4c010 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Sat, 9 Aug 2003 01:20:02 +0200 Subject: [PATCH 43/87] BETWEEN bug fix: non-const expressions on both ends --- mysql-test/r/range.result | 2 +- sql/sql_select.cc | 69 +++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 4e0476fdacd..5da6f6c30e1 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -240,7 +240,7 @@ t2 range x x 5 NULL 4 Using where explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; table type possible_keys key key_len ref rows Extra t1 ref y y 5 const 1 Using where -t2 ALL x NULL NULL NULL 9 Using where +t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; table type possible_keys key key_len ref rows Extra t1 ref y y 5 const 1 Using where diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6675a310464..c676f389da7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1425,28 +1425,34 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end, static void add_key_field(KEY_FIELD **key_fields,uint and_level, - Field *field,bool eq_func,Item *value, + Field *field,bool eq_func,Item **value, uint num_values, table_map usable_tables) { bool exists_optimize=0; if (!(field->flags & PART_KEY_FLAG)) { // Don't remove column IS NULL on a LEFT JOIN table - if (!eq_func || !value || value->type() != Item::NULL_ITEM || - !field->table->maybe_null || field->null_ptr) + if (!eq_func || (*value)->type() != Item::NULL_ITEM || + !field->table->maybe_null || field->null_ptr) return; // Not a key. Skip it exists_optimize=1; } else { table_map used_tables=0; - if (value && (used_tables=value->used_tables()) & - (field->table->map | RAND_TABLE_BIT)) + bool optimizable=0; + for (uint i=0; iused_tables(); + if (!((*value)->used_tables() & (field->table->map | RAND_TABLE_BIT))) + optimizable=1; + } + if (!optimizable) return; if (!(usable_tables & field->table->map)) { - if (!eq_func || !value || value->type() != Item::NULL_ITEM || - !field->table->maybe_null || field->null_ptr) + if (!eq_func || (*value)->type() != Item::NULL_ITEM || + !field->table->maybe_null || field->null_ptr) return; // Can't use left join optimize exists_optimize=1; } @@ -1457,12 +1463,6 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, field->table->keys_in_use_for_query); stat[0].keys|= possible_keys; // Add possible keys - if (!value) - { // Probably BETWEEN or IN - stat[0].const_keys |= possible_keys; - return; // Can't be used as eq key - } - /* Save the following cases: Field op constant Field LIKE constant where constant doesn't start with a wildcard @@ -1470,24 +1470,34 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, Field op formula Field IS NULL Field IS NOT NULL + Field BETWEEN ... + Field IN ... */ stat[0].key_dependent|=used_tables; - if (value->const_item()) - stat[0].const_keys |= possible_keys; + + bool is_const=1; + for (uint i=0; iconst_item(); + if (is_const) + stat[0].const_keys |= possible_keys; /* We can't always use indexes when comparing a string index to a - number. cmp_type() is checked to allow compare of dates to numbers */ + number. cmp_type() is checked to allow compare of dates to numbers + also eq_func is NEVER true when num_values > 1 + */ if (!eq_func || field->result_type() == STRING_RESULT && - value->result_type() != STRING_RESULT && - field->cmp_type() != value->result_type()) + (*value)->result_type() != STRING_RESULT && + field->cmp_type() != (*value)->result_type()) return; } } + DBUG_ASSERT(num_values == 1); + // DBUG_ASSERT(eq_func); /* QQ: Can I uncomment this ASSERT ? */ /* Store possible eq field */ (*key_fields)->field=field; (*key_fields)->eq_func=eq_func; - (*key_fields)->val=value; + (*key_fields)->val=*value; (*key_fields)->level=(*key_fields)->const_level=and_level; (*key_fields)->exists_optimize=exists_optimize; (*key_fields)++; @@ -1541,10 +1551,12 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, case Item_func::OPTIMIZE_NONE: break; case Item_func::OPTIMIZE_KEY: + // BETWEEN or IN if (cond_func->key_item()->type() == Item::FIELD_ITEM) add_key_field(key_fields,*and_level, - ((Item_field*) (cond_func->key_item()))->field, - 0,(Item*) 0,usable_tables); + ((Item_field*) (cond_func->key_item()))->field, 0, + cond_func->arguments()+1, cond_func->argument_count()-1, + usable_tables); break; case Item_func::OPTIMIZE_OP: { @@ -1556,7 +1568,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, add_key_field(key_fields,*and_level, ((Item_field*) (cond_func->arguments()[0]))->field, equal_func, - (cond_func->arguments()[1]),usable_tables); + cond_func->arguments()+1, 1, usable_tables); } if (cond_func->arguments()[1]->type() == Item::FIELD_ITEM && cond_func->functype() != Item_func::LIKE_FUNC) @@ -1564,7 +1576,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, add_key_field(key_fields,*and_level, ((Item_field*) (cond_func->arguments()[1]))->field, equal_func, - (cond_func->arguments()[0]),usable_tables); + cond_func->arguments(),1,usable_tables); } break; } @@ -1572,10 +1584,11 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, /* column_name IS [NOT] NULL */ if (cond_func->arguments()[0]->type() == Item::FIELD_ITEM) { + Item *tmp=new Item_null; add_key_field(key_fields,*and_level, ((Item_field*) (cond_func->arguments()[0]))->field, cond_func->functype() == Item_func::ISNULL_FUNC, - new Item_null, usable_tables); + &tmp, 1, usable_tables); } break; } @@ -3267,7 +3280,7 @@ change_cond_ref_to_const(I_List *save_list,Item *and_father, static void -propagate_cond_constants(I_List *save_list,COND *and_level, +propagate_cond_constants(I_List *save_list,COND *and_father, COND *cond) { if (cond->type() == Item::COND_ITEM) @@ -3293,7 +3306,7 @@ propagate_cond_constants(I_List *save_list,COND *and_level, cond_cmp->cmp_func->arguments()[1]); } } - else if (and_level != cond && !cond->marker) // In a AND group + else if (and_father != cond && !cond->marker) // In a AND group { if (cond->type() == Item::FUNC_ITEM && (((Item_func*) cond)->functype() == Item_func::EQ_FUNC || @@ -3311,7 +3324,7 @@ propagate_cond_constants(I_List *save_list,COND *and_level, func->arguments()[1]=resolve_const_item(func->arguments()[1], func->arguments()[0]); func->update_used_tables(); - change_cond_ref_to_const(save_list,and_level,and_level, + change_cond_ref_to_const(save_list,and_father,and_father, func->arguments()[0], func->arguments()[1]); } @@ -3320,7 +3333,7 @@ propagate_cond_constants(I_List *save_list,COND *and_level, func->arguments()[0]=resolve_const_item(func->arguments()[0], func->arguments()[1]); func->update_used_tables(); - change_cond_ref_to_const(save_list,and_level,and_level, + change_cond_ref_to_const(save_list,and_father,and_father, func->arguments()[1], func->arguments()[0]); } From 88510546f143bfbc7ba79f49962441487300d701 Mon Sep 17 00:00:00 2001 From: "wax@mysql.com" <> Date: Sun, 10 Aug 2003 05:38:08 +0600 Subject: [PATCH 44/87] BUG replace HAVE_SETFILEPOINTER with __WIN__ --- include/config-win.h | 1 - mysys/my_chsize.c | 36 ++++++++++++++++++------------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/include/config-win.h b/include/config-win.h index cde77a6e0aa..69020636893 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -276,7 +276,6 @@ inline double ulonglong2double(ulonglong value) #define HAVE_ISAM /* We want to have support for ISAM in 4.0 */ #define HAVE_QUERY_CACHE #define SPRINTF_RETURNS_INT -#define HAVE_SETFILEPOINTER /* SetFilePointer function for huge files */ #ifdef NOT_USED #define HAVE_SNPRINTF /* Gave link error */ diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c index 0840a7a69e4..5708ac5b253 100644 --- a/mysys/my_chsize.c +++ b/mysys/my_chsize.c @@ -49,24 +49,7 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE)); DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize)); -#ifdef HAVE_CHSIZE - if (oldsize > newlength || filler == 0) - { - if (chsize(fd,(off_t) newlength)) - { - DBUG_PRINT("error",("errno: %d",errno)); - my_errno=errno; - if (MyFlags & MY_WME) - my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); - DBUG_RETURN(1); - } - else - { - if (filler == 0) - DBUG_RETURN(0); - } - } -#elif defined(HAVE_SETFILEPOINTER) +#ifdef __WIN__ if (oldsize > newlength) { LARGE_INTEGER new_length; @@ -84,6 +67,23 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); DBUG_RETURN(1); } +#elif define(HAVE_CHSIZE) + if (oldsize > newlength || filler == 0) + { + if (chsize(fd,(off_t) newlength)) + { + DBUG_PRINT("error",("errno: %d",errno)); + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); + DBUG_RETURN(1); + } + else + { + if (filler == 0) + DBUG_RETURN(0); + } + } #elif defined(HAVE_FTRUNCATE) if (oldsize > newlength) { From 2fb441fdf726f52b6ada8bdd9c7c11c1056142e5 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Sun, 10 Aug 2003 05:14:16 +0300 Subject: [PATCH 45/87] Remove wrong bug fix when calling create_sort_index. Fix possible replication bug with LOAD DATA ... IGNORE LINES # --- mysql-test/r/rpl_log.result | 5 ++++- mysql-test/t/rpl_log.test | 7 ++++--- sql/log_event.cc | 24 ++++++++++++++++-------- sql/sql_parse.cc | 4 ++-- sql/sql_select.cc | 5 +---- sql/sql_yacc.yy | 2 +- 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index 640e6f02103..2798d1a9fab 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -12,7 +12,10 @@ create table t1(n int not null auto_increment primary key); insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null); -load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +select count(*) from t1; +count(*) +69 drop table t1; show binlog events; Log_name Pos Event_type Server_id Orig_log_pos Info diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test index 8cd9d21a087..ad962b585a1 100644 --- a/mysql-test/t/rpl_log.test +++ b/mysql-test/t/rpl_log.test @@ -13,7 +13,8 @@ create table t1(n int not null auto_increment primary key); insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null); -load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +select count(*) from t1; drop table t1; --replace_result $VERSION VERSION show binlog events; @@ -35,8 +36,8 @@ flush logs; # So, depending on a few milliseconds, we end up with 2 rotate events in the # relay log or one, which influences the output of SHOW SLAVE STATUS, making # it not predictable and causing random test failures. -# To make it predictable, we do a useless update now, but which has the interest -# of making the slave catch both rotate events. +# To make it predictable, we do a useless update now, but which has the +# interest of making the slave catch both rotate events. create table t5 (a int); drop table t5; diff --git a/sql/log_event.cc b/sql/log_event.cc index f7955be3b09..3451ffab65f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -329,8 +329,14 @@ void Load_log_event::pack_info(String* packet) pretty_print_str(&tmp, sql_ex.line_start, sql_ex.line_start_len); } - if ((int)skip_lines > 0) - tmp.append( " IGNORE %ld LINES ", (long) skip_lines); + if ((long) skip_lines > 0) + { + char nr_buff[32], *end; + tmp.append( " IGNORE "); + end= longlong10_to_str((longlong) skip_lines, nr_buff, 10); + tmp.append(nr_buff, (uint) (end-nr_buff)); + tmp.append( " LINES"); + } if (num_fields) { @@ -1338,8 +1344,8 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len); } - if ((int)skip_lines > 0) - fprintf(file, " IGNORE %ld LINES ", (long) skip_lines); + if ((long) skip_lines > 0) + fprintf(file, " IGNORE %ld LINES", (long) skip_lines); if (num_fields) { @@ -1934,20 +1940,22 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, else if (sql_ex.opt_flags & IGNORE_FLAG) handle_dup= DUP_IGNORE; else + { /* - Note that when replication is running fine, if it was DUP_ERROR on the + When replication is running fine, if it was DUP_ERROR on the master then we could choose DUP_IGNORE here, because if DUP_ERROR suceeded on master, and data is identical on the master and slave, then there should be no uniqueness errors on slave, so DUP_IGNORE is the same as DUP_ERROR. But in the unlikely case of uniqueness errors - (because the data on the master and slave happen to be different (user - error or bug), we want LOAD DATA to print an error message on the - slave to discover the problem. + (because the data on the master and slave happen to be different + (user error or bug), we want LOAD DATA to print an error message on + the slave to discover the problem. If reading from net (a 3.23 master), mysql_load() will change this to DUP_IGNORE. */ handle_dup= DUP_ERROR; + } sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG); String field_term(sql_ex.field_term,sql_ex.field_term_len); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 70c0f772d7d..f0e845e6f36 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3579,8 +3579,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) if (options & REFRESH_LOG) { /* - Flush the normal query log, the update log, the binary log, the slow query - log, and the relay log (if it exists). + Flush the normal query log, the update log, the binary log, + the slow query log, and the relay log (if it exists). */ mysql_log.new_file(1); mysql_update_log.new_file(1); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6675a310464..c72d450ae4a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -972,10 +972,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, group ? group : order, select_limit, thd->select_limit)) - { - if (!join.join_tab[join.const_tables].select->quick) - goto err; - } + goto err; } join.having=having; // Actually a parameter thd->proc_info="Sending data"; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b07dca91a20..03837300904 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2024,7 +2024,7 @@ simple_expr: { LEX *lex=Lex; $$= new Item_func_week($3,new Item_int((char*) "0", - lex->thd->variables.default_week_format,1)); + lex->thd->variables.default_week_format,1)); } | WEEK_SYM '(' expr ',' expr ')' { $$= new Item_func_week($3,$5); } From ad976d1ea188afc3a2c1bcb9feabaf679bd2e903 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 12 Aug 2003 13:49:11 +0200 Subject: [PATCH 46/87] - added option "--pull" to be able to update the BK repositories before starting the bootstrap --- Build-tools/Bootstrap | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 33eca958ae0..747d73398ab 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -38,6 +38,7 @@ $opt_export_only= undef; $opt_help= $opt_verbose= 0; $opt_log= undef; $opt_mail= ""; +$opt_pull= undef; $opt_revision= undef; $opt_suffix= ""; $opt_test= undef; @@ -58,6 +59,7 @@ GetOptions( "help|h", "log|l:s", "mail|m=s", + "pull|p", "revision|r=s", "skip-check|s", "skip-manual", @@ -110,6 +112,23 @@ if (($opt_directory ne ".") && (!-d $opt_directory && !$opt_dry_run)) &logger("Logging to $LOGFILE") if (defined $opt_log); +# +# Pull recent changes first +# +if ($opt_pull) +{ + &logger("Updating BK tree $REPO to latest ChangeSet first"); + $command= "cd $REPO; bk pull; cd .."; + &run_command($command, "Could not update $REPO!"); + + unless ($opt_skip_manual) + { + &logger("Updating manual tree in $opt_docdir"); + $command= "cd $opt_docdir; bk pull; cd .."; + &run_command($command, "Could not update $opt_docdir!"); + } +} + # # Use a temporary name until we know the version number # @@ -253,7 +272,7 @@ if (defined $opt_changelog) # # Add the latest manual from the mysqldoc tree # -if (!$opt_skip_manual) +unless ($opt_skip_manual) { $msg= "Adding manual.texi"; &logger($msg); @@ -378,6 +397,7 @@ Options: include a log file snippet, if logging is enabled) Note that the \@-Sign needs to be quoted! Example: --mail=user\\\@domain.com +-p, --pull Update the source BK trees before building -r, --revision= Export the tree as of revision (default is up to the latest revision) -s, --skip-check Skip checking the distribution with "make distcheck" From 147b34e2f4fe28b4528d135102373418241dd6c4 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 12 Aug 2003 15:28:36 +0200 Subject: [PATCH 47/87] snprintf compatibility fix --- myisam/ft_dump.c | 4 ++++ sql/field.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c index d95e719e234..69fef529fa9 100644 --- a/myisam/ft_dump.c +++ b/myisam/ft_dump.c @@ -130,7 +130,11 @@ int main(int argc,char *argv[]) #error #endif +#ifdef HAVE_SNPRINTF snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1); +#else + sprintf(buf,"%.*s",(int) keylen,info->lastkey+1); +#endif casedn_str(buf); total++; lengths[keylen]++; diff --git a/sql/field.cc b/sql/field.cc index 9babe069300..e56d53b1bda 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -742,7 +742,7 @@ void Field_decimal::store(double nr) char buff[320]; fyllchar = zerofill ? (char) '0' : (char) ' '; -#ifdef HAVE_SNPRINTF_ +#ifdef HAVE_SNPRINTF buff[sizeof(buff)-1]=0; // Safety snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr); #else From 06e5657993f20a4caa37db96c05adc9eabc392bb Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 12 Aug 2003 15:30:20 +0200 Subject: [PATCH 48/87] MyISAM was erroneously using max_ref_length when estimating min_pack_length. --- myisam/mi_packrec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 66cfd169026..7557bb8749f 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -165,7 +165,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) diff_length=(int) rec_reflength - (int) share->base.rec_reflength; if (fix_keys) share->rec_reflength=rec_reflength; - share->base.min_block_length=share->min_pack_length+share->pack.ref_length; + share->base.min_block_length=share->min_pack_length+1; + if (share->min_pack_length > 254) + share->base.min_block_length+=2; if (!(share->decode_trees=(MI_DECODE_TREE*) my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+ From ba28624c26a1716cfebf058a4d2ba3bf653026c2 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 12 Aug 2003 15:56:55 +0200 Subject: [PATCH 49/87] myisamchk - don't mark table as crashed if --sort-records= failed because of unappropriate key or read-only table --- myisam/myisamchk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 1a27e9debe8..4fadfd2fc5d 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -1403,20 +1403,20 @@ static int mi_sort_records(MI_CHECK *param, mi_check_print_error(param,"Can't sort table '%s' on key %d; No such key", name,sort_key+1); param->error_printed=0; - DBUG_RETURN(-1); + DBUG_RETURN(0); /* Nothing to do */ } if (keyinfo->flag & HA_FULLTEXT) { mi_check_print_error(param,"Can't sort table '%s' on FULLTEXT key %d", name,sort_key+1); param->error_printed=0; - DBUG_RETURN(-1); + DBUG_RETURN(0); /* Nothing to do */ } if (share->data_file_type == COMPRESSED_RECORD) { mi_check_print_error(param,"Can't sort read-only table '%s'", name); param->error_printed=0; - DBUG_RETURN(-1); + DBUG_RETURN(0); /* Nothing to do */ } if (!(param->testflag & T_SILENT)) { From 3ec7456f8d9679e155d536c85d023585874eec67 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 12 Aug 2003 19:21:38 +0200 Subject: [PATCH 50/87] isam SEARCH_LAST bug fixed --- isam/_search.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isam/_search.c b/isam/_search.c index 93a08ea2b0d..c005e9ddb69 100644 --- a/isam/_search.c +++ b/isam/_search.c @@ -119,7 +119,7 @@ int _nisam_search(register N_INFO *info, register N_KEYDEF *keyinfo, uchar *key, { keypos=_nisam_get_last_key(info,keyinfo,buff,lastkey,keypos); if ((nextflag & SEARCH_LAST) && - _nisam_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND)) + _nisam_key_cmp(keyinfo->seg, lastkey, key, key_len, SEARCH_FIND)) { my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */ goto err; From 94c7024eaa4fb93b407e2aee0002bbd7014eb974 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 12 Aug 2003 23:21:21 +0200 Subject: [PATCH 51/87] - enabled embedded server in the binary distributions by default (Do-compile) - added mysql.info to the binary distribution files (BUG#1019) - heavily reworked the Do-rpm script to be more in line with Do-pkg - create a "docs" subdirectory in the binary distribution and moved the manual, ChangeLog and mysql.info file into it to unclutter the top directory --- Build-tools/Do-compile | 6 +- Build-tools/Do-rpm | 378 +++++++++++----------------- scripts/make_binary_distribution.sh | 19 +- 3 files changed, 163 insertions(+), 240 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 45037c2f3f0..6cf577162ed 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -8,7 +8,7 @@ use Getopt::Long; $opt_distribution=$opt_user=$opt_config_env=""; $opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix=""; $opt_tmp=$opt_version_suffix=""; -$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=0; +$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=0; $opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0; GetOptions( @@ -230,6 +230,7 @@ if ($opt_stage <= 1) $opt_config_options.= " --with-low-memory" if ($opt_with_low_memory); $opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server); $opt_config_options.= " --with-raid" if ($opt_raid); + $opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded); # Only enable InnoDB when requested (required to be able to # build the "Classic" packages that do not include InnoDB) @@ -551,6 +552,9 @@ non-standard location overriding default. --with-small-disk Clean up the build environment before testing the binary distribution (to save disk space) + +--without-embedded +Don't compile the embedded server. EOF exit 1; } diff --git a/Build-tools/Do-rpm b/Build-tools/Do-rpm index 6d107bc2413..77f87cd0358 100755 --- a/Build-tools/Do-rpm +++ b/Build-tools/Do-rpm @@ -1,259 +1,167 @@ -#!/bin/bash +#!/usr/bin/perl -w +# +# Do-rpm - compile RPM packages out of a source tarball and copy the +# resulting RPM packages into the current directory. +# +# The script currently assumes the following environment (which should exist +# like that, if the Do-compile script was used to build the binary +# distribution) +# +# - there must be a source distribution (mysql-.tar.gz) +# in the current directory +# - there must be a spec file (mysql-.spec) in the directory +# $HOME//mysql-/support-files/ +# +# Use the "--help" option for more info! +# +# written by Lenz Grimmer +# -#helper functions +use Getopt::Long; +Getopt::Long::Configure ("bundling"); -function copy_to_bmachine +$opt_dry_run= undef; +$opt_help= undef; +$opt_log= undef; +$opt_mail= ""; +$opt_verbose= undef; +$opt_version= undef; + +GetOptions( + "dry-run", + "help|h", + "log|l:s", + "mail|m=s", + "verbose|v", + "version=s", +) || &print_help; + +# Include helper functions +chomp($PWD= `pwd`); +$LOGGER= "$PWD/logger.pm"; +if (-f "$LOGGER") { - if [ x$local_build = x1 ]; then - rm -f $2 - cp $1 $2 - else - scp $1 $owner@$bmachine:$2 - fi + do "$LOGGER"; +} +else +{ + die "ERROR: $LOGGER cannot be found!\n"; } -function copy_from_bmachine +# +# Override predefined Log file name +# +if (defined $opt_log) { - if [ x$local_build = x1 ]; then - rm -f $2 - cp $1 $2 - else - scp $owner@$bmachine:$1 $2 - fi + if ($opt_log ne "") + { + if ($opt_log =~ /^\/.*/) + { + $LOGFILE= $opt_log; + } + else + { + $LOGFILE= $PWD . "/" . $opt_log; + } + } } -function run_command +&print_help("") if ($opt_help || !$opt_version); + +# +# Newer RPM version ship with a separate tool to build RPMs +# +if (-x "/usr/bin/rpmbuild") { - if [ x$local_build = x1 ]; then - bash $1 - else - cat $1 | ssh $owner@$bmachine bash - fi + $RPM= "/usr/bin/rpmbuild"; +} +else +{ + $RPM= "/bin/rpm"; } -#Supply defaults +foreach $DIR ("/usr/src/packages", "/usr/src/redhat") +{ + if (-d $DIR) + { + $TOPDIR= $DIR; + last; + } +} -# We built on one of two machines -bmachine=work -smachine=work -owner=my +$SPECDIR= $TOPDIR . "/SPECS"; +$SOURCEDIR= $TOPDIR . "/SOURCES"; -# Hard path!! -bpath=`/bin/pwd` +$VERSION= $opt_version; +($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION); +chomp($HOST= `hostname`); +$HOST=~ /^([^.-]*)/; +$HOST= $1; +$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log"; +$SOURCEFILE= "mysql-$VERSION.tar.gz"; +$SPECFILE= "$PWD/$HOST/mysql-$VERSION/support-files/mysql-$VERSION.spec"; -for d in /usr/src/redhat /usr/src/packages ; do -if test -d "$d" -then - rpmdir=$d -fi -done +&logger("Starting RPM build of MySQL-$VERSION on $HOST"); -if test -z "$rpmdir" -then - echo "Could not find suitable rpmdir on this system" - exit 1 -fi - +foreach $file ($SOURCEFILE, $SPECFILE) +{ + &abort("Unable to find $file!") unless (-f "$file"); +} -logdir="$bpath/Logs" +# +# Install source and spec file +# +&logger("Copying SOURCE and SPEC file to build directories."); +$command= "cp"; +$command.= " -v" if ($opt_verbose); +$command.= " $SOURCEFILE $SOURCEDIR"; +&run_command($command, "Unable to copy $SOURCEFILE to $SOURCEDIR!"); +$command= "cp"; +$command.= " -v" if ($opt_verbose); +$command.= " $SPECFILE $SPECDIR"; +&run_command($command, "Unable to copy $SPECFILE to $SPECDIR!"); -###### Perl STUFF ##### +# +# Build the RPMs +# +$command= "$RPM"; +$command.=" -v" if ($opt_verbose); +$command.=" -ba --clean $SPECDIR/$SPECFILE"; +&logger("Builing RPM."); +&run_command($command, "Unable to build RPM!"); -# Perl version numbers. Should be autodetected from the files in the -# Perl-mysql-modules/ directory. -DBI_VERSION="1.14" -DATA_SHOWTABLE_VERSION="3.3" -DBD_MYSQL_VERSION="1.2215" -MAKERPM="$rpmdir/SOURCES/makerpm.pl" +&logger("SUCCESS: RPM files successfully created.") if (!$opt_dry_run); +exit 0; -####################### -AM_MAKEFLAGS="-j 2" +sub print_help +{ + my $message= $_[0]; + if ($message ne "") + { + print "\n"; + print "ERROR: $message\n"; + } + print < --version= -while test $# -gt 0; do - case "$1" in - --rpmdir=*) - rpmdir=`echo $1 | sed -e "s;--rpmdir=;;"` - ;; - --smachine=*) - smachine=`echo $1 | sed -e "s;--smachine=;;"` - ;; - --bmachine=*) - bmachine=`echo $1 | sed -e "s;--bmachine=;;"` - ;; - --owner=*) - owner=`echo $1 | sed -e "s;--owner=;;"` - ;; - --tarball=*) - tarball=`echo $1 | sed -e "s;--tarball=;;"` - ;; - --logdir=*) - logdir=`echo $1 | sed -e "s;--logdir=;;"` - ;; - --local ) - local_build=1 - ;; - --skip-perl ) - skip_perl=1 - ;; - * ) break ;; - esac - shift -done +Creates a binary RPM package out of a MySQL source distribution and copy the +resulting RPMs into the current directory. -echo "Removing old MySQL packages" -rm -f $bpath/NEW-RPMS/MySQL-*rpm +Options: -if [ ! -d "$logdir" ]; then - echo "$logdir does not exist, creating" - mkdir -p $logdir -fi + --dry-run Dry run without executing +-h, --help Print this help +-l, --log[=] Write a log file [to ] + (default is "$LOGFILE") +-m, --mail=
Mail a failure report to the given address + (and include a log file snippet, if logging + is enabled) + Note that the \@-Sign needs to be quoted! + Example: --mail=user\\\@domain.com + --version= The MySQL version number (e.g. 4.0.11-gamma) +-v, --verbose Verbose execution -if [ ! -f "$tarball" ]; then - echo "Tarball file $tarball does not exist, please make one first" - exit 1 -fi - -log=$logdir/Log-RPM-`date +%y%m%d-%H%M` - -echo "Building RPM for MySQL version $VER on $bmachine" -echo "Details in $log" - -( -set -x -# remove old stuff -rm -rf $rpmdir/BUILD/mysql-* -rm -f $rpmdir/SOURCES/mysql-* -rm -f $rpmdir/SRPMS/MySQL-* -rm -f $rpmdir/SPECS/mysql-* -rm -rf /var/tmp/mysql - -# Copy MySQL source and spec files - -#Sasha: I left the scp stuff commented out instead of deleted to make it -#easy to revert in a hurry, if there is a need. Once everything is tested -#and works perfectly, the scp stuff should be deleted to avoid confusion - -#scp $bpath/mysql-$VER.tar.gz $owner@$bmachine:$rpmdir/SOURCES -copy_to_bmachine $tarball $rpmdir/SOURCES -#scp $bpath/Docs/Images/mysql-logo.gif $owner@$bmachine:$rpmdir/SOURCES/mysql.gif -copy_to_bmachine $bpath/Docs/Images/mysql-logo.gif $rpmdir/SOURCES/mysql.gif -#scp $bpath/support-files/mysql-$VER.spec $owner@$bmachine:$rpmdir/SPECS -copy_to_bmachine $bpath/support-files/mysql-$VER.spec $rpmdir/SPECS - -# Copy perl things. Has to be uncompressed since Compress.pm is not -# installed yet. Set CEXT to .gz when we support compression. -CEXT= -#scp $bpath/Perl-mysql-modules/To-SOURCES/* $owner@$bmachine:$rpmdir/SOURCES - -# This had to be installed on the target machince! -# http://www.perl.com/CPAN/modules/by-module/Archive/Archive-Tar-0.21.tar.gz -# cd /usr/lib/perl5/site_perl/5.005; ln -s ../* .; rm -f 5.005 - -TMP_SCRIPT_MYSQL=00-temp-for-do-rpm.$$ -cat > $logdir/$TMP_SCRIPT_MYSQL < $logdir/$TMP_SCRIPT_PERL < $log 2>&1 +EOF + exit 1; +} diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 73aa95a1100..8735fc800ce 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -61,7 +61,7 @@ case $system in esac -mkdir $BASE $BASE/bin \ +mkdir $BASE $BASE/bin $BASE/docs \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \ $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \ $BASE/mysql-test/include $BASE/mysql-test/std_data @@ -73,9 +73,20 @@ if [ $BASE_SYSTEM != "netware" ] ; then chmod o-rwx $BASE/data $BASE/data/* fi -for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - MySQLEULA.txt Docs/manual.html Docs/manual.txt Docs/manual_toc.html \ - LICENSE.doc README.NW Docs/mysqlbug.txt +for i in ChangeLog \ + Docs/manual.html \ + Docs/manual.txt \ + Docs/manual_toc.html \ + Docs/mysql.info +do + if [ -f $i ] + then + $CP $i $BASE/docs + fi +done + +for i in COPYING COPYING.LIB README Docs/INSTALL-BINARY \ + MySQLEULA.txt LICENSE.doc README.NW do if [ -f $i ] then From df3b982195f26a4508f84caaf1d060d922a188d8 Mon Sep 17 00:00:00 2001 From: "wax@mysql.com" <> Date: Wed, 13 Aug 2003 03:22:34 +0600 Subject: [PATCH 52/87] nothing interesting --- mysys/my_chsize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c index 5708ac5b253..e8c3c056029 100644 --- a/mysys/my_chsize.c +++ b/mysys/my_chsize.c @@ -67,7 +67,7 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); DBUG_RETURN(1); } -#elif define(HAVE_CHSIZE) +#elif defined(HAVE_CHSIZE) if (oldsize > newlength || filler == 0) { if (chsize(fd,(off_t) newlength)) From d7367dea43a9bf4c24b9bc70f7057eeb170bbd00 Mon Sep 17 00:00:00 2001 From: "gweir@build.mysql.com" <> Date: Wed, 13 Aug 2003 02:13:45 +0200 Subject: [PATCH 53/87] Bootstrap: Corrections to Bootstrap for --win-dist --- BitKeeper/etc/logging_ok | 1 + Build-tools/Bootstrap | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 49f98d092bb..3ee214e6760 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -22,6 +22,7 @@ gluh@gluh.mysql.r18.ru greg@gcw.ath.cx greg@mysql.com guilhem@mysql.com +gweir@build.mysql.com gweir@work.mysql.com heikki@donna.mysql.fi heikki@hundin.mysql.fi diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 747d73398ab..877978e0b93 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -329,7 +329,7 @@ $command= "make dist"; if ($opt_win_dist) { &logger ("Creating Windows source package"); - $command= "./scripts/make_win_src_distibution"; + $command= "$target_dir/scripts/make_win_src_distribution"; &run_command($command, "make_win_src_distribution failed!"); } From cde03a0183aeb7ade618037543dec6706793dd68 Mon Sep 17 00:00:00 2001 From: "gweir@build.mysql.com" <> Date: Wed, 13 Aug 2003 04:52:03 +0200 Subject: [PATCH 54/87] make_win_src_distribution.sh: Copy some previously missed files --- scripts/make_win_src_distribution.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 8f8ee344e93..fc07068d735 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -249,11 +249,12 @@ touch $BASE/innobase/ib_config.h # cd $SOURCE -for i in COPYING ChangeLog README \ +for i in COPYING COPYING.LIB ChangeLog README \ INSTALL-SOURCE INSTALL-WIN \ INSTALL-WIN-SOURCE \ Docs/manual_toc.html Docs/manual.html \ - Docs/mysqld_error.txt Docs/INSTALL-BINARY + Docs/manual.txt Docs/mysqld_error.txt \ + Docs/INSTALL-BINARY do print_debug "Copying file '$i'" @@ -263,6 +264,20 @@ do fi done +# +# Raw dirs from source tree +# + +for i in Docs/Flags scripts sql-bench SSL \ + tests tools +do + print_debug "Copying directory '$i'" + if [ -d $i ] + then + $CP -R $i $BASE/$i + fi +done + # # Fix some windows files # From c90df7192efa04a6ed54ed9647c595d2faecd5c9 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Wed, 13 Aug 2003 07:12:08 +0200 Subject: [PATCH 55/87] Fixed typo in the Boostrap strip --- Build-tools/Bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 747d73398ab..c1838e1aefc 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -329,7 +329,7 @@ $command= "make dist"; if ($opt_win_dist) { &logger ("Creating Windows source package"); - $command= "./scripts/make_win_src_distibution"; + $command= "./scripts/make_win_src_distribution"; &run_command($command, "make_win_src_distribution failed!"); } From 51008b109c1d30f20c88811870e044be3e79747d Mon Sep 17 00:00:00 2001 From: "gweir@build.mysql.com" <> Date: Wed, 13 Aug 2003 16:36:01 +0200 Subject: [PATCH 56/87] make_win_src_distribution.sh: Clean up script, add needed modifications to generate a complete 4.0 Windows source package --- scripts/make_win_src_distribution.sh | 82 ++++++++++++++++------------ 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index fc07068d735..f0cc70c10c5 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -98,15 +98,29 @@ parse_arguments "$@" for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp do - if [ "$i" ]; then + if [ "$i" ]; then print_debug "Setting TMP to '$i'" - TMP=$i + TMP=$i break fi done - + # +# Convert argument file from unix to DOS text +# + +unix_to_dos() +{ + for arg do + print_debug "Replacing LF -> CRLF from '$arg'" + + sed -e 's/$/\r/' $arg > $arg.tmp + rm -f $arg + mv $arg.tmp $arg + done +} + # # Create a tmp dest directory to copy files @@ -121,16 +135,11 @@ fi $CP -r $SOURCE/VC++Files $BASE ( -find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print +find $BASE \( -name "*.dsp" -o -name "*.dsw" -o -name "*.txt" \) -and -not -path \*SCCS\* -print )|( - while read v + while read v do - print_debug "Replacing LF -> CRLF from '$v'" - - # ^M -> type CTRL V + CTRL M - cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp - rm $v - mv $v.tmp $v + unix_to_dos $v done ) @@ -147,7 +156,7 @@ rm -r -f "$BASE/share/Makefile.am" # Clean up if we did this from a bk tree # -if [ -d $BASE/SCCS ] +if [ -d $BASE/SCCS ] then find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f fi @@ -169,9 +178,9 @@ copy_dir_files() mkdir $BASE/$arg fi for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \ - README INSTALL* LICENSE - do - if [ -f $i ] + README INSTALL* LICENSE + do + if [ -f $i ] then $CP $SOURCE/$arg/$i $BASE/$arg/$i fi @@ -195,21 +204,19 @@ copy_dir_dirs() { for arg do - basedir=$arg - - if [ ! -d $BASE/$arg ]; then - mkdir $BASE/$arg - fi - - copy_dir_files $arg - - cd $SOURCE/$arg/ - for i in * - do - if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then - copy_dir_files $basedir/$i - fi - done + cd $SOURCE + ( + find $arg -type d \ + -and -not -path \*SCCS\* \ + -and -not -path \*.deps\* \ + -and -not -path \*autom4te.cache -print + )|( + while read v + do + copy_dir_files $v + done + ) + done } @@ -254,11 +261,11 @@ for i in COPYING COPYING.LIB ChangeLog README \ INSTALL-WIN-SOURCE \ Docs/manual_toc.html Docs/manual.html \ Docs/manual.txt Docs/mysqld_error.txt \ - Docs/INSTALL-BINARY - + Docs/INSTALL-BINARY + do print_debug "Copying file '$i'" - if [ -f $i ] + if [ -f $i ] then $CP $i $BASE/$i fi @@ -284,11 +291,14 @@ done ./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp +unix_to_dos $BASE/README +mv $BASE/README $BASE/README.txt + # # Initialize the initial data directory # -if [ -f scripts/mysql_install_db ]; then +if [ -f scripts/mysql_install_db ]; then print_debug "Initializing the 'data' directory" scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data fi @@ -349,9 +359,9 @@ which_1 () # Create the result zip/tar file # -set_tarzip_options() +set_tarzip_options() { - for arg + for arg do if [ "$arg" = "tar" ]; then ZIPFILE1=gnutar From c369236517ec2b91e158b1f3398061fe79477fae Mon Sep 17 00:00:00 2001 From: "gweir@build.mysql.com" <> Date: Wed, 13 Aug 2003 16:45:28 +0200 Subject: [PATCH 57/87] make_win_src_distribution.sh: Adding *.txt here didn't work well-- infolist.txt is in a path containing spaces --- scripts/make_win_src_distribution.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index f0cc70c10c5..89454345c7b 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -135,7 +135,7 @@ fi $CP -r $SOURCE/VC++Files $BASE ( -find $BASE \( -name "*.dsp" -o -name "*.dsw" -o -name "*.txt" \) -and -not -path \*SCCS\* -print +find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print )|( while read v do From 225eda66ce19f91caced72926e03b7bd17fcc344 Mon Sep 17 00:00:00 2001 From: "gweir@build.mysql.com" <> Date: Wed, 13 Aug 2003 17:00:22 +0200 Subject: [PATCH 58/87] make_win_src_distribution.sh: 'tools' contains intermediate files --- scripts/make_win_src_distribution.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 89454345c7b..1946da16186 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -227,7 +227,7 @@ copy_dir_dirs() { for i in client dbug extra heap include isam \ libmysql libmysqld merge myisam \ myisammrg mysys regex sql strings \ - vio zlib + tools vio zlib do copy_dir_files $i done @@ -276,7 +276,7 @@ done # for i in Docs/Flags scripts sql-bench SSL \ - tests tools + tests do print_debug "Copying directory '$i'" if [ -d $i ] From fe511fc48921708ea37604fefd8b84da182e73fe Mon Sep 17 00:00:00 2001 From: "gweir@build.mysql.com" <> Date: Wed, 13 Aug 2003 19:32:34 +0200 Subject: [PATCH 59/87] make_win_src_distribution.sh: Add --zip option for finer grain control over what package formats are created Bootstrap: Create both Windows source packages --- Build-tools/Bootstrap | 2 +- scripts/make_win_src_distribution.sh | 79 ++++++++++++++++++---------- 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index c1838e1aefc..1facf7b5f0d 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -329,7 +329,7 @@ $command= "make dist"; if ($opt_win_dist) { &logger ("Creating Windows source package"); - $command= "./scripts/make_win_src_distribution"; + $command= "./scripts/make_win_src_distribution --tar --zip"; &run_command($command, "make_win_src_distribution failed!"); } diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 1946da16186..9b310722886 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -14,6 +14,7 @@ SILENT=0 SUFFIX="" DIRNAME="" OUTTAR=0 +OUTZIP=0 # # This script must run from MySQL top directory @@ -62,7 +63,8 @@ show_usage() echo " --suffix Suffix name for the package" echo " --dirname Directory name to copy files (intermediate)" echo " --silent Do not list verbosely files processed" - echo " --tar Create tar.gz package instead of .zip" + echo " --tar Create tar.gz package" + echo " --zip Create zip package" echo " --help Show this help message" exit 0 @@ -75,12 +77,14 @@ show_usage() parse_arguments() { for arg do case "$arg" in + --add-tar) ADDTAR=1 ;; --debug) DEBUG=1;; --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; --dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;; --silent) SILENT=1 ;; --tar) OUTTAR=1 ;; + --zip) OUTZIP=1 ;; --help) show_usage ;; *) echo "Unknown argument '$arg'" @@ -359,6 +363,10 @@ which_1 () # Create the result zip/tar file # +if [ [ "$OUTTAR" = "0" ] && [ "$OUTZIP" = "0" ] ]; then + OUTZIP=1 +fi + set_tarzip_options() { for arg @@ -385,43 +393,60 @@ set_tarzip_options() done } -if [ "$OUTTAR" = "1" ]; then - set_tarzip_options 'tar' -else - set_tarzip_options 'zip' -fi - -tar=`which_1 $ZIPFILE1 $ZIPFILE2` -if test "$?" = "1" -o "$tar" = "" -then - print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'" - tar=tar - set_tarzip_options 'tar' -fi # # Create the archive # +create_archive() +{ -print_debug "Using $tar to create archive" + print_debug "Using $tar to create archive" -cd $TMP + cd $TMP -rm -f $SOURCE/$NEW_NAME$EXT -$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME -cd $SOURCE + rm -f $SOURCE/$NEW_NAME$EXT + $tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME + cd $SOURCE -if [ "$NEED_COMPRESS" = "1" ] -then - print_debug "Compressing archive" - gzip -9 $NEW_NAME$EXT - EXT="$EXT.gz" + if [ "$NEED_COMPRESS" = "1" ] + then + print_debug "Compressing archive" + gzip -9 $NEW_NAME$EXT + EXT="$EXT.gz" + fi + + if [ "$SILENT" = "0" ] ; then + echo "$NEW_NAME$EXT created successfully !!" + fi +} + +if [ "$OUTTAR" = "1" ]; then + set_tarzip_options 'tar' + + tar=`which_1 $ZIPFILE1 $ZIPFILE2` + if test "$?" = "1" -o "$tar" = "" + then + print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'" + tar=tar + set_tarzip_options 'tar' + fi + + create_archive +fi + +if [ "$OUTZIP" = "1" ]; then + set_tarzip_options 'zip' + + tar=`which_1 $ZIPFILE1 $ZIPFILE2` + if test "$?" = "1" -o "$tar" = "" + then + echo "Search failed for '$ZIPFILE1', '$ZIPFILE2', cannot create zip!" + fi + + create_archive fi print_debug "Removing temporary directory" rm -r -f $BASE -if [ "$SILENT" = "0" ] ; then - echo "$NEW_NAME$EXT created successfully !!" -fi # End of script From a9146ace70a6bc56be969dc55830a875864bbd78 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Fri, 15 Aug 2003 09:54:19 +0300 Subject: [PATCH 60/87] Cleanups to recent patches Fix packet error when using wrong GRANT command --- include/config-win.h | 1 + mysql-test/r/grant.result | 3 + mysql-test/t/grant.test | 5 ++ mysys/my_chsize.c | 143 +++++++++++++++++--------------------- sql/opt_range.cc | 3 +- sql/sql_acl.cc | 2 +- sql/sql_select.cc | 10 ++- 7 files changed, 84 insertions(+), 83 deletions(-) diff --git a/include/config-win.h b/include/config-win.h index 69020636893..9f903b3bcd2 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -276,6 +276,7 @@ inline double ulonglong2double(ulonglong value) #define HAVE_ISAM /* We want to have support for ISAM in 4.0 */ #define HAVE_QUERY_CACHE #define SPRINTF_RETURNS_INT +#define HAVE_SETFILEPOINTER #ifdef NOT_USED #define HAVE_SNPRINTF /* Gave link error */ diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index fccd3715af7..4ce22e84dd5 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -108,3 +108,6 @@ flush privileges; drop table t1; GRANT FILE on mysqltest.* to mysqltest_1@localhost; Wrong usage of DB GRANT and GLOBAL PRIVILEGES +select 1; +1 +1 diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 5b20354336c..4433c9cbffc 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -72,5 +72,10 @@ delete from mysql.tables_priv where user='mysqltest_1'; delete from mysql.columns_priv where user='mysqltest_1'; flush privileges; drop table t1; + +# +# Test some error conditions +# --error 1221 GRANT FILE on mysqltest.* to mysqltest_1@localhost; +select 1; -- To test that the previous command didn't cause problems diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c index e8c3c056029..11187cf4522 100644 --- a/mysys/my_chsize.c +++ b/mysys/my_chsize.c @@ -30,7 +30,7 @@ MyFlags Flags DESCRIPTION - my_chsize() truncates file if shorter, else fill with the filler character + my_chsize() truncates file if shorter else fill with the filler character RETURN VALUE 0 Ok @@ -38,89 +38,74 @@ */ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) { + my_off_t oldsize; + char buff[IO_SIZE]; DBUG_ENTER("my_chsize"); DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength, MyFlags)); - /* if file is shorter, expand with null, else fill unused part with null */ + + oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE)); + DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize)); + + if (oldsize > newlength) +#if defined(HAVE_SETFILEPOINTER) + /* This is for the moment only true on windows */ { - my_off_t oldsize; - char buff[IO_SIZE]; - - oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE)); - DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize)); - -#ifdef __WIN__ - if (oldsize > newlength) + LARGE_INTEGER new_length; + HANDLE win_file= (HANDLE) _get_osfhandle(fd); + new_length.QuadPart = newlength; + if (SetFilePointerEx(win_file,new_length,NULL,FILE_BEGIN)) { - LARGE_INTEGER new_length; - HANDLE win_file; - win_file= (HANDLE)_get_osfhandle(fd); - new_length.QuadPart = newlength; - if (SetFilePointerEx(win_file,new_length,NULL,FILE_BEGIN)) - { - if (SetEndOfFile(win_file)) - DBUG_RETURN(0); - } - DBUG_PRINT("error",("errno: %d",errno)); - my_errno=errno; - if (MyFlags & MY_WME) - my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); - DBUG_RETURN(1); + if (SetEndOfFile(win_file)) + DBUG_RETURN(0); } -#elif defined(HAVE_CHSIZE) - if (oldsize > newlength || filler == 0) - { - if (chsize(fd,(off_t) newlength)) - { - DBUG_PRINT("error",("errno: %d",errno)); - my_errno=errno; - if (MyFlags & MY_WME) - my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),errno); - DBUG_RETURN(1); - } - else - { - if (filler == 0) - DBUG_RETURN(0); - } - } -#elif defined(HAVE_FTRUNCATE) - if (oldsize > newlength) - { - if (ftruncate(fd, (off_t) newlength)) - { - my_errno=errno; - DBUG_PRINT("error",("errno: %d",errno)); - if (MyFlags & MY_WME) - my_error(EE_CANT_CHSIZE, MYF(ME_BELL+ME_WAITTANG), errno); - DBUG_RETURN(1); - } - DBUG_RETURN(0); - } -#else - if (oldsize > newlength) - { /* Fill diff with null */ - VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE))); - swap(my_off_t, newlength, oldsize); - } -#endif - /* Full file with 0 until it's as big as requested */ - bfill(buff, IO_SIZE, filler); - while (newlength-oldsize > IO_SIZE) - { - if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP))) - goto err; - oldsize+= IO_SIZE; - } - if (my_write(fd,(byte*) buff,(uint) (newlength-oldsize),MYF(MY_NABP))) - goto err; - DBUG_RETURN(0); - err: - if (MyFlags & MY_WME) - my_error(EE_CANT_CHSIZE,MYF(ME_BELL+ME_WAITTANG),my_errno); - DBUG_PRINT("error",("errno: %d",my_errno)); - DBUG_RETURN(1); + my_errno= errno; + goto err; } +#elif defined(HAVE_FTRUNCATE) + { + if (ftruncate(fd, (off_t) newlength)) + { + my_errno= errno; + goto err; + } + DBUG_RETURN(0); + } +#elif defined(HAVE_CHSIZE) + { + if (chsize(fd, (off_t) newlength)) + { + my_errno=errno; + goto err; + } + DBUG_RETURN(0); + } +#else + { + /* + Fill space between requested length and true length with 'filler' + We should never come here on any modern machine + */ + VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE))); + swap(my_off_t, newlength, oldsize); + } +#endif + + /* Full file with 'filler' until it's as big as requested */ + bfill(buff, IO_SIZE, filler); + while (newlength-oldsize > IO_SIZE) + { + if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP))) + goto err; + oldsize+= IO_SIZE; + } + if (my_write(fd,(byte*) buff,(uint) (newlength-oldsize),MYF(MY_NABP))) + goto err; + DBUG_RETURN(0); + +err: + DBUG_PRINT("error", ("errno: %d", errno)); + if (MyFlags & MY_WME) + my_error(EE_CANT_CHSIZE, MYF(ME_BELL+ME_WAITTANG), my_errno); + DBUG_RETURN(1); } /* my_chsize */ - - diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c7bad3b18f3..349a5d0271c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -798,7 +798,8 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond) table_map ref_tables=cond->used_tables(); if (cond->type() != Item::FUNC_ITEM) { // Should be a field - if (ref_tables & param->current_table) + if ((ref_tables & param->current_table) || + (ref_tables & ~(param->prev_tables | param->read_tables))) DBUG_RETURN(0); DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 6df778c997b..83cd2c7d2b4 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2370,7 +2370,7 @@ int mysql_grant (THD *thd, const char *db, List &list, else { net_printf(&thd->net,ER_WRONG_USAGE,"DB GRANT","GLOBAL PRIVILEGES"); - result= -1; + result= 1; } } } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c4c2f890f5d..7922af04ea8 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1490,11 +1490,15 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, } } DBUG_ASSERT(num_values == 1); - // DBUG_ASSERT(eq_func); /* QQ: Can I uncomment this ASSERT ? */ + /* + For the moment eq_func is always true. This slot is reserved for future + extensions where we want to remembers other things than just eq comparisons + */ + DBUG_ASSERT(eq_func); /* Store possible eq field */ (*key_fields)->field=field; (*key_fields)->eq_func=eq_func; - (*key_fields)->val=*value; + (*key_fields)->val= *value; (*key_fields)->level=(*key_fields)->const_level=and_level; (*key_fields)->exists_optimize=exists_optimize; (*key_fields)++; @@ -1582,6 +1586,8 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level, if (cond_func->arguments()[0]->type() == Item::FIELD_ITEM) { Item *tmp=new Item_null; + if (!tmp) // Should never be true + return; add_key_field(key_fields,*and_level, ((Item_field*) (cond_func->arguments()[0]))->field, cond_func->functype() == Item_func::ISNULL_FUNC, From 927dff6c47646adf6662a8adf6e8d95ad741ec46 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Fri, 15 Aug 2003 14:55:05 +0200 Subject: [PATCH 61/87] - Added some files to support-files/MacOSX to enable building the Mac OS X startup item: MySQL (the startup script), StartupItem.Description.plist, StartupItem.Info.plist (PKGMaker control files), StartupItem.postinstall (post-installation script for the Startup Item package) - modified support-files/MacOSX/Makefile.am to include the newly added files in the source distribution --- .bzrignore | 1 + support-files/MacOSX/Makefile.am | 6 ++- support-files/MacOSX/MySQL | 46 +++++++++++++++++++ .../MacOSX/StartupItem.Description.plist | 15 ++++++ support-files/MacOSX/StartupItem.Info.plist | 42 +++++++++++++++++ support-files/MacOSX/StartupItem.postinstall | 36 +++++++++++++++ 6 files changed, 145 insertions(+), 1 deletion(-) create mode 100755 support-files/MacOSX/MySQL create mode 100644 support-files/MacOSX/StartupItem.Description.plist create mode 100644 support-files/MacOSX/StartupItem.Info.plist create mode 100755 support-files/MacOSX/StartupItem.postinstall diff --git a/.bzrignore b/.bzrignore index a18a5008cb0..8514eb6ffb1 100644 --- a/.bzrignore +++ b/.bzrignore @@ -535,3 +535,4 @@ Docs/internals.html Docs/internals.pdf Docs/internals.txt Docs/internals_toc.html +scripts/make_win_src_distribution diff --git a/support-files/MacOSX/Makefile.am b/support-files/MacOSX/Makefile.am index b8047942190..ff16fa3235a 100644 --- a/support-files/MacOSX/Makefile.am +++ b/support-files/MacOSX/Makefile.am @@ -22,7 +22,11 @@ EXTRA_DIST = Info.plist.sh \ StartupParameters.plist.sh \ postinstall.sh \ preinstall.sh \ - ReadMe.txt + ReadMe.txt \ + MySQL \ + StartupItem.Description.plist \ + StartupItem.Info.plist \ + StartupItem.postinstall pkgdata_DATA = Info.plist \ Description.plist \ diff --git a/support-files/MacOSX/MySQL b/support-files/MacOSX/MySQL new file mode 100755 index 00000000000..dfba5f8f982 --- /dev/null +++ b/support-files/MacOSX/MySQL @@ -0,0 +1,46 @@ +#!/bin/sh +# +# /Library/StartupItems/MySQL/MySQL +# +# A script to automatically start up MySQL on system bootup +# for Mac OS X. This is actually just a wrapper script around +# the standard mysql.server init script, which is included in +# the binary distribution. +# +# (c) 2003 MySQL AB +# Written by Lenz Grimmer +# + +# Source the common setup functions for startup scripts +test -r /etc/rc.common || exit 1 +. /etc/rc.common + +# The path to the mysql.server init script. The official MySQL +# Mac OS X packages are being installed into /usr/local/mysql. +SCRIPT="/usr/local/mysql/support-files/mysql.server" + +StartService () +{ + if [ "${MYSQLCOM:=-NO-}" = "-YES-" ] ; then + ConsoleMessage "Starting MySQL database server" + $SCRIPT start > /dev/null 2>&1 + fi +} + +StopService () +{ + ConsoleMessage "Stopping MySQL database server" + $SCRIPT stop > /dev/null 2>&1 +} + +RestartService () +{ + ConsoleMessage "Restarting MySQL database server" + $SCRIPT restart > /dev/null 2>&1 +} + +if test -x $SCRIPT ; then + RunService "$1" +else + ConsoleMessage "Could not find MySQL startup script!" +fi diff --git a/support-files/MacOSX/StartupItem.Description.plist b/support-files/MacOSX/StartupItem.Description.plist new file mode 100644 index 00000000000..1f0023bde0d --- /dev/null +++ b/support-files/MacOSX/StartupItem.Description.plist @@ -0,0 +1,15 @@ + + + + + IFPkgDescriptionDeleteWarning + + IFPkgDescriptionDescription + This package enables MySQL to be started up automatically + on system bootup. + IFPkgDescriptionTitle + MySQL Startup Item + IFPkgDescriptionVersion + 1.0 + + diff --git a/support-files/MacOSX/StartupItem.Info.plist b/support-files/MacOSX/StartupItem.Info.plist new file mode 100644 index 00000000000..6bcae9397e5 --- /dev/null +++ b/support-files/MacOSX/StartupItem.Info.plist @@ -0,0 +1,42 @@ + + + + + CFBundleGetInfoString + MySQL Startup Item + CFBundleIdentifier + com.mysql.mysqlstartup + CFBundleName + MySQL Startup Item + CFBundleShortVersionString + 1.0 + IFMajorVersion + 1 + IFMinorVersion + 0 + IFPkgFlagAllowBackRev + + IFPkgFlagAuthorizationAction + RootAuthorization + IFPkgFlagDefaultLocation + /Library/StartupItems/ + IFPkgFlagInstallFat + + IFPkgFlagIsRequired + + IFPkgFlagOverwritePermissions + + IFPkgFlagRelocatable + + IFPkgFlagRestartAction + NoRestart + IFPkgFlagRootVolumeOnly + + IFPkgFlagUpdateInstalledLanguages + + IFPkgFlagUseUserMask + + IFPkgFormatVersion + 0.10000000149011612 + + diff --git a/support-files/MacOSX/StartupItem.postinstall b/support-files/MacOSX/StartupItem.postinstall new file mode 100755 index 00000000000..f6f6f46f211 --- /dev/null +++ b/support-files/MacOSX/StartupItem.postinstall @@ -0,0 +1,36 @@ +#!/bin/sh +# +# postinstall script for the MySQL Startup Item Installation package +# +# This script modifies /etc/hostconfig in the following ways: +# +# - On Mac OS X Server, it disables the startup of the default MySQL +# installation by changing the "MYSQL" start variable to "-NO-". +# - If not existent already, it adds a "MYSQLCOM" start variable, which +# defaults to "-YES-". An already existing MYSQLCOM variable will remain +# untouched. +# +# (c) 2003 MySQL AB +# Author: Lenz Grimmer +# + +CONFFILE="/etc/hostconfig" +TMPFILE=`basename $CONFFILE` || exit 1 +TMPFILE=`mktemp -t $TMPFILE.tmp` || exit 1 + +test -e $CONFFILE || exit 1 + +# Disable the startup of the default MySQL installation that ships with +# Mac OS X Server to avoid conflicts with our installation on bootup +sed -e s/^MYSQL=-YES-/MYSQL=-NO-/g < $CONFFILE > $TMPFILE + +# Add our MYSQLCOM startup variable (enabled by default) +grep -q "^MYSQLCOM" $CONFFILE > /dev/null 2>&1 +if [ $? -ne 0 ] ; then + echo "MYSQLCOM=-YES-" >> $TMPFILE +fi + +# Install the modified file into the default location +cp -f $CONFFILE $CONFFILE~ || exit 1 +mv -f $TMPFILE $CONFFILE || echo "Error while installing new $CONFFILE!" +chmod 644 $CONFFILE From 2a53d5a60e01ac8f6fbbcfe9c32934441b5427bd Mon Sep 17 00:00:00 2001 From: "jani@rhols221.adsl.netsonic.fi" <> Date: Sat, 16 Aug 2003 17:03:48 +0300 Subject: [PATCH 62/87] Fixed a limitation bug in mysqlimport. sql_statement was designed to contain max 1280 characters, but sometimes in rare cases when --columns was used, more than 1280 characters was needed. This is case when a lot of columns was specified using this option. Raised the max value to 8448, which should be enough. --- client/mysqlimport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index a11b7383517..d7f6c4c0368 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -238,7 +238,7 @@ static int get_options(int *argc, char ***argv) static int write_to_table(char *filename, MYSQL *sock) { char tablename[FN_REFLEN], hard_path[FN_REFLEN], - sql_statement[FN_REFLEN*2+256], *end; + sql_statement[FN_REFLEN*16+256], *end; my_bool local_file; DBUG_ENTER("write_to_table"); DBUG_PRINT("enter",("filename: %s",filename)); From d79cbc3b995c22885c24ee0773c6e4e27a5b6ec3 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Sun, 17 Aug 2003 14:10:15 +0300 Subject: [PATCH 63/87] Fix mutex handling in SHOW_VARIABLES (key_buffer_size was not properly protected) Changed some non fatal myisamchk error messages to warnings --- myisam/myisamchk.c | 9 +++++---- sql/handler.cc | 17 ++++++++++++++--- sql/mysql_priv.h | 3 ++- sql/set_var.cc | 22 ++++++++++++++++++++-- sql/sql_parse.cc | 5 +++-- sql/sql_show.cc | 12 +++++------- 6 files changed, 49 insertions(+), 19 deletions(-) diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 4fadfd2fc5d..a0b4515f1dd 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -1400,21 +1400,22 @@ static int mi_sort_records(MI_CHECK *param, if (!(((ulonglong) 1 << sort_key) & share->state.key_map)) { - mi_check_print_error(param,"Can't sort table '%s' on key %d; No such key", + mi_check_print_warning(param, + "Can't sort table '%s' on key %d; No such key", name,sort_key+1); param->error_printed=0; DBUG_RETURN(0); /* Nothing to do */ } if (keyinfo->flag & HA_FULLTEXT) { - mi_check_print_error(param,"Can't sort table '%s' on FULLTEXT key %d", - name,sort_key+1); + mi_check_print_warning(param,"Can't sort table '%s' on FULLTEXT key %d", + name,sort_key+1); param->error_printed=0; DBUG_RETURN(0); /* Nothing to do */ } if (share->data_file_type == COMPRESSED_RECORD) { - mi_check_print_error(param,"Can't sort read-only table '%s'", name); + mi_check_print_warning(param,"Can't sort read-only table '%s'", name); param->error_printed=0; DBUG_RETURN(0); /* Nothing to do */ } diff --git a/sql/handler.cc b/sql/handler.cc index 505f64dff43..96611301bfa 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1020,14 +1020,25 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, void ha_key_cache(void) { - if (keybuff_size) - (void) init_key_cache((ulong) keybuff_size); + /* + The following mutex is not really needed as long as keybuff_size is + treated as a long value, but we use the mutex here to guard for future + changes. + */ + pthread_mutex_lock(&LOCK_global_system_variables); + long tmp= keybuff_size; + pthread_mutex_unlock(&LOCK_global_system_variables); + if (tmp) + (void) init_key_cache(tmp); } void ha_resize_key_cache(void) { - (void) resize_key_cache((ulong) keybuff_size); + pthread_mutex_lock(&LOCK_global_system_variables); + long tmp= keybuff_size; + pthread_mutex_unlock(&LOCK_global_system_variables); + (void) resize_key_cache(tmp); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 0a4728ef325..e31038d7fee 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -507,7 +507,8 @@ void mysqld_list_processes(THD *thd,const char *user,bool verbose); int mysqld_show_status(THD *thd); int mysqld_show_variables(THD *thd,const char *wild); int mysqld_show(THD *thd, const char *wild, show_var_st *variables, - enum enum_var_type value_type); + enum enum_var_type value_type, + pthread_mutex_t *mutex); /* sql_handler.cc */ int mysql_ha_open(THD *thd, TABLE_LIST *tables); diff --git a/sql/set_var.cc b/sql/set_var.cc index b3238d1c0ec..6dc36e312cb 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -729,10 +729,12 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type) bool sys_var_long_ptr::update(THD *thd, set_var *var) { ulonglong tmp= var->value->val_int(); + pthread_mutex_lock(&LOCK_global_system_variables); if (option_limits) *value= (ulong) getopt_ull_limit_value(tmp, option_limits); else *value= (ulong) tmp; + pthread_mutex_unlock(&LOCK_global_system_variables); return 0; } @@ -746,17 +748,21 @@ void sys_var_long_ptr::set_default(THD *thd, enum_var_type type) bool sys_var_ulonglong_ptr::update(THD *thd, set_var *var) { ulonglong tmp= var->value->val_int(); + pthread_mutex_lock(&LOCK_global_system_variables); if (option_limits) *value= (ulonglong) getopt_ull_limit_value(tmp, option_limits); else *value= (ulonglong) tmp; + pthread_mutex_unlock(&LOCK_global_system_variables); return 0; } void sys_var_ulonglong_ptr::set_default(THD *thd, enum_var_type type) { + pthread_mutex_lock(&LOCK_global_system_variables); *value= (ulonglong) option_limits->def_value; + pthread_mutex_unlock(&LOCK_global_system_variables); } @@ -1000,9 +1006,21 @@ Item *sys_var::item(THD *thd, enum_var_type var_type) case SHOW_LONG: return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type)); case SHOW_LONGLONG: - return new Item_int(*(longlong*) value_ptr(thd, var_type)); + { + longlong value; + pthread_mutex_lock(&LOCK_global_system_variables); + value= *(longlong*) value_ptr(thd, var_type); + pthread_mutex_unlock(&LOCK_global_system_variables); + return new Item_int(value); + } case SHOW_HA_ROWS: - return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type)); + { + ha_rows value; + pthread_mutex_lock(&LOCK_global_system_variables); + value= *(ha_rows*) value_ptr(thd, var_type); + pthread_mutex_unlock(&LOCK_global_system_variables); + return new Item_int((longlong) value); + } case SHOW_MY_BOOL: return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1); case SHOW_CHAR: diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 70c0f772d7d..780c97654f5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2146,11 +2146,12 @@ mysql_execute_command(void) break; case SQLCOM_SHOW_STATUS: res= mysqld_show(thd,(lex->wild ? lex->wild->ptr() : NullS),status_vars, - OPT_GLOBAL); + OPT_GLOBAL, &LOCK_status); break; case SQLCOM_SHOW_VARIABLES: res= mysqld_show(thd, (lex->wild ? lex->wild->ptr() : NullS), - init_vars, lex->option_type); + init_vars, lex->option_type, + &LOCK_global_system_variables); break; case SQLCOM_SHOW_LOGS: { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d591a44accf..489635bd85f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1158,7 +1158,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) int mysqld_show(THD *thd, const char *wild, show_var_st *variables, - enum enum_var_type value_type) + enum enum_var_type value_type, + pthread_mutex_t *mutex) { char buff[8192]; String packet2(buff,sizeof(buff)); @@ -1171,8 +1172,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, if (send_fields(thd,field_list,1)) DBUG_RETURN(1); /* purecov: inspected */ - /* pthread_mutex_lock(&THR_LOCK_keycache); */ - pthread_mutex_lock(&LOCK_status); + pthread_mutex_lock(mutex); for (; variables->name; variables++) { if (!(wild && wild[0] && wild_case_compare(variables->name,wild))) @@ -1413,14 +1413,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, goto err; /* purecov: inspected */ } } - pthread_mutex_unlock(&LOCK_status); - /* pthread_mutex_unlock(&THR_LOCK_keycache); */ + pthread_mutex_unlock(&mutex); send_eof(&thd->net); DBUG_RETURN(0); err: - pthread_mutex_unlock(&LOCK_status); - /* pthread_mutex_unlock(&THR_LOCK_keycache); */ + pthread_mutex_unlock(&mutex); DBUG_RETURN(1); } From bb837f35061896c844bd919c38f473aeebc9c866 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Sun, 17 Aug 2003 14:37:26 +0300 Subject: [PATCH 64/87] fixed typo in last push --- sql/sql_show.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 489635bd85f..0321eb3cbba 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1413,12 +1413,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, goto err; /* purecov: inspected */ } } - pthread_mutex_unlock(&mutex); + pthread_mutex_unlock(mutex); send_eof(&thd->net); DBUG_RETURN(0); err: - pthread_mutex_unlock(&mutex); + pthread_mutex_unlock(mutex); DBUG_RETURN(1); } From f26106fe64aec18af27c7cbd154733e77e867c6a Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Mon, 18 Aug 2003 20:01:38 +0200 Subject: [PATCH 65/87] Fix for 64-bit CPUs (u_long is 64 bit there, but in_addr_t is always uint32). That's to make resolveip work on our FreeBSD-5.0/Sparc64 build host. --- extra/resolveip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/resolveip.c b/extra/resolveip.c index ba2db0a4d65..764844bf622 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -110,7 +110,7 @@ static int get_options(int *argc,char ***argv) int main(int argc, char **argv) { struct hostent *hpaddr; - u_long taddr; + in_addr_t taddr; char *ip,**q; int error=0; From d8c31db54b32f1ec093d8024de08ce3ef0d0692e Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 19 Aug 2003 13:49:53 +0200 Subject: [PATCH 66/87] - Optimized and cleaned up the Do-rpm and Bootstrap Perl scripts - Enhanced Do-rpm to support building RPMs with different compilers and options --- Build-tools/Bootstrap | 11 ++-- Build-tools/Do-rpm | 138 ++++++++++++++++++++++++++++++------------ 2 files changed, 104 insertions(+), 45 deletions(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 1facf7b5f0d..4a2e6f284f2 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -10,6 +10,7 @@ # written by Lenz Grimmer # +use Cwd; use Getopt::Long; Getopt::Long::Configure ("bundling"); @@ -26,10 +27,9 @@ else # Some predefined settings $build_command= "BUILD/compile-pentium-max"; -chomp ($LOGFILE= `pwd`); -$LOGFILE.= "/Bootstrap.log"; -chomp ($opt_directory= `pwd`); -$opt_docdir= $opt_directory . "/mysqldoc"; +$PWD= cwd(); +$LOGFILE= $PWD . "/Bootstrap.log"; +$opt_docdir= $PWD . "/mysqldoc"; $opt_build_command= undef; $opt_changelog= undef; $opt_delete= undef; @@ -82,8 +82,7 @@ if (defined $opt_log) } else { - chomp ($LOGFILE= `pwd`); - $LOGFILE.= "/" . $opt_log; + $LOGFILE= $PWD . "/" . $opt_log; } } } diff --git a/Build-tools/Do-rpm b/Build-tools/Do-rpm index 77f87cd0358..0f423feb921 100755 --- a/Build-tools/Do-rpm +++ b/Build-tools/Do-rpm @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# Do-rpm - compile RPM packages out of a source tarball and copy the +# Do-rpm - compile RPM packages out of a source tarball and move the # resulting RPM packages into the current directory. # # The script currently assumes the following environment (which should exist @@ -17,27 +17,43 @@ # written by Lenz Grimmer # +use Cwd; +use File::Basename; +use File::Copy; use Getopt::Long; Getopt::Long::Configure ("bundling"); +use Sys::Hostname; +$opt_cc= undef; +$opt_cflags= undef; +$opt_clean= undef; +$opt_cxx= undef; +$opt_cxxflags= undef; $opt_dry_run= undef; $opt_help= undef; $opt_log= undef; $opt_mail= ""; $opt_verbose= undef; -$opt_version= undef; + +$MAJOR= $MINOR= $RELEASE= 0; GetOptions( - "dry-run", + "cc=s", + "cflags=s", + "clean|c", + "cxx=s", + "cxxflags=s", + "dry-run|t", "help|h", "log|l:s", "mail|m=s", "verbose|v", - "version=s", ) || &print_help; +defined($VERSION=$ARGV[0]) || print_help("Please provide the MySQL version!"); + # Include helper functions -chomp($PWD= `pwd`); +$PWD= cwd(); $LOGGER= "$PWD/logger.pm"; if (-f "$LOGGER") { @@ -66,10 +82,16 @@ if (defined $opt_log) } } -&print_help("") if ($opt_help || !$opt_version); +($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION); +$HOST= hostname(); +$HOST=~ /^([^.-]*)/; +$HOST= $1; +$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log"; + +&print_help("") if ($opt_help); # -# Newer RPM version ship with a separate tool to build RPMs +# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs # if (-x "/usr/bin/rpmbuild") { @@ -80,24 +102,24 @@ else $RPM= "/bin/rpm"; } -foreach $DIR ("/usr/src/packages", "/usr/src/redhat") +if ($RPM) { - if (-d $DIR) - { - $TOPDIR= $DIR; - last; - } + &logger("Found rpm binary: $RPM"); +} +else +{ + &abort("Unable to find RPM binary!"); } -$SPECDIR= $TOPDIR . "/SPECS"; -$SOURCEDIR= $TOPDIR . "/SOURCES"; +# +# determine some RPM settings for this host +# +chomp($RPMARCH= `$RPM --eval "%{_arch}" 2> /dev/null`); +chomp($RPMDIR= `$RPM --eval "%{_rpmdir}" 2> /dev/null`); +chomp($SOURCEDIR= `$RPM --eval "%{_sourcedir}" 2> /dev/null`); +chomp($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`); +chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`); -$VERSION= $opt_version; -($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION); -chomp($HOST= `hostname`); -$HOST=~ /^([^.-]*)/; -$HOST= $1; -$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log"; $SOURCEFILE= "mysql-$VERSION.tar.gz"; $SPECFILE= "$PWD/$HOST/mysql-$VERSION/support-files/mysql-$VERSION.spec"; @@ -112,23 +134,56 @@ foreach $file ($SOURCEFILE, $SPECFILE) # Install source and spec file # &logger("Copying SOURCE and SPEC file to build directories."); -$command= "cp"; -$command.= " -v" if ($opt_verbose); -$command.= " $SOURCEFILE $SOURCEDIR"; -&run_command($command, "Unable to copy $SOURCEFILE to $SOURCEDIR!"); -$command= "cp"; -$command.= " -v" if ($opt_verbose); -$command.= " $SPECFILE $SPECDIR"; -&run_command($command, "Unable to copy $SPECFILE to $SPECDIR!"); +copy($SOURCEFILE, $SOURCEDIR) +or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!"); +copy($SPECFILE, $SPECDIR) +or &abort("Unable to copy $SPECFILE to $SPECDIR!"); + +# +# Set environment variables - these are being used in the +# official MySQL RPM spec file +# +&logger("Setting special build environment variables") +if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx); +$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc); +$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags); +$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags); +$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx); # # Build the RPMs # $command= "$RPM"; -$command.=" -v" if ($opt_verbose); -$command.=" -ba --clean $SPECDIR/$SPECFILE"; -&logger("Builing RPM."); -&run_command($command, "Unable to build RPM!"); +$command.= " -v" if ($opt_verbose); +$command.= " -ba"; +$command.= " --clean" if $opt_clean; +$command.= " $SPECDIR/"; +$command.= basename($SPECFILE); +&logger("Building RPM."); +&run_command($command, "Error while building the RPMs!"); + +# +# Move the resulting RPMs into the pwd +# +$command= "mv"; +$command.= " -v " if ($opt_verbose); +$command.= "$SRCRPMDIR/MySQL*$VERSION*.src.rpm $PWD"; +&run_command($command, "Error moving source RPM!"); + +$command= "mv"; +$command.= " -v " if ($opt_verbose); +$command.= "$RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD"; +&run_command($command, "Error moving binary RPMs!"); + +# +# Clean up +# +if ($opt_clean) +{ + &logger("Removing spec file and source package"); + unlink("$SPECDIR/" . basename($SPECFILE)); + unlink("$SOURCEDIR/$SOURCEFILE"); +} &logger("SUCCESS: RPM files successfully created.") if (!$opt_dry_run); exit 0; @@ -139,18 +194,24 @@ sub print_help if ($message ne "") { print "\n"; - print "ERROR: $message\n"; + print "ERROR: $message\n\n}"; } print < --version= +Usage: Do-rpm -Creates a binary RPM package out of a MySQL source distribution and copy the -resulting RPMs into the current directory. +Creates a binary RPM package out of a MySQL source distribution and moves the +resulting RPMs into the current directory. is the MySQL version +number (e.g. 4.0.11-gamma) Options: - --dry-run Dry run without executing + --cc= Use to compile C code + --ccflags= Use special C compiler flags + --cxx= Use to compile C++ code + --cxxflags= Use special C++ compiler flags +-c, --clean Clean up after the build +-t, --dry-run Dry run without executing -h, --help Print this help -l, --log[=] Write a log file [to ] (default is "$LOGFILE") @@ -159,7 +220,6 @@ Options: is enabled) Note that the \@-Sign needs to be quoted! Example: --mail=user\\\@domain.com - --version= The MySQL version number (e.g. 4.0.11-gamma) -v, --verbose Verbose execution EOF From 21ce7a4da13aca5d496b3c99dfc046cdc0fdd673 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 19 Aug 2003 13:57:58 +0200 Subject: [PATCH 67/87] - Do-pkg can now create a separate package including a MySQL Startup Item for Mac OS X and add it to the installation Disk Image. --- Build-tools/Do-pkg | 127 +++++++++++++++----- support-files/MacOSX/StartupItem.Info.plist | 6 +- 2 files changed, 96 insertions(+), 37 deletions(-) diff --git a/Build-tools/Do-pkg b/Build-tools/Do-pkg index e95d86c0f6e..4d0f120c6e3 100755 --- a/Build-tools/Do-pkg +++ b/Build-tools/Do-pkg @@ -1,7 +1,9 @@ #!/usr/bin/perl -w # # Do-pkg - convert a binary distribution into a Mac OS X PKG and put it -# inside a Disk Image (.dmg) +# inside a Disk Image (.dmg). Additionally, add a separate package, +# including the required Startup Item to automatically start MySQL on +# bootup. # # The script currently assumes the following environment (which should exist # like that, if the Do-compile script was used to build the binary @@ -17,14 +19,19 @@ # written by Lenz Grimmer # +use Cwd; +use File::Basename; +use File::Copy; use Getopt::Long; Getopt::Long::Configure ("bundling"); +use Sys::Hostname; $opt_dry_run= undef; $opt_help= undef; $opt_log= undef; $opt_mail= ""; $opt_skip_dmg= undef; +$opt_skip_si= undef; $opt_suffix= undef; $opt_verbose= undef; $opt_version= undef; @@ -35,13 +42,14 @@ GetOptions( "log|l:s", "mail|m=s", "skip-dmg|skip-disk-image|s", + "skip-si|skip-startup-item", "suffix=s", "verbose|v", "version=s", ) || &print_help; # Include helper functions -chomp($PWD= `pwd`); +$PWD= cwd(); $LOGGER= "$PWD/logger.pm"; if (-f "$LOGGER") { @@ -54,7 +62,7 @@ else $PM= "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"; $TMP= $ENV{TMPDIR}; -$TMP eq "" ? $TMP= $TMP . "/PKGBUILD": $TMP= "/tmp/PKGBUILD"; +$TMP eq "" ? $TMP= $TMP . "/PKGBUILD.$$": $TMP= "/tmp/PKGBUILD.$$"; $PKGROOT= "$TMP/PMROOT"; $PKGDEST= "$TMP/PKG"; $RESOURCE_DIR= "$TMP/Resources"; @@ -62,8 +70,8 @@ $SUFFIX= $opt_suffix; $VERSION= $opt_version; ($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION); $NAME= "mysql$SUFFIX-$VERSION"; -chomp($HOST= `hostname`); -chomp($ID= `whoami`); +$HOST= hostname(); +$ID= getpwuid($>); $HOST=~ /^([^.-]*)/; $HOST= $1; $LOGFILE= "$PWD/Logs/$HOST-$MAJOR.$MINOR$SUFFIX.log"; @@ -73,6 +81,12 @@ $SUPFILEDIR= <$SRCBASEDIR/support-files/MacOSX>; $TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc.tar.gz>; $INFO= <$SUPFILEDIR/Info.plist>; $DESC= <$SUPFILEDIR/Description.plist>; +$SI_INFO= <$SUPFILEDIR/StartupItem.Info.plist>; +$SI_DESC= <$SUPFILEDIR/StartupItem.Description.plist>; +$SI_PARAMS= <$SUPFILEDIR/StartupParameters.plist>; +$SI_POST= <$SUPFILEDIR/StartupItem.postinstall>; +$SI_NAME= "MySQLStartupItem"; +$SI_SCRIPT= <$SUPFILEDIR/MySQL>; @RESOURCES= qw/ ReadMe.txt postinstall preinstall /; @LICENSES= ("$SRCBASEDIR/COPYING","$SRCBASEDIR/MySQLEULA.txt"); @@ -99,7 +113,9 @@ if (defined $opt_log) # Creating the UFS disk image requires root privileges die("You must be root to run this script!") if ($ID ne "root" && !$opt_dry_run); -foreach $file ($TAR, $INFO, $DESC) +@files= ($TAR, $INFO, $DESC); +@files= (@files, $SI_INFO, $SI_DESC, $SI_POST, $SI_SCRIPT) unless $opt_skip_si; +foreach $file (@files) { &abort("Unable to find $file!") unless (-f "$file"); } @@ -112,14 +128,22 @@ foreach $dir ($TMP, $PKGROOT, $PKGDEST, $RESOURCE_DIR) { if (!-d $dir) { - &run_command("mkdir $dir", "Could not make directory $dir!"); + &logger("Creating directory $dir!"); + unless($opt_dry_run) + { + mkdir($dir) or &abort("Could not make directory $dir!"); + } } } foreach $resfile (@RESOURCES) { - $command= "cp $SUPFILEDIR/$resfile $RESOURCE_DIR"; - &run_command($command, "Error while copying $SUPFILEDIR/$resfile to $RESOURCE_DIR"); + &logger("Copying $SUPFILEDIR/$resfile to $RESOURCE_DIR"); + unless($opt_dry_run) + { + copy("$SUPFILEDIR/$resfile", "$RESOURCE_DIR") or + &abort("Error while copying $SUPFILEDIR/$resfile to $RESOURCE_DIR"); + } } # Search for license file @@ -127,12 +151,17 @@ foreach $license (@LICENSES) { if (-f "$license") { - $command= "cp $license $RESOURCE_DIR/License.txt"; - &run_command($command, "Error while copying $license to $RESOURCE_DIR"); + &logger("Copy $license to $RESOURCE_DIR/License.txt"); + unless($opt_dry_run) + { + copy("$license", "$RESOURCE_DIR/License.txt") or + &abort("Error while copying $license to $RESOURCE_DIR"); + } } } -&abort("Could not find a license file!") unless (-f "$RESOURCE_DIR/License.txt"); +&abort("Could not find a license file!") +unless (-f "$RESOURCE_DIR/License.txt"); # Extract the binary tarball and create the "mysql" symlink &logger("Extracting $TAR to $PKGROOT"); @@ -145,10 +174,38 @@ foreach $license (@LICENSES) # returning a non-zero value, even though the package was created correctly &logger("Running PackageMaker"); $command= "$PM -build -p $PKGDEST/$NAME.pkg -f $PKGROOT -r $RESOURCE_DIR -i $INFO -d $DESC || true"; -&run_command($command, "Error while building package!"); +&run_command($command, "Error while building package $NAME.pkg!"); -&logger("Removing $PKGROOT"); -&run_command("rm -rf $PKGROOT", "Unable to remove $PKGROOT!"); +# +# Build the Startup Item PKG +# +unless ($opt_skip_si) +{ + &logger("Cleaning up $PKGROOT"); + &run_command("rm -rf $PKGROOT/*", "Unable to clean up $PKGROOT!"); + &logger("Cleaning up $RESOURCE_DIR"); + &run_command("rm -rf $RESOURCE_DIR/*", "Unable to clean up $RESOURCE_DIR!"); + + &logger("Installing MySQL StartupItem files into $PKGROOT/MySQL"); + unless($opt_dry_run) + { + mkdir("$PKGROOT/MySQL") or &abort("Error creating $PKGROOT/MySQL"); + copy("$SI_SCRIPT", "$PKGROOT/MySQL/") + or &abort("Error copying $SI_SCRIPT!"); + chmod(0755, "$PKGROOT/MySQL/" . basename("$SI_SCRIPT")); + copy("$SI_PARAMS", "$PKGROOT/MySQL/") + or &abort("Error copying $SI_PARAMS!"); + chmod(0644, "$PKGROOT/MySQL/" . basename("$SI_PARAMS")); + &run_command("chown -R root.wheel $PKGROOT/*", "Cannot chown $PKGROOT!"); + copy("$SI_POST", "$RESOURCE_DIR/postinstall") + or &abort("Error copying $SI_POST!"); + chmod(0644, "$RESOURCE_DIR/postinstall"); + } + + &logger("Building $SI_NAME.pkg using PackageMaker"); + $command= "$PM -build -p $PKGDEST/$SI_NAME.pkg -f $PKGROOT -r $RESOURCE_DIR -i $SI_INFO -d $SI_DESC || true"; + &run_command($command, "Error while building package $SI_NAME.pkg!"); +} if ($opt_skip_dmg) { @@ -159,7 +216,7 @@ if ($opt_skip_dmg) # Determine the size of the Disk image to be created and add a 5% safety # margin for filesystem overhead &logger("Determining required disk image size for $PKGDEST"); -if (! $opt_dry_run) +unless($opt_dry_run) { chomp($_= `du -sk $PKGDEST`); @size= split(); @@ -167,7 +224,10 @@ if (! $opt_dry_run) &logger("Disk image size: $size KB"); } -&abort("Zero bytes? Something is wrong here!") if ($size == 0); +unless($opt_dry_run) +{ + &abort("Zero bytes? Something is wrong here!") if ($size == 0); +} # Now create and mount the disk image $TMPNAME= $NAME . ".tmp"; @@ -181,7 +241,7 @@ $command= "hdiutil create $TMPNAME -size ${size}k -ov -fs UFS -volname $NAME"; chomp($mountpoint=`mount | grep "\/Volumes\/$NAME" | cut -f3 -d" "`) if (!$opt_dry_run); &logger("Copying $PKGDEST/$NAME.pkg to Disk image /Volumes/$NAME"); &run_command("ditto $PKGDEST /Volumes/$NAME", "Could not copy $PKGDEST to /Volumes/$NAME!"); -&run_command("ditto $RESOURCE_DIR/ReadMe.txt /Volumes/$NAME", "Could not copy $RESOURCE_DIR/ReadMe.txt to /Volumes/$NAME!"); +&run_command("ditto $SUPFILEDIR/ReadMe.txt /Volumes/$NAME", "Could not copy $SPFILEDIR/ReadMe.txt to /Volumes/$NAME!"); chomp($mountpoint=`mount | grep "\/Volumes\/$NAME" | cut -f1 -d" "`) if (!$opt_dry_run); &abort("/Volumes/$NAME not attached!") if (!$mountpoint && !$opt_dry_run); &logger("Unmounting $mountpoint"); @@ -221,20 +281,23 @@ NOTE: You need to run this script with root privileges (required Options: - --dry-run Dry run without executing --h, --help Print this help --l, --log[=] Write a log file [to ] - (default is "$LOGFILE") --m, --mail=
Mail a failure report to the given address - (and include a log file snippet, if logging - is enabled) - Note that the \@-Sign needs to be quoted! - Example: --mail=user\\\@domain.com --s, --skip-disk-image Just build the PKG, don't put it into a - disk image afterwards - --suffix= The package suffix (e.g. "-standard" or "-pro) - --version= The MySQL version number (e.g. 4.0.11-gamma) --v, --verbose Verbose execution + --dry-run Dry run without executing +-h, --help Print this help +-l, --log[=] Write a log file [to ] + (default is "$LOGFILE") +-m, --mail=
Mail a failure report to the given + address (and include a log file snippet, + if logging is enabled) + Note that the \@-Sign needs to be quoted! + Example: --mail=user\\\@domain.com +-s, --skip-disk-image, --skip-dmg Just build the PKGs, don't put it into a + disk image afterwards + --skip-startup-item, --skip-si Skip the creation of the StartupItem PKG + --suffix= The package suffix + (e.g. "-standard" or "-pro) + --version= The MySQL version number + (e.g. 4.0.11-gamma) +-v, --verbose Verbose execution EOF exit 1; diff --git a/support-files/MacOSX/StartupItem.Info.plist b/support-files/MacOSX/StartupItem.Info.plist index 6bcae9397e5..f403fbe7e84 100644 --- a/support-files/MacOSX/StartupItem.Info.plist +++ b/support-files/MacOSX/StartupItem.Info.plist @@ -19,13 +19,11 @@ IFPkgFlagAuthorizationAction RootAuthorization IFPkgFlagDefaultLocation - /Library/StartupItems/ + /Library/StartupItems IFPkgFlagInstallFat IFPkgFlagIsRequired - IFPkgFlagOverwritePermissions - IFPkgFlagRelocatable IFPkgFlagRestartAction @@ -34,8 +32,6 @@ IFPkgFlagUpdateInstalledLanguages - IFPkgFlagUseUserMask - IFPkgFormatVersion 0.10000000149011612 From ff63a5c3d9a1b51a2f862304a1ce17649aa8d50f Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Tue, 19 Aug 2003 16:03:18 +0300 Subject: [PATCH 68/87] Fix test case --- mysql-test/t/lock_tables_lost_commit-master.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/lock_tables_lost_commit-master.opt b/mysql-test/t/lock_tables_lost_commit-master.opt index d357a51cb27..51ccb915ef0 100644 --- a/mysql-test/t/lock_tables_lost_commit-master.opt +++ b/mysql-test/t/lock_tables_lost_commit-master.opt @@ -1 +1 @@ ---binlog-ignore-db=test innodb \ No newline at end of file +--binlog-ignore-db=test From fefa92f3a7c540b12e0c79b9ec5aa2693de19956 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 19 Aug 2003 15:12:44 +0200 Subject: [PATCH 69/87] Fixes for BUG#1091,1092,1093. Synopsis of these bugs: mysqlbinlog segfaults if --position is just before Exec_load event mysqlbinlog prints uncommented warnings if --database and compiled with debug mysqlbinlog --database does not filter LOAD DATA INFILE --- client/mysqlbinlog.cc | 90 ++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 36 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index ac1c9db30e6..954e9290a76 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -183,7 +183,16 @@ public: void process(Append_block_log_event *ae) { if (ae->file_id >= file_names.elements) - die("Skiped CreateFile event for file_id: %u",ae->file_id); + { + /* + There is no Create_file event (a bad binlog or a big + --position). Assuming it's a big --position, we just do nothing and + print a warning. + */ + fprintf(stderr,"Warning: ignoring Append_block as there is no \ +Create_file event for file_id: %u\n",ae->file_id); + return; + } Create_file_log_event* ce= *((Create_file_log_event**)file_names.buffer + ae->file_id); append_to_file(ce->fname,O_APPEND|O_BINARY|O_WRONLY,ae->block,ae->block_len); @@ -568,44 +577,42 @@ Could not read entry at offset %s : Error in log format or read error", } if (rec_count >= offset) { - // see if we should skip this event (only care about queries for now) - if (one_database) - { - if (ev->get_type_code() == QUERY_EVENT) - { - //const char * log_dbname = ev->get_db(); - const char * log_dbname = ((Query_log_event*)ev)->db; - //printf("entry: %llu, database: %s\n", rec_count, log_dbname); - - if ((log_dbname != NULL) && (strcmp(log_dbname, database))) - { - //printf("skipping, %s is not %s\n", log_dbname, database); - rec_count++; - delete ev; - continue; // next - } -#ifndef DBUG_OFF - else - { - printf("no skip\n"); - } -#endif - } -#ifndef DBUG_OFF - else - { - const char * query_type = ev->get_type_str(); - printf("not query -- %s\n", query_type); - } -#endif - } if (!short_form) fprintf(result_file, "# at %s\n",llstr(old_off,llbuff)); switch (ev->get_type_code()) { + case QUERY_EVENT: + if (one_database) + { + const char * log_dbname = ((Query_log_event*)ev)->db; + if ((log_dbname != NULL) && (strcmp(log_dbname, database))) + { + rec_count++; + delete ev; + continue; // next + } + } + ev->print(result_file, short_form, last_db); + break; case CREATE_FILE_EVENT: { Create_file_log_event* ce= (Create_file_log_event*)ev; + if (one_database) + { + /* + We test if this event has to be ignored. If yes, we don't save this + event; this will have the good side-effect of ignoring all related + Append_block and Exec_load. + Note that Load event from 3.23 is not tested. + */ + const char * log_dbname = ce->db; + if ((log_dbname != NULL) && (strcmp(log_dbname, database))) + { + rec_count++; + delete ev; + continue; // next + } + } ce->print(result_file, short_form, last_db,true); load_processor.process(ce); ev= 0; @@ -620,9 +627,20 @@ Could not read entry at offset %s : Error in log format or read error", ev->print(result_file, short_form, last_db); Execute_load_log_event *exv= (Execute_load_log_event*)ev; Create_file_log_event *ce= load_processor.grab_event(exv->file_id); - ce->print(result_file, short_form, last_db,true); - my_free((char*)ce->fname,MYF(MY_WME)); - delete ce; + /* + if ce is 0, it probably means that we have not seen the Create_file + event (a bad binlog, or most probably --position is after the + Create_file event). Print a warning comment. + */ + if (ce) + { + ce->print(result_file, short_form, last_db,true); + my_free((char*)ce->fname,MYF(MY_WME)); + delete ce; + } + else + fprintf(stderr,"Warning: ignoring Exec_load as there is no \ +Create_file event for file_id: %u\n",exv->file_id); break; } default: @@ -634,7 +652,7 @@ Could not read entry at offset %s : Error in log format or read error", delete ev; } if (fd >= 0) - my_close(fd, MYF(MY_WME)); + my_close(fd, MYF(MY_WME)); end_io_cache(file); } From 1a5c8be4082616fa3347f1c4709cbd7969cd8f01 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 19 Aug 2003 15:46:47 +0200 Subject: [PATCH 70/87] Fix for BUG#1096 which is: "mysqlbinlog does not comment the original LOAD DATA INFILE if it has a "use xx"" --- client/mysqlbinlog.cc | 8 +++++++- sql/log_event.cc | 22 ++++++++++++++++------ sql/log_event.h | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 954e9290a76..a454d6a859f 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -613,7 +613,13 @@ Could not read entry at offset %s : Error in log format or read error", continue; // next } } - ce->print(result_file, short_form, last_db,true); + /* + We print the event, but with a leading '#': this is just to inform the + user of the original command; the command we want to execute will be a + derivation of this original command (we will change the filename and + use LOCAL), prepared in the 'case EXEC_LOAD_EVENT' below. + */ + ce->print(result_file, short_form, last_db, true); load_processor.process(ce); ev= 0; break; diff --git a/sql/log_event.cc b/sql/log_event.cc index 3451ffab65f..591ebf2b5d8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1279,6 +1279,11 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, #ifdef MYSQL_CLIENT void Load_log_event::print(FILE* file, bool short_form, char* last_db) +{ + print(file, short_form, last_db, 0); +} + +void Load_log_event::print(FILE* file, bool short_form, char* last_db, bool commented) { if (!short_form) { @@ -1295,9 +1300,12 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) } if (db && db[0] && !same_db) - fprintf(file, "use %s;\n", db); + fprintf(file, "%suse %s;\n", + commented ? "# " : "", + db); - fprintf(file, "LOAD DATA "); + fprintf(file, "%sLOAD DATA ", + commented ? "# " : ""); if (check_fname_outside_temp_buf()) fprintf(file, "LOCAL "); fprintf(file, "INFILE '%-*s' ", fname_len, fname); @@ -1573,10 +1581,12 @@ void Create_file_log_event::print(FILE* file, bool short_form, if (enable_local) { - if (!check_fname_outside_temp_buf()) - fprintf(file, "#"); - Load_log_event::print(file, 1, last_db); - fprintf(file, "#"); + Load_log_event::print(file, 1, last_db, !check_fname_outside_temp_buf()); + /* + That one is for "file_id: etc" below: in mysqlbinlog we want the #, in + SHOW BINLOG EVENTS we don't. + */ + fprintf(file, "#"); } fprintf(file, " file_id: %d block_len: %d\n", file_id, block_len); diff --git a/sql/log_event.h b/sql/log_event.h index 155da07bebd..1031b940528 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -435,6 +435,7 @@ public: bool use_rli_only_for_errors); #else void print(FILE* file, bool short_form = 0, char* last_db = 0); + void print(FILE* file, bool short_form, char* last_db, bool commented); #endif Load_log_event(const char* buf, int event_len, bool old_format); From 6e32e19047a745b465f7b169966a7112e2d12047 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 19 Aug 2003 17:00:36 +0200 Subject: [PATCH 71/87] Use my_b_append instead of my_b_write on a SEQ_READ_APPEND cache, when we write the first 4 bytes of the relay log. Indeed comments in mysys/mf_iocache.c say we must always use my_b_append for such a cache. This *could* avoid a very rare assertion failure which is: 030524 19:32:38 Slave SQL thread initialized, starting replication in log 'FIRST' at position 0, relay log '/ users/gbichot/4.1.1/mysql-test/var/log/slave-relay-bin.000001' position: 4 030524 19:32:38 next log '/users/gbichot/4.1.1/mysql-test/var/log/slave-relay-bin.000002' is currently active mysqld: mf_iocache.c:701: _my_b_seq_read: Assertion `pos_in_file == info->end_of_file' failed. and which seemed to happen always when the SQL thread and/or the I/O thread were at position 4 in a relay log. --- include/my_sys.h | 2 ++ mysys/mf_iocache.c | 14 ++++++++++++++ sql/log.cc | 2 +- sql/log_event.cc | 16 +--------------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index 7f8b8a80a1c..9f4b91c8bf6 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -677,6 +677,8 @@ extern int _my_b_get(IO_CACHE *info); extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count); +extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count); + extern int my_block_write(IO_CACHE *info, const byte *Buffer, uint Count, my_off_t pos); extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock); diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 0f35ee048bb..d96d4c0db3c 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -988,6 +988,20 @@ end: } +int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count) +{ + /* + Sasha: We are not writing this with the ? operator to avoid hitting + a possible compiler bug. At least gcc 2.95 cannot deal with + several layers of ternary operators that evaluated comma(,) operator + expressions inside - I do have a test case if somebody wants it + */ + if (info->type == SEQ_READ_APPEND) + return my_b_append(info, Buffer, Count); + return my_b_write(info, Buffer, Count); +} + + /* Write a block to disk where part of the data may be inside the record buffer. As all write calls to the data goes through the cache, diff --git a/sql/log.cc b/sql/log.cc index 17715620950..4dce26d23ea 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -263,7 +263,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, an extension for the binary log files. In this case we write a standard header to it. */ - if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE)) + if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE)) goto err; bytes_written += BIN_LOG_HEADER_SIZE; write_file_name_to_index_file=1; diff --git a/sql/log_event.cc b/sql/log_event.cc index 591ebf2b5d8..2a1669737f8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -26,20 +26,6 @@ #include -inline int my_b_safe_write(IO_CACHE* file, const byte *buf, - int len) -{ - /* - Sasha: We are not writing this with the ? operator to avoid hitting - a possible compiler bug. At least gcc 2.95 cannot deal with - several layers of ternary operators that evaluated comma(,) operator - expressions inside - I do have a test case if somebody wants it - */ - if (file->type == SEQ_READ_APPEND) - return my_b_append(file, buf,len); - return my_b_write(file, buf,len); -} - #ifdef MYSQL_CLIENT static void pretty_print_str(FILE* file, char* str, int len) { @@ -2039,7 +2025,7 @@ Slave: load data infile on table '%s' at log position %s in log \ err=ER(sql_errno); } slave_print_error(rli,sql_errno,"\ -Error '%s' running lOAD DATA INFILE on table '%s'. Default database: '%s'", +Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'", err, (char*)table_name, print_slave_db_safe(db)); free_root(&thd->mem_root,0); return 1; From 12f3449c7483015d6113ef1d372271049cc586ec Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Tue, 19 Aug 2003 18:34:44 +0200 Subject: [PATCH 72/87] - Added a missing directory variable definition to the Bootstrap script. --- Build-tools/Bootstrap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 4a2e6f284f2..94446d9880f 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -33,6 +33,7 @@ $opt_docdir= $PWD . "/mysqldoc"; $opt_build_command= undef; $opt_changelog= undef; $opt_delete= undef; +$opt_directory= $PWD; $opt_dry_run= undef; $opt_export_only= undef; $opt_help= $opt_verbose= 0; @@ -104,7 +105,7 @@ defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used system ("bk help > /dev/null") == 0 or &abort("Cannot execute BitKeeper binary!"); system ("bk root $REPO > /dev/null 2>&1") == 0 or &abort("$REPO does not seem to be a valid BK repository!"); -if (($opt_directory ne ".") && (!-d $opt_directory && !$opt_dry_run)) +if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run)) { &abort("Could not find target directory \"$opt_directory\"!"); } From e5fd812d5190c8da1207e7a6462606c0e6c049d3 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 19 Aug 2003 20:53:45 +0200 Subject: [PATCH 73/87] FT-NL bugfix - ignore words that appear more than in 2mio rows to avoid tree overflow. optimization: abort search for common (>50% rows) words earlier. --- myisam/ft_nlq_search.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 95ff700f815..f426b88d77d 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -67,12 +67,9 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)), static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) { uint keylen, r, doc_cnt; -#ifdef EVAL_RUN - uint cnt; - double sum, sum2, suml; -#endif /* EVAL_RUN */ FT_SUPERDOC sdoc, *sptr; TREE_ELEMENT *selem; + double gweight=1; #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT float tmp_weight; #else @@ -84,42 +81,27 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) word->weight=LWS_FOR_QUERY; keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0); -#ifdef EVAL_RUN - keylen-=1+HA_FT_WLEN; -#else /* EVAL_RUN */ keylen-=HA_FT_WLEN; -#endif /* EVAL_RUN */ -#ifdef EVAL_RUN - sum=sum2=suml= -#endif /* EVAL_RUN */ doc_cnt=0; r=_mi_search(aio->info, aio->keyinfo, aio->keybuff, keylen, SEARCH_FIND | SEARCH_PREFIX, aio->key_root); aio->info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */ - while (!r) + while (!r && gweight) { if (_mi_compare_text(aio->charset, aio->info->lastkey,keylen, aio->keybuff,keylen,0)) break; #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT -#ifdef EVAL_RUN - mi_float4get(tmp_weight,aio->info->lastkey+keylen+1); -#else /* EVAL_RUN */ mi_float4get(tmp_weight,aio->info->lastkey+keylen); -#endif /* EVAL_RUN */ #else #error #endif if(tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */ -#ifdef EVAL_RUN - cnt=*(byte *)(aio->info->lastkey+keylen); -#endif /* EVAL_RUN */ - sdoc.doc.dpos=aio->info->lastpos; /* saving document matched into dtree */ @@ -137,11 +119,10 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) sptr->tmp_weight=tmp_weight; doc_cnt++; -#ifdef EVAL_RUN - sum +=cnt; - sum2+=cnt*cnt; - suml+=cnt*log(cnt); -#endif /* EVAL_RUN */ + + gweight=word->weight*GWS_IN_USE; + if (gweight < 0 || doc_cnt > 2000000) + gweight=0; if (_mi_test_if_changed(aio->info) == 0) r=_mi_search_next(aio->info, aio->keyinfo, aio->info->lastkey, @@ -152,13 +133,9 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) aio->info->lastkey_length, SEARCH_BIGGER, aio->key_root); } - if (doc_cnt) - { - word->weight*=GWS_IN_USE; - if (word->weight < 0) - word->weight=0; - } + word->weight=gweight; + DBUG_RETURN(0); } From bb96092202781f33cefe63c7f1290bfad39463e8 Mon Sep 17 00:00:00 2001 From: "dlenev@mysql.com" <> Date: Wed, 20 Aug 2003 03:38:31 +0400 Subject: [PATCH 74/87] Fix for BUG#1086. Now we don't preserve event's log_pos through log-slave-updates since this causes unexpected values in Exec_master_log_pos in A->B->C replication setup, synchronization problems in master_pos_wait()... Still this brokes some functionality in sql/repl_failsafe.cc (but this file is not used now) --- mysql-test/r/rpl_log.result | 12 ++++++------ sql/log_event.cc | 5 ++--- sql/repl_failsafe.cc | 15 +++++++++++++++ sql/slave.cc | 1 - sql/sql_class.cc | 1 - sql/sql_class.h | 1 - sql/sql_parse.cc | 1 + 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index 2798d1a9fab..fbec0542e4b 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -85,15 +85,15 @@ slave-bin.001 263 Query 1 263 use test; drop table t1 slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null) slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581 slave-bin.001 1065 Exec_load 1 1056 ;file_id=1 -slave-bin.001 1088 Query 1 1079 use test; drop table t1 -slave-bin.001 1136 Query 1 4 use test; create table t5 (a int) -slave-bin.001 1194 Query 1 62 use test; drop table t5 +slave-bin.001 1088 Query 1 1088 use test; drop table t1 +slave-bin.001 1136 Query 1 1136 use test; create table t5 (a int) +slave-bin.001 1194 Query 1 1194 use test; drop table t5 slave-bin.001 1242 Rotate 2 1242 slave-bin.002;pos=4 show binlog events in 'slave-bin.002' from 4; Log_name Pos Event_type Server_id Orig_log_pos Info -slave-bin.002 4 Query 1 110 use test; create table t1 (n int) -slave-bin.002 62 Query 1 168 use test; insert into t1 values (1) -slave-bin.002 122 Query 1 228 use test; drop table t1 +slave-bin.002 4 Query 1 4 use test; create table t1 (n int) +slave-bin.002 62 Query 1 62 use test; insert into t1 values (1) +slave-bin.002 122 Query 1 122 use test; drop table t1 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.003 211 master-bin.002 Yes Yes 0 0 276 211 diff --git a/sql/log_event.cc b/sql/log_event.cc index 2a1669737f8..a4883599b2b 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -119,12 +119,11 @@ const char* Log_event::get_type_str() #ifndef MYSQL_CLIENT Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans) - :temp_buf(0), exec_time(0), cached_event_len(0), flags(flags_arg), - thd(thd_arg) + :log_pos(0), temp_buf(0), exec_time(0), cached_event_len(0), + flags(flags_arg), thd(thd_arg) { server_id = thd->server_id; when = thd->start_time; - log_pos = thd->log_pos; cache_stmt= (using_trans && (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))); } diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 0a5f90617d1..dc3f3c87dde 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -249,6 +249,18 @@ static int find_target_pos(LEX_MASTER_INFO *mi, IO_CACHE *log, char *errmsg) /* Impossible */ } +/* + Before 4.0.15 we had a member of THD called log_pos, it was meant for + failsafe replication code in repl_failsafe.cc which is disabled until + it is reworked. Event's log_pos used to be preserved through + log-slave-updates to make code in repl_failsafe.cc work (this + function, SHOW NEW MASTER); but on the other side it caused unexpected + values in Exec_master_log_pos in A->B->C replication setup, + synchronization problems in master_pos_wait(), ... So we + (Dmitri & Guilhem) removed it. + + So for now this function is broken. +*/ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg) { @@ -414,6 +426,9 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, return (Slave_log_event*)ev; } +/* + This function is broken now. See comment for translate_master(). + */ int show_new_master(THD* thd) { diff --git a/sql/slave.cc b/sql/slave.cc index 85a9bc0d49e..145144072c9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2253,7 +2253,6 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) if (!ev->when) ev->when = time(NULL); ev->thd = thd; - thd->log_pos = ev->log_pos; exec_res = ev->exec_event(rli); DBUG_ASSERT(rli->sql_thd==thd); delete ev; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2a65291c273..132e0d7745f 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -125,7 +125,6 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), where="field list"; server_id = ::server_id; slave_net = 0; - log_pos = 0; command=COM_CONNECT; set_query_id=1; db_access=NO_ACCESS; diff --git a/sql/sql_class.h b/sql/sql_class.h index c4511652b23..49a364856eb 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -472,7 +472,6 @@ public: */ ulong slave_proxy_id; NET* slave_net; // network connection from slave -> m. - my_off_t log_pos; /* Used by the sys_var class to store temporary values */ union diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1d82ac6110b..1479a611b5a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1458,6 +1458,7 @@ mysql_execute_command(void) { if (check_global_access(thd, REPL_SLAVE_ACL)) goto error; + /* This query don't work now. See comment in repl_failsafe.cc */ #ifndef WORKING_NEW_MASTER net_printf(&thd->net, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER"); res= 1; From ae8b080549d1cf70ab4275afdc8a0d4fcf42b22a Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Wed, 20 Aug 2003 12:27:06 +0200 Subject: [PATCH 75/87] comment added --- client/mysqltest.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/mysqltest.c b/client/mysqltest.c index f5afa0fa0df..62b5df6c90d 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -221,6 +221,13 @@ const char *command_names[]= "connection", "query", "connect", + /* the difference between sleep and real_sleep is that sleep will use + the delay from command line (--sleep) if there is one. + real_sleep always uses delay from it's argument. + the logic is that sometimes delays are cpu-dependent (and --sleep + can be used to set this delay. real_sleep is used for cpu-independent + delays + */ "sleep", "real_sleep", "inc", From 359846f052f660af465cffe6480433a400da90de Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Wed, 20 Aug 2003 16:25:44 +0300 Subject: [PATCH 76/87] Fixed some varnings from valgrind Set min value of max_allowed_packet to 1024 Fixed problem with UNION's without braces and SQL_CALC_FOUND_ROWS, LIMIT #,# and ORDER BY...LIMIT --- include/m_string.h | 12 ++++ myisam/mi_create.c | 2 +- myisam/mi_search.c | 10 ++- myisam/mi_write.c | 1 - mysql-test/mysql-test-run.sh | 6 -- mysql-test/r/packet.result | 12 ++-- mysql-test/r/union.result | 127 ++++++++++++++++++++++++++++++++++- mysql-test/t/packet.test | 6 +- mysql-test/t/union.test | 56 ++++++++++++++- sql/field.cc | 7 +- sql/ha_innodb.cc | 1 - sql/item_cmpfunc.cc | 17 +++-- sql/item_sum.cc | 67 ++++++++---------- sql/item_sum.h | 32 ++++----- sql/item_uniq.h | 2 +- sql/log.cc | 3 +- sql/mysqld.cc | 2 +- sql/net_serv.cc | 27 +++++--- sql/sql_select.cc | 2 +- sql/sql_union.cc | 65 ++++++++++++++---- 20 files changed, 342 insertions(+), 115 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index c6943613b1a..eae0e8f3f94 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -119,6 +119,18 @@ extern void bmove_allign(gptr dst,const gptr src,uint len); #define bmove512(A,B,C) memcpy(A,B,C) #endif +#ifdef HAVE_purify +#include +#define memcpy_overlap(A,B,C) \ +DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \ +bmove((byte*) key,(byte*) from,(size_t) length); +#else +#define memcpy_overlap(A,B,C) \ +DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \ +memcpy((A), (B), (C)) +#endif /* HAVE_purify */ + + /* Prototypes for string functions */ #if !defined(bfill) && !defined(HAVE_BFILL) diff --git a/myisam/mi_create.c b/myisam/mi_create.c index 9082c2b0d95..9f39c6f522e 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -286,7 +286,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, keydef->seg[0].type == (int) HA_KEYTYPE_NUM) keydef->seg[0].flag&= ~HA_SPACE_PACK; - /* Only use HA_PACK_KEY if the first segment is a variable length key */ + /* Only use HA_PACK_KEY when first segment is a variable length key */ if (!(keydef->seg[0].flag & (HA_SPACE_PACK | HA_BLOB_PART | HA_VAR_LENGTH))) { diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 32db69144d8..423b15ff8f7 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -1218,9 +1218,10 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, register uchar **page_pos, register uchar *key) { reg1 MI_KEYSEG *keyseg; - uchar *start_key,*page=*page_pos,*page_end,*from,*from_end; + uchar *start_key,*page,*page_end,*from,*from_end; uint length,tmp; + page= *page_pos; page_end=page+MI_MAX_KEY_BUFF+1; start_key=key; @@ -1276,7 +1277,9 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, length-=tmp; from=page; from_end=page_end; } - memcpy((byte*) key,(byte*) from,(size_t) length); + DBUG_PRINT("info",("key: %lx from: %lx length: %u", + key, from, length)); + memcpy_overlap((byte*) key, (byte*) from, (size_t) length); key+=length; from+=length; } @@ -1998,6 +2001,9 @@ _mi_calc_bin_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key, uint length,key_length,ref_length; s_temp->totlength=key_length=_mi_keylength(keyinfo,key)+nod_flag; +#ifdef HAVE_purify + s_temp->n_length= s_temp->n_ref_length=0; /* For valgrind */ +#endif s_temp->key=key; s_temp->prev_key=org_key; if (prev_key) /* If not first key in block */ diff --git a/myisam/mi_write.c b/myisam/mi_write.c index d39bbbf5fc7..40e2f301fce 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -887,4 +887,3 @@ void mi_end_bulk_insert(MI_INFO *info) info->bulk_insert=0; } } - diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 55adc3d88fc..bf5546483d3 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -253,12 +253,6 @@ while test $# -gt 0; do --start-and-exit) START_AND_EXIT=1 ;; - --skip-innodb) - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-innodb" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-innodb" ;; - --skip-bdb) - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-bdb" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-bdb" ;; --skip-rpl) NO_SLAVE=1 ;; --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;; --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;; diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result index e994e4d63da..6733f2b142e 100644 --- a/mysql-test/r/packet.result +++ b/mysql-test/r/packet.result @@ -5,12 +5,12 @@ set net_buffer_length=100; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; len 1024 -select repeat('a',200); -repeat('a',200) +select repeat('a',2000); +repeat('a',2000) NULL select @@net_buffer_length, @@max_allowed_packet; @@net_buffer_length @@max_allowed_packet -1024 80 +1024 1024 SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; Got a packet bigger than 'max_allowed_packet' set global max_allowed_packet=default; @@ -20,6 +20,6 @@ set net_buffer_length=default; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; len 100 -select length(repeat('a',200)); -length(repeat('a',200)) -200 +select length(repeat('a',2000)); +length(repeat('a',2000)) +2000 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 51d9f2d17ca..9899b8279e2 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -102,7 +102,7 @@ a b 2 b select found_rows(); found_rows() -6 +8 explain select a,b from t1 union all select a,b from t2; table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 @@ -295,3 +295,128 @@ a b 5 f 6 e drop table t1,t2,t3,t4; +create table t1 (a int); +insert into t1 values (1),(2),(3); +create table t2 (a int); +insert into t2 values (3),(4),(5); +(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1; +a +1 +select found_rows(); +found_rows() +6 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2; +a +1 +3 +select found_rows(); +found_rows() +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2); +a +1 +3 +4 +5 +select found_rows(); +found_rows() +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1); +a +1 +2 +3 +3 +select found_rows(); +found_rows() +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1; +a +1 +select found_rows(); +found_rows() +4 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2; +a +1 +3 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2; +a +1 +2 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2; +a +1 +2 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100; +a +1 +2 +3 +4 +5 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2; +a +1 +2 +3 +4 +5 +select found_rows(); +found_rows() +5 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2; +a +1 +3 +4 +5 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2; +a +1 +3 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2; +a +3 +4 +select found_rows(); +found_rows() +6 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2; +a +3 +4 +5 +select found_rows(); +found_rows() +5 +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; +a +5 +(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4; +a +5 +4 +3 +3 +(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; +Wrong usage/placement of 'SQL_CALC_FOUND_ROWS' +drop table t1,t2; diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test index 5c4e7efcaf3..cbeaa04ca52 100644 --- a/mysql-test/t/packet.test +++ b/mysql-test/t/packet.test @@ -12,8 +12,8 @@ set global net_buffer_length=100; set net_buffer_length=100; # Have to be > 1024 as min value of net_buffer_length is 1024 SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; -# Should return NULL as 200 is bigger than max_allowed_packet -select repeat('a',200); +# Should return NULL as 2000 is bigger than max_allowed_packet +select repeat('a',2000); # # Connection 2 should get error for too big packets @@ -28,4 +28,4 @@ set max_allowed_packet=default; set global net_buffer_length=default; set net_buffer_length=default; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; -select length(repeat('a',200)); +select length(repeat('a',2000)); diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 5f7eba83755..ea7bdb4ee1b 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -16,7 +16,7 @@ select 0,'#' union select a,b from t1 union all select a,b from t2 union select select a,b from t1 union select a,b from t1; select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 group by b; -#test alternate syntax for unions +# Test alternate syntax for unions (select a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 4; (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1); (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; @@ -170,3 +170,57 @@ insert into t3 (select a,b from t1) union (select a,b from t2) limit 2; select * from t3; select * from t4; drop table t1,t2,t3,t4; + +# +# Test of SQL_CALC_FOUND_ROW handling +# +create table t1 (a int); +insert into t1 values (1),(2),(3); +create table t2 (a int); +insert into t2 values (3),(4),(5); + +# Test global limits +(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1; +select found_rows(); +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2; +select found_rows(); + +# Test cases where found_rows() should return number of returned rows +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2); +select found_rows(); +(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1); +select found_rows(); +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1; +select found_rows(); + +# In these case found_rows() should work +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2; +select found_rows(); + +# The following examples will not be exact +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2; +select found_rows(); +SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2; +select found_rows(); + +# Test some limits with ORDER BY +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; +(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4; + +# Wrong usage +--error 1234 +(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; + +drop table t1,t2; diff --git a/sql/field.cc b/sql/field.cc index e56d53b1bda..592252bb294 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4147,8 +4147,11 @@ void Field_blob::store(const char *from,uint len) } } #endif /* USE_TIS620 */ - value.copy(from,len); - from=value.ptr(); + if (from != value.ptr()) // For valgrind + { + value.copy(from, len); + from= value.ptr(); + } #ifdef USE_TIS620 my_free(th_ptr,MYF(MY_ALLOW_ZERO_PTR)); #endif diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 09119a4eb54..3619fefdd1b 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -28,7 +28,6 @@ InnoDB */ #include "mysql_priv.h" #include "slave.h" -#include "sql_cache.h" #ifdef HAVE_INNOBASE_DB #include diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 8c58c58a67d..7415fc5b98e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1045,15 +1045,18 @@ void Item_func_in::fix_length_and_dec() array= new in_double(arg_count); break; } - uint j=0; - for (uint i=0 ; i < arg_count ; i++) + if (array && !(current_thd->fatal_error)) // If not EOM { - array->set(j,args[i]); - if (!args[i]->null_value) // Skip NULL values - j++; + uint j=0; + for (uint i=0 ; i < arg_count ; i++) + { + array->set(j,args[i]); + if (!args[i]->null_value) // Skip NULL values + j++; + } + if ((array->used_count=j)) + array->sort(); } - if ((array->used_count=j)) - array->sort(); } else { diff --git a/sql/item_sum.cc b/sql/item_sum.cc index d88894d4fb4..08385bb9ca6 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -300,15 +300,15 @@ void Item_sum_std::reset_field() } } -void Item_sum_std::update_field(int offset) +void Item_sum_std::update_field() { double nr,old_nr,old_sqr; longlong field_count; char *res=result_field->ptr; - float8get(old_nr,res+offset); - float8get(old_sqr,res+offset+sizeof(double)); - field_count=sint8korr(res+offset+sizeof(double)*2); + float8get(old_nr, res); + float8get(old_sqr, res+sizeof(double)); + field_count=sint8korr(res+sizeof(double)*2); nr=args[0]->val(); if (!args[0]->null_value) @@ -619,12 +619,12 @@ void Item_sum_bit::reset_field() ** calc next value and merge it with field_value */ -void Item_sum_sum::update_field(int offset) +void Item_sum_sum::update_field() { double old_nr,nr; char *res=result_field->ptr; - float8get(old_nr,res+offset); + float8get(old_nr,res); nr=args[0]->val(); if (!args[0]->null_value) { @@ -635,12 +635,12 @@ void Item_sum_sum::update_field(int offset) } -void Item_sum_count::update_field(int offset) +void Item_sum_count::update_field() { longlong nr; char *res=result_field->ptr; - nr=sint8korr(res+offset); + nr=sint8korr(res); if (!args[0]->maybe_null) nr++; else @@ -653,14 +653,14 @@ void Item_sum_count::update_field(int offset) } -void Item_sum_avg::update_field(int offset) +void Item_sum_avg::update_field() { double nr,old_nr; longlong field_count; char *res=result_field->ptr; - float8get(old_nr,res+offset); - field_count=sint8korr(res+offset+sizeof(double)); + float8get(old_nr,res); + field_count=sint8korr(res+sizeof(double)); nr=args[0]->val(); if (!args[0]->null_value) @@ -673,78 +673,66 @@ void Item_sum_avg::update_field(int offset) int8store(res,field_count); } -void Item_sum_hybrid::update_field(int offset) +void Item_sum_hybrid::update_field() { if (hybrid_type == STRING_RESULT) - min_max_update_str_field(offset); + min_max_update_str_field(); else if (hybrid_type == INT_RESULT) - min_max_update_int_field(offset); + min_max_update_int_field(); else - min_max_update_real_field(offset); + min_max_update_real_field(); } void -Item_sum_hybrid::min_max_update_str_field(int offset) +Item_sum_hybrid::min_max_update_str_field() { String *res_str=args[0]->val_str(&value); - if (args[0]->null_value) - result_field->copy_from_tmp(offset); // Use old value - else + if (!args[0]->null_value) { res_str->strip_sp(); - result_field->ptr+=offset; // Get old max/min result_field->val_str(&tmp_value,&tmp_value); - result_field->ptr-=offset; if (result_field->is_null() || (cmp_sign * (binary ? stringcmp(res_str,&tmp_value) : sortcmp(res_str,&tmp_value)) < 0)) result_field->store(res_str->ptr(),res_str->length()); - else - { // Use old value - char *res=result_field->ptr; - memcpy(res,res+offset,result_field->pack_length()); - } result_field->set_notnull(); } } void -Item_sum_hybrid::min_max_update_real_field(int offset) +Item_sum_hybrid::min_max_update_real_field() { double nr,old_nr; - result_field->ptr+=offset; old_nr=result_field->val_real(); nr=args[0]->val(); if (!args[0]->null_value) { - if (result_field->is_null(offset) || + if (result_field->is_null(0) || (cmp_sign > 0 ? old_nr > nr : old_nr < nr)) old_nr=nr; result_field->set_notnull(); } - else if (result_field->is_null(offset)) + else if (result_field->is_null(0)) result_field->set_null(); - result_field->ptr-=offset; result_field->store(old_nr); } void -Item_sum_hybrid::min_max_update_int_field(int offset) +Item_sum_hybrid::min_max_update_int_field() { longlong nr,old_nr; - result_field->ptr+=offset; old_nr=result_field->val_int(); nr=args[0]->val_int(); if (!args[0]->null_value) { - if (result_field->is_null(offset)) + if (result_field->is_null(0)) old_nr=nr; else { @@ -757,30 +745,29 @@ Item_sum_hybrid::min_max_update_int_field(int offset) } result_field->set_notnull(); } - else if (result_field->is_null(offset)) + else if (result_field->is_null(0)) result_field->set_null(); - result_field->ptr-=offset; result_field->store(old_nr); } -void Item_sum_or::update_field(int offset) +void Item_sum_or::update_field() { ulonglong nr; char *res=result_field->ptr; - nr=uint8korr(res+offset); + nr=uint8korr(res); nr|= (ulonglong) args[0]->val_int(); int8store(res,nr); } -void Item_sum_and::update_field(int offset) +void Item_sum_and::update_field() { ulonglong nr; char *res=result_field->ptr; - nr=uint8korr(res+offset); + nr=uint8korr(res); nr&= (ulonglong) args[0]->val_int(); int8store(res,nr); } diff --git a/sql/item_sum.h b/sql/item_sum.h index 2369b5d1d7e..5189566fdfb 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -56,7 +56,7 @@ public: virtual void reset()=0; virtual bool add()=0; virtual void reset_field()=0; - virtual void update_field(int offset)=0; + virtual void update_field()=0; virtual bool keep_field_type(void) const { return 0; } virtual void fix_length_and_dec() { maybe_null=1; null_value=1; } virtual const char *func_name() const { return "?"; } @@ -116,7 +116,7 @@ class Item_sum_sum :public Item_sum_num bool add(); double val(); void reset_field(); - void update_field(int offset); + void update_field(); void no_rows_in_result() {} const char *func_name() const { return "sum"; } unsigned int size_of() { return sizeof(*this);} @@ -141,7 +141,7 @@ class Item_sum_count :public Item_sum_int void make_const(longlong count_arg) { count=count_arg; used_table_cache=0; } longlong val_int(); void reset_field(); - void update_field(int offset); + void update_field(); const char *func_name() const { return "count"; } unsigned int size_of() { return sizeof(*this);} }; @@ -193,7 +193,7 @@ class Item_sum_count_distinct :public Item_sum_int bool add(); longlong val_int(); void reset_field() { return ;} // Never called - void update_field(int offset) { return ; } // Never called + void update_field() { return ; } // Never called const char *func_name() const { return "count_distinct"; } bool setup(THD *thd); void no_rows_in_result() {} @@ -235,7 +235,7 @@ class Item_sum_avg :public Item_sum_num bool add(); double val(); void reset_field(); - void update_field(int offset); + void update_field(); Item *result_item(Field *field) { return new Item_avg_field(this); } const char *func_name() const { return "avg"; } @@ -273,7 +273,7 @@ class Item_sum_std :public Item_sum_num bool add(); double val(); void reset_field(); - void update_field(int offset); + void update_field(); Item *result_item(Field *field) { return new Item_std_field(this); } const char *func_name() const { return "std"; } @@ -316,10 +316,10 @@ class Item_sum_hybrid :public Item_sum void make_const() { used_table_cache=0; } bool keep_field_type(void) const { return 1; } enum Item_result result_type () const { return hybrid_type; } - void update_field(int offset); - void min_max_update_str_field(int offset); - void min_max_update_real_field(int offset); - void min_max_update_int_field(int offset); + void update_field(); + void min_max_update_str_field(); + void min_max_update_real_field(); + void min_max_update_int_field(); unsigned int size_of() { return sizeof(*this);} }; @@ -371,7 +371,7 @@ class Item_sum_or :public Item_sum_bit public: Item_sum_or(Item *item_par) :Item_sum_bit(item_par,LL(0)) {} bool add(); - void update_field(int offset); + void update_field(); const char *func_name() const { return "bit_or"; } unsigned int size_of() { return sizeof(*this);} }; @@ -382,7 +382,7 @@ class Item_sum_and :public Item_sum_bit public: Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ~(ulonglong) LL(0)) {} bool add(); - void update_field(int offset); + void update_field(); const char *func_name() const { return "bit_and"; } unsigned int size_of() { return sizeof(*this);} }; @@ -414,7 +414,7 @@ public: void reset(); bool add(); void reset_field() {}; - void update_field(int offset_arg) {}; + void update_field() {}; unsigned int size_of() { return sizeof(*this);} }; @@ -482,7 +482,7 @@ class Item_sum_udf_float :public Item_sum_num double val() { return 0.0; } void reset() {} bool add() { return 0; } - void update_field(int offset) {} + void update_field() {} }; @@ -497,7 +497,7 @@ public: double val() { return 0; } void reset() {} bool add() { return 0; } - void update_field(int offset) {} + void update_field() {} }; @@ -515,7 +515,7 @@ public: enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } void reset() {} bool add() { return 0; } - void update_field(int offset) {} + void update_field() {} }; #endif /* HAVE_DLOPEN */ diff --git a/sql/item_uniq.h b/sql/item_uniq.h index cc087832f49..de239d3a8ec 100644 --- a/sql/item_uniq.h +++ b/sql/item_uniq.h @@ -42,7 +42,7 @@ public: void reset() {} bool add() { return 0; } void reset_field() {} - void update_field(int offset) {} + void update_field() {} bool fix_fields(THD *thd,struct st_table_list *tlist) { return 0;} unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/log.cc b/sql/log.cc index 4dce26d23ea..7e12297d8ae 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -263,7 +263,8 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, an extension for the binary log files. In this case we write a standard header to it. */ - if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE)) + if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC, + BIN_LOG_HEADER_SIZE)) goto err; bytes_written += BIN_LOG_HEADER_SIZE; write_file_name_to_index_file=1; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d9ba97ad11a..b90ab1a4a3a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3833,7 +3833,7 @@ replicating a LOAD DATA INFILE command", "Max packetlength to send/receive from to server.", (gptr*) &global_system_variables.max_allowed_packet, (gptr*) &max_system_variables.max_allowed_packet, 0, GET_ULONG, - REQUIRED_ARG, 1024*1024L, 80, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, + REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE, "Can be used to restrict the total size used to cache a multi-transaction query.", (gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0, diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 13f786e0e75..8f0d659daf2 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -215,10 +215,12 @@ int net_flush(NET *net) *****************************************************************************/ /* -** Write a logical packet with packet header -** Format: Packet length (3 bytes), packet number(1 byte) -** When compression is used a 3 byte compression length is added -** NOTE: If compression is used the original package is modified! + Write a logical packet with packet header + Format: Packet length (3 bytes), packet number(1 byte) + When compression is used a 3 byte compression length is added + + NOTE + If compression is used the original package is modified! */ int @@ -315,8 +317,8 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) The cached buffer can be sent as it is with 'net_flush()'. In this code we have to be careful to not send a packet longer than - MAX_PACKET_LENGTH to net_real_write() if we are using the compressed protocol - as we store the length of the compressed packet in 3 bytes. + MAX_PACKET_LENGTH to net_real_write() if we are using the compressed + protocol as we store the length of the compressed packet in 3 bytes. RETURN 0 ok @@ -821,20 +823,23 @@ my_net_read(NET *net) { /* We are using the compressed protocol */ - ulong buf_length= net->buf_length; - ulong start_of_packet= net->buf_length - net->remain_in_buf; - ulong first_packet_offset=start_of_packet; + ulong buf_length; + ulong start_of_packet; + ulong first_packet_offset; uint read_length, multi_byte_packet=0; if (net->remain_in_buf) { + buf_length= net->buf_length; // Data left in old packet + first_packet_offset= start_of_packet= (net->buf_length - + net->remain_in_buf); /* Restore the character that was overwritten by the end 0 */ - net->buff[start_of_packet]=net->save_char; + net->buff[start_of_packet]= net->save_char; } else { /* reuse buffer, as there is nothing in it that we need */ - buf_length=start_of_packet=first_packet_offset=0; + buf_length= start_of_packet= first_packet_offset= 0; } for (;;) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7922af04ea8..560f5f5dc79 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7224,7 +7224,7 @@ update_tmptable_sum_func(Item_sum **func_ptr, { Item_sum *func; while ((func= *(func_ptr++))) - func->update_field(0); + func->update_field(); } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index bd7bc7027d3..34acd79f18b 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -31,9 +31,10 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) ORDER *order; List item_list; TABLE *table; - int describe=(lex->select_lex.options & SELECT_DESCRIBE) ? 1 : 0; int res; - bool found_rows_for_union= lex->select_lex.options & OPTION_FOUND_ROWS; + ulonglong add_rows= 0; + ulong found_rows_for_union= lex->select_lex.options & OPTION_FOUND_ROWS; + ulong describe= lex->select_lex.options & SELECT_DESCRIBE; TABLE_LIST result_table_list; TABLE_LIST *first_table=(TABLE_LIST *)lex->select_lex.table_list.first; TMP_TABLE_PARAM tmp_table_param; @@ -135,14 +136,44 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) union_result->tmp_table_param=&tmp_table_param; for (sl= &lex->select_lex; sl; sl=sl->next) { + ha_rows records_at_start; lex->select=sl; - thd->offset_limit=sl->offset_limit; - thd->select_limit=sl->select_limit+sl->offset_limit; + /* Don't use offset for the last union if there is no braces */ + if (sl != lex_sl) + { + thd->offset_limit= sl->offset_limit; + thd->select_limit=sl->select_limit+sl->offset_limit; + } + else + { + thd->offset_limit= 0; + /* + We can't use LIMIT at this stage if we are using ORDER BY for the + whole query + */ + thd->select_limit= HA_POS_ERROR; + if (! sl->order_list.first) + thd->select_limit= sl->select_limit+sl->offset_limit; + } if (thd->select_limit < sl->select_limit) thd->select_limit= HA_POS_ERROR; // no limit + + /* + When using braces, SQL_CALC_FOUND_ROWS affects the whole query. + We don't calculate found_rows() per union part + */ if (thd->select_limit == HA_POS_ERROR || sl->braces) sl->options&= ~OPTION_FOUND_ROWS; + else + { + /* + We are doing an union without braces. In this case + SQL_CALC_FOUND_ROWS should be done on all sub parts + */ + sl->options|= found_rows_for_union; + } + records_at_start= table->file->records; res=mysql_select(thd, (describe && sl->linkage==NOT_A_SELECT) ? first_table : (TABLE_LIST*) sl->table_list.first, sl->item_list, @@ -153,10 +184,23 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) sl->having, (ORDER*) NULL, sl->options | thd->options | SELECT_NO_UNLOCK | - ((describe) ? SELECT_DESCRIBE : 0), + describe, union_result); if (res) goto exit; + /* Needed for the following test and for records_at_start in next loop */ + table->file->info(HA_STATUS_VARIABLE); + if (found_rows_for_union & sl->options) + { + /* + This is a union without braces. Remember the number of rows that could + also have been part of the result set. + We get this from the difference of between total number of possible + rows and actual rows added to the temporary table. + */ + add_rows+= (ulonglong) (thd->limit_found_rows - (table->file->records - + records_at_start)); + } } if (union_result->flush()) { @@ -172,19 +216,14 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) /* Create a list of fields in the temporary table */ List_iterator it(item_list); Field **field; -#if 0 - List ftfunc_list; - ftfunc_list.empty(); -#else thd->lex.select_lex.ftfunc_list.empty(); -#endif for (field=table->field ; *field ; field++) { (void) it++; (void) it.replace(new Item_field(*field)); } - if (!thd->fatal_error) // Check if EOM + if (!thd->fatal_error) // Check if EOM { if (lex_sl) { @@ -209,8 +248,8 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) item_list, NULL, (describe) ? 0 : order, (ORDER*) NULL, NULL, (ORDER*) NULL, thd->options, result); - if (found_rows_for_union && !res) - thd->limit_found_rows = (ulonglong)table->file->records; + if (!res) + thd->limit_found_rows = (ulonglong)table->file->records + add_rows; } } From 23f0de086709bc3153472f69becb59877c214476 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Wed, 20 Aug 2003 17:16:07 +0300 Subject: [PATCH 77/87] Fixed problem with undefined assert symbol --- include/m_string.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index eae0e8f3f94..eac1552f8c1 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -125,9 +125,7 @@ extern void bmove_allign(gptr dst,const gptr src,uint len); DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \ bmove((byte*) key,(byte*) from,(size_t) length); #else -#define memcpy_overlap(A,B,C) \ -DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \ -memcpy((A), (B), (C)) +#define memcpy_overlap(A,B,C) memcpy((A), (B), (C)) #endif /* HAVE_purify */ From 1dd53ed073715f32f3ef992e59456140ec1ff1e4 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Wed, 20 Aug 2003 23:24:45 +0200 Subject: [PATCH 78/87] First commit for fixing BUG#1100 "LOAD DATA INFILE is badly filtered by binlog-*-db rules". There will probably be a second final one to merge Dmitri's changes to rpl_log.result and mine. 2 new tests: rpl_loaddata_rule_m : test of logging of LOAD DATA INFILE when the master has binlog-*-db rules, rpl_loaddata_rule_s : test of logging of LOAD DATA INFILE when the slave has binlog-*-db rules and --log-slave-updates. --- mysql-test/r/rpl_loaddata.result | 4 + mysql-test/r/rpl_loaddata_rule_m.result | 14 +++ mysql-test/r/rpl_loaddata_rule_s.result | 14 +++ mysql-test/t/rpl_loaddata.test | 17 +++ mysql-test/t/rpl_loaddata_rule_m-master.opt | 1 + mysql-test/t/rpl_loaddata_rule_m.test | 18 ++++ mysql-test/t/rpl_loaddata_rule_s-slave.opt | 1 + mysql-test/t/rpl_loaddata_rule_s.test | 20 ++++ sql/log.cc | 1 + sql/log_event.cc | 69 ++++++------- sql/log_event.h | 26 ++++- sql/slave.cc | 109 -------------------- sql/sql_load.cc | 4 +- sql/sql_repl.cc | 2 +- 14 files changed, 148 insertions(+), 152 deletions(-) create mode 100644 mysql-test/r/rpl_loaddata_rule_m.result create mode 100644 mysql-test/r/rpl_loaddata_rule_s.result create mode 100644 mysql-test/t/rpl_loaddata_rule_m-master.opt create mode 100644 mysql-test/t/rpl_loaddata_rule_m.test create mode 100644 mysql-test/t/rpl_loaddata_rule_s-slave.opt create mode 100644 mysql-test/t/rpl_loaddata_rule_s.test diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index 05bdad0fb84..b42f78f01bd 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; slave start; +reset master; 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)); @@ -19,6 +20,9 @@ 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 +show binlog events from 898; +Log_name Pos Event_type Server_id Orig_log_pos Info +slave-bin.001 898 Query 1 895 use test; insert into t3 select * from t2 drop table t1; drop table t2; drop table t3; diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result new file mode 100644 index 00000000000..8d8ed749c71 --- /dev/null +++ b/mysql-test/r/rpl_loaddata_rule_m.result @@ -0,0 +1,14 @@ +slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +slave start; +reset master; +create database test2; +create table t1(a int, b int, unique(b)); +use test2; +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +drop database test2; diff --git a/mysql-test/r/rpl_loaddata_rule_s.result b/mysql-test/r/rpl_loaddata_rule_s.result new file mode 100644 index 00000000000..a84368501a9 --- /dev/null +++ b/mysql-test/r/rpl_loaddata_rule_s.result @@ -0,0 +1,14 @@ +slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +slave start; +reset master; +create table t1(a int, b int, unique(b)); +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; +select count(*) from t1; +count(*) +2 +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index 0a07dd7549b..65e07aaa823 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -12,6 +12,10 @@ source include/master-slave.inc; +connection slave; +reset master; +connection master; + 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; @@ -27,6 +31,16 @@ sync_with_master; select * from t1; select * from t3; +# We want to be sure that LOAD DATA is in the slave's binlog. +# But we can't simply read this binlog, because the file_id is uncertain (would +# cause test failures). So instead, we test if the binlog looks long enough to +# contain LOAD DATA. That is, I (Guilhem) have done SHOW BINLOG EVENTS on my +# machine, saw that the last event is 'create table t3' and is at position 898 +# when things go fine. If LOAD DATA was not logged, the binlog would be shorter +# than 898 bytes and there would be an error in SHOW BINLOG EVENTS. Of course, +# if someone changes the content of '../../std_data/rpl_loaddata2.dat', 898 will +# have to be changed too. +show binlog events from 898; connection master; @@ -38,6 +52,9 @@ create table t1(a int, b int, unique(b)); save_master_pos; connection slave; sync_with_master; + +# See if slave stops when there's a duplicate entry for key error in LOAD DATA + insert into t1 values(1,10); connection master; diff --git a/mysql-test/t/rpl_loaddata_rule_m-master.opt b/mysql-test/t/rpl_loaddata_rule_m-master.opt new file mode 100644 index 00000000000..9d4a8f0b95e --- /dev/null +++ b/mysql-test/t/rpl_loaddata_rule_m-master.opt @@ -0,0 +1 @@ +--binlog_ignore_db=test diff --git a/mysql-test/t/rpl_loaddata_rule_m.test b/mysql-test/t/rpl_loaddata_rule_m.test new file mode 100644 index 00000000000..18f295f8ce2 --- /dev/null +++ b/mysql-test/t/rpl_loaddata_rule_m.test @@ -0,0 +1,18 @@ +# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules +# exist. +# This is for BUG#1100 (LOAD DATA INFILE was half-logged). + +source include/master-slave.inc; +connection slave; +reset master; + +# Test logging on master + +connection master; +# 'test' is the current database +create database test2; +create table t1(a int, b int, unique(b)); +use test2; +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; +show binlog events from 79; # should be nothing +drop database test2; diff --git a/mysql-test/t/rpl_loaddata_rule_s-slave.opt b/mysql-test/t/rpl_loaddata_rule_s-slave.opt new file mode 100644 index 00000000000..9d4a8f0b95e --- /dev/null +++ b/mysql-test/t/rpl_loaddata_rule_s-slave.opt @@ -0,0 +1 @@ +--binlog_ignore_db=test diff --git a/mysql-test/t/rpl_loaddata_rule_s.test b/mysql-test/t/rpl_loaddata_rule_s.test new file mode 100644 index 00000000000..1ea4f6825f5 --- /dev/null +++ b/mysql-test/t/rpl_loaddata_rule_s.test @@ -0,0 +1,20 @@ +# See if the slave logs (in its own binlog, with --log-slave-updates) a +# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules. +# This is for BUG#1100 (LOAD DATA INFILE was half-logged). + +source include/master-slave.inc; +connection slave; +reset master; + +connection master; +# 'test' is the current database +create table t1(a int, b int, unique(b)); +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; + +# Test logging on slave; + +save_master_pos; +connection slave; +sync_with_master; +select count(*) from t1; # check that LOAD was replicated +show binlog events from 79; # should be nothing diff --git a/sql/log.cc b/sql/log.cc index 4dce26d23ea..e03eec184b5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1067,6 +1067,7 @@ bool MYSQL_LOG::write(Log_event* event_info) #else IO_CACHE *file = &log_file; #endif + DBUG_PRINT("info",("event type=%d",event_info->get_type_code())); /* In the future we need to add to the following if tests like "do the involved tables match (to be implemented) diff --git a/sql/log_event.cc b/sql/log_event.cc index 2a1669737f8..407da85c38a 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1606,11 +1606,12 @@ void Create_file_log_event::pack_info(String* packet) #endif #ifndef MYSQL_CLIENT -Append_block_log_event::Append_block_log_event(THD* thd_arg, char* block_arg, +Append_block_log_event::Append_block_log_event(THD* thd_arg, const char* db_arg, + char* block_arg, uint block_len_arg, bool using_trans) :Log_event(thd_arg,0, using_trans), block(block_arg), - block_len(block_len_arg), file_id(thd_arg->file_id) + block_len(block_len_arg), file_id(thd_arg->file_id), db(db_arg) { } #endif @@ -1654,8 +1655,9 @@ void Append_block_log_event::pack_info(String* packet) net_store_data(packet, buf1); } -Delete_file_log_event::Delete_file_log_event(THD* thd_arg, bool using_trans) - :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id) +Delete_file_log_event::Delete_file_log_event(THD* thd_arg, const char* db_arg, + bool using_trans) + :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg) { } #endif @@ -1700,8 +1702,9 @@ void Delete_file_log_event::pack_info(String* packet) #ifndef MYSQL_CLIENT -Execute_load_log_event::Execute_load_log_event(THD* thd_arg, bool using_trans) - :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id) +Execute_load_log_event::Execute_load_log_event(THD* thd_arg, const char* db_arg, + bool using_trans) + :Log_event(thd_arg, 0, using_trans), file_id(thd_arg->file_id), db(db_arg) { } #endif @@ -1905,7 +1908,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, DBUG_ASSERT(thd->query == 0); thd->query = 0; // Should not be needed thd->query_error = 0; - + + /* + We test replicate_*_db rules. Note that we have already prepared the file to + load, even if we are going to ignore and delete it now. So it is possible + that we did a lot of disk writes for nothing. In other words, a big LOAD + DATA INFILE on the master will still consume a lot of space on the slave + (space in the relay log + space of temp files: twice the space of the file + to load...) even if it will finally be ignored. + TODO: fix this; this can be done by testing rules in + Create_file_log_event::exec_event() and then discarding Append_block and + al. Another way is do the filtering in the I/O thread (more efficient: no + disk writes at all). + */ if (db_ok(thd->db, replicate_do_db, replicate_ignore_db)) { thd->set_time((time_t)when); @@ -2210,7 +2225,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0, MYF(MY_WME|MY_NABP))) { - slave_print_error(rli,my_errno, "Could not open file '%s'", fname_buf); + slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf); goto err; } @@ -2221,7 +2236,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) if (write_base(&file)) { strmov(p, ".info"); // to have it right in the error message - slave_print_error(rli,my_errno, "Could not write to file '%s'", fname_buf); + slave_print_error(rli,my_errno, "Error in Create_file event: could not write to file '%s'", fname_buf); goto err; } end_io_cache(&file); @@ -2231,16 +2246,14 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, MYF(MY_WME))) < 0) { - slave_print_error(rli,my_errno, "Could not open file '%s'", fname_buf); + slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf); goto err; } if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP))) { - slave_print_error(rli,my_errno, "Write to '%s' failed", fname_buf); + slave_print_error(rli,my_errno, "Error in Create_file event: write to '%s' failed", fname_buf); goto err; } - if (mysql_bin_log.is_open()) - mysql_bin_log.write(this); error=0; // Everything is ok err: @@ -2259,8 +2272,6 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli) (void) my_delete(fname, MYF(MY_WME)); memcpy(p, ".info", 6); (void) my_delete(fname, MYF(MY_WME)); - if (mysql_bin_log.is_open()) - mysql_bin_log.write(this); return Log_event::exec_event(rli); } @@ -2274,16 +2285,14 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli) memcpy(p, ".data", 6); if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0) { - slave_print_error(rli,my_errno, "Could not open file '%s'", fname); + slave_print_error(rli,my_errno, "Error in Append_block event: could not open file '%s'", fname); goto err; } if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP))) { - slave_print_error(rli,my_errno, "Write to '%s' failed", fname); + slave_print_error(rli,my_errno, "Error in Append_block event: write to '%s' failed", fname); goto err; } - if (mysql_bin_log.is_open()) - mysql_bin_log.write(this); error=0; err: @@ -2298,7 +2307,6 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) char *p= slave_load_file_stem(fname, file_id, server_id); int fd; int error = 1; - ulong save_options; IO_CACHE file; Load_log_event* lev = 0; @@ -2307,7 +2315,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0, MYF(MY_WME|MY_NABP))) { - slave_print_error(rli,my_errno, "Could not open file '%s'", fname); + slave_print_error(rli,my_errno, "Error in Exec_load event: could not open file '%s'", fname); goto err; } if (!(lev = (Load_log_event*)Log_event::read_log_event(&file, @@ -2315,21 +2323,16 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) (bool)0)) || lev->get_type_code() != NEW_LOAD_EVENT) { - slave_print_error(rli,0, "File '%s' appears corrupted", fname); + slave_print_error(rli,0, "Error in Exec_load event: file '%s' appears corrupted", fname); goto err; } - /* - We want to disable binary logging in slave thread because we need the file - events to appear in the same order as they do on the master relative to - other events, so that we can preserve ascending order of log sequence - numbers - needed to handle failover . - */ - save_options = thd->options; - thd->options &= ~ (ulong) (OPTION_BIN_LOG); + lev->thd = thd; /* lev->exec_event should use rli only for errors - i.e. should not advance rli's position + i.e. should not advance rli's position. + lev->exec_event is the place where the table is loaded (it calls + mysql_load()). */ if (lev->exec_event(0,rli,1)) { @@ -2350,15 +2353,11 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) tmp, fname); my_free(tmp,MYF(0)); } - thd->options= save_options; goto err; } - thd->options = save_options; (void) my_delete(fname, MYF(MY_WME)); memcpy(p, ".data", 6); (void) my_delete(fname, MYF(MY_WME)); - if (mysql_bin_log.is_open()) - mysql_bin_log.write(this); error = 0; err: diff --git a/sql/log_event.h b/sql/log_event.h index 1031b940528..227c0243b9c 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -687,9 +687,20 @@ public: char* block; uint block_len; uint file_id; - + /* + 'db' is filled when the event is created in mysql_load() (the event needs to + have a 'db' member to be well filtered by binlog-*-db rules). 'db' is not + written to the binlog (it's not used by Append_block_log_event::write()), so + it can't be read in the Append_block_log_event(const char* buf, int + event_len) constructor. + In other words, 'db' is used only for filtering by binlog-*-db rules. + Create_file_log_event is different: its 'db' (which is inherited from + Load_log_event) is written to the binlog and can be re-read. + */ + const char* db; + #ifndef MYSQL_CLIENT - Append_block_log_event(THD* thd, char* block_arg, + Append_block_log_event(THD* thd, const char* db_arg, char* block_arg, uint block_len_arg, bool using_trans); int exec_event(struct st_relay_log_info* rli); void pack_info(String* packet); @@ -703,6 +714,7 @@ public: int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;} bool is_valid() { return block != 0; } int write_data(IO_CACHE* file); + const char* get_db() { return db; } }; @@ -710,9 +722,10 @@ class Delete_file_log_event: public Log_event { public: uint file_id; + const char* db; /* see comment in Append_block_log_event */ #ifndef MYSQL_CLIENT - Delete_file_log_event(THD* thd, bool using_trans); + Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans); void pack_info(String* packet); int exec_event(struct st_relay_log_info* rli); #else @@ -725,15 +738,17 @@ public: int get_data_size() { return DELETE_FILE_HEADER_LEN ;} bool is_valid() { return file_id != 0; } int write_data(IO_CACHE* file); + const char* get_db() { return db; } }; class Execute_load_log_event: public Log_event { public: uint file_id; - + const char* db; /* see comment in Append_block_log_event */ + #ifndef MYSQL_CLIENT - Execute_load_log_event(THD* thd, bool using_trans); + Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans); void pack_info(String* packet); int exec_event(struct st_relay_log_info* rli); #else @@ -746,6 +761,7 @@ public: int get_data_size() { return EXEC_LOAD_HEADER_LEN ;} bool is_valid() { return file_id != 0; } int write_data(IO_CACHE* file); + const char* get_db() { return db; } }; #ifdef MYSQL_CLIENT diff --git a/sql/slave.cc b/sql/slave.cc index 85a9bc0d49e..66a875b158f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -57,7 +57,6 @@ typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE; void skip_load_data_infile(NET* net); static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev); -static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev); static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli); static inline bool io_slave_killed(THD* thd,MASTER_INFO* mi); static inline bool sql_slave_killed(THD* thd,RELAY_LOG_INFO* rli); @@ -2730,102 +2729,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ } -static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) -{ - int error = 1; - ulong num_bytes; - bool cev_not_written; - THD* thd; - NET* net = &mi->mysql->net; - DBUG_ENTER("process_io_create_file"); - - if (unlikely(!cev->is_valid())) - DBUG_RETURN(1); - /* - TODO: fix to honor table rules, not only db rules - */ - if (!db_ok(cev->db, replicate_do_db, replicate_ignore_db)) - { - skip_load_data_infile(net); - DBUG_RETURN(0); - } - DBUG_ASSERT(cev->inited_from_old); - thd = mi->io_thd; - thd->file_id = cev->file_id = mi->file_id++; - thd->server_id = cev->server_id; - cev_not_written = 1; - - if (unlikely(net_request_file(net,cev->fname))) - { - sql_print_error("Slave I/O: failed requesting download of '%s'", - cev->fname); - goto err; - } - - /* - This dummy block is so we could instantiate Append_block_log_event - once and then modify it slightly instead of doing it multiple times - in the loop - */ - { - Append_block_log_event aev(thd,0,0,0); - - for (;;) - { - if (unlikely((num_bytes=my_net_read(net)) == packet_error)) - { - sql_print_error("Network read error downloading '%s' from master", - cev->fname); - goto err; - } - if (unlikely(!num_bytes)) /* eof */ - { - send_ok(net); /* 3.23 master wants it */ - Execute_load_log_event xev(thd,0); - xev.log_pos = mi->master_log_pos; - if (unlikely(mi->rli.relay_log.append(&xev))) - { - sql_print_error("Slave I/O: error writing Exec_load event to \ -relay log"); - goto err; - } - mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); - break; - } - if (unlikely(cev_not_written)) - { - cev->block = (char*)net->read_pos; - cev->block_len = num_bytes; - cev->log_pos = mi->master_log_pos; - if (unlikely(mi->rli.relay_log.append(cev))) - { - sql_print_error("Slave I/O: error writing Create_file event to \ -relay log"); - goto err; - } - cev_not_written=0; - mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); - } - else - { - aev.block = (char*)net->read_pos; - aev.block_len = num_bytes; - aev.log_pos = mi->master_log_pos; - if (unlikely(mi->rli.relay_log.append(&aev))) - { - sql_print_error("Slave I/O: error writing Append_block event to \ -relay log"); - goto err; - } - mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total) ; - } - } - } - error=0; -err: - DBUG_RETURN(error); -} - /* Start using a new binary log on the master @@ -2929,18 +2832,6 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, mi->ignore_stop_event=1; inc_pos= 0; break; - case CREATE_FILE_EVENT: - { - /* We come here when and only when tmp_buf != 0 */ - DBUG_ASSERT(tmp_buf); - int error = process_io_create_file(mi,(Create_file_log_event*)ev); - delete ev; - mi->master_log_pos += event_len; - DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); - pthread_mutex_unlock(&mi->data_lock); - my_free((char*)tmp_buf, MYF(0)); - DBUG_RETURN(error); - } default: mi->ignore_stop_event=0; inc_pos= event_len; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index ee573672c35..593cfb82b1c 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -299,7 +299,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, which is nonsense. */ read_info.end_io_cache(); - Delete_file_log_event d(thd, log_delayed); + Delete_file_log_event d(thd, db, log_delayed); mysql_bin_log.write(&d); } } @@ -331,7 +331,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, read_info.end_io_cache(); // make sure last block gets logged if (lf_info.wrote_create_file) { - Execute_load_log_event e(thd, log_delayed); + Execute_load_log_event e(thd, db, log_delayed); mysql_bin_log.write(&e); } } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index cdd0bca4a0e..5a42614dff4 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1216,7 +1216,7 @@ int log_loaded_block(IO_CACHE* file) lf_info->last_pos_in_file = file->pos_in_file; if (lf_info->wrote_create_file) { - Append_block_log_event a(lf_info->thd, buffer, block_len, + Append_block_log_event a(lf_info->thd, lf_info->db, buffer, block_len, lf_info->log_delayed); mysql_bin_log.write(&a); } From ec280a51cac48d8d25a1ad55125faf07c31542f5 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Thu, 21 Aug 2003 00:23:39 +0200 Subject: [PATCH 79/87] Result updates after Dmitri's and my changes to logging with --log-slave-updates. Since my changes, rpl_log.test, whose result file depends on file_id, became non-repeatable, i.e. file_id on slave in SHOW BINLOG EVENTS changed depending on the order of tests (sometimes 1, sometimes 5). Which is logical: as now the slave does not copy Create_file and Exec_load from the relay log (i.e from the master's binlog) to the slave's binlog, but instead lets mysql_load() do the logging, the file_id is now the one whic was used on the slave. Before it was the one which was used on the master, and by chance the master was always restarted for this test because there's a -master.opt file, so file_id on the master is always 1. But now file_id is from the slave so we need to restart the slave. That's why I add an (empty) -slave.opt file. I could have used 'server_stop/start slave', but this would have required the manager, so most of the time mysql-test-run silently skip the test which makes it useless. And I want this test to be run ! --- mysql-test/r/rpl_loaddata.result | 2 +- mysql-test/r/rpl_log.result | 2 +- mysql-test/t/rpl_log-slave.opt | 1 + mysql-test/t/rpl_log.test | 10 ++++++++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 mysql-test/t/rpl_log-slave.opt diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index b42f78f01bd..e93f8487c32 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -22,7 +22,7 @@ day id category name 2003-04-22 2416 a bbbbb show binlog events from 898; Log_name Pos Event_type Server_id Orig_log_pos Info -slave-bin.001 898 Query 1 895 use test; insert into t3 select * from t2 +slave-bin.001 898 Query 1 898 use test; insert into t3 select * from t2 drop table t1; drop table t2; drop table t3; diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index fbec0542e4b..26e465f9c3b 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -84,7 +84,7 @@ slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL) slave-bin.001 263 Query 1 263 use test; drop table t1 slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null) slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581 -slave-bin.001 1065 Exec_load 1 1056 ;file_id=1 +slave-bin.001 1065 Exec_load 1 1065 ;file_id=1 slave-bin.001 1088 Query 1 1088 use test; drop table t1 slave-bin.001 1136 Query 1 1136 use test; create table t5 (a int) slave-bin.001 1194 Query 1 1194 use test; drop table t5 diff --git a/mysql-test/t/rpl_log-slave.opt b/mysql-test/t/rpl_log-slave.opt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/mysql-test/t/rpl_log-slave.opt @@ -0,0 +1 @@ + diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test index ad962b585a1..e01b3e4e09c 100644 --- a/mysql-test/t/rpl_log.test +++ b/mysql-test/t/rpl_log.test @@ -5,6 +5,16 @@ connection slave; slave stop; reset master; reset slave; +# We are going to read the slave's binlog which contains file_id (for some LOAD +# DATA INFILE); to make it repeatable (not influenced by other tests), we need +# to stop and start the slave, to be sure file_id will start from 1. +# This can be done with 'server_stop slave', but +# this would require the manager, so most of the time the test will be skipped +# :( +# To workaround this, I (Guilhem) add a (empty) rpl_log-slave.opt (because when +# mysql-test-run finds such a file it restarts the slave before doing the +# test). That's not very elegant but I could find no better way, sorry. + let $VERSION=`select version()`; connection master; From 165dc895b3f90b96c67e7a72417d7c9dfd81238a Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Thu, 21 Aug 2003 10:24:37 +0200 Subject: [PATCH 80/87] Yesterday I removed process_io_create_file; I shouldn't have. Let's say the lack of comments did not help me ;) Copying it back again and adding comments; now 3.23->4.0 replication of LOAD DATA INFILE works again. --- sql/slave.cc | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/sql/slave.cc b/sql/slave.cc index 9b5066f5804..32ed228e119 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -57,6 +57,7 @@ typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE; void skip_load_data_infile(NET* net); static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev); +static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev); static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli); static inline bool io_slave_killed(THD* thd,MASTER_INFO* mi); static inline bool sql_slave_killed(THD* thd,RELAY_LOG_INFO* rli); @@ -2728,6 +2729,102 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ } +static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) +{ + int error = 1; + ulong num_bytes; + bool cev_not_written; + THD* thd; + NET* net = &mi->mysql->net; + DBUG_ENTER("process_io_create_file"); + + if (unlikely(!cev->is_valid())) + DBUG_RETURN(1); + /* + TODO: fix to honor table rules, not only db rules + */ + if (!db_ok(cev->db, replicate_do_db, replicate_ignore_db)) + { + skip_load_data_infile(net); + DBUG_RETURN(0); + } + DBUG_ASSERT(cev->inited_from_old); + thd = mi->io_thd; + thd->file_id = cev->file_id = mi->file_id++; + thd->server_id = cev->server_id; + cev_not_written = 1; + + if (unlikely(net_request_file(net,cev->fname))) + { + sql_print_error("Slave I/O: failed requesting download of '%s'", + cev->fname); + goto err; + } + + /* + This dummy block is so we could instantiate Append_block_log_event + once and then modify it slightly instead of doing it multiple times + in the loop + */ + { + Append_block_log_event aev(thd,0,0,0,0); + + for (;;) + { + if (unlikely((num_bytes=my_net_read(net)) == packet_error)) + { + sql_print_error("Network read error downloading '%s' from master", + cev->fname); + goto err; + } + if (unlikely(!num_bytes)) /* eof */ + { + send_ok(net); /* 3.23 master wants it */ + Execute_load_log_event xev(thd,0,0); + xev.log_pos = mi->master_log_pos; + if (unlikely(mi->rli.relay_log.append(&xev))) + { + sql_print_error("Slave I/O: error writing Exec_load event to \ +relay log"); + goto err; + } + mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); + break; + } + if (unlikely(cev_not_written)) + { + cev->block = (char*)net->read_pos; + cev->block_len = num_bytes; + cev->log_pos = mi->master_log_pos; + if (unlikely(mi->rli.relay_log.append(cev))) + { + sql_print_error("Slave I/O: error writing Create_file event to \ +relay log"); + goto err; + } + cev_not_written=0; + mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); + } + else + { + aev.block = (char*)net->read_pos; + aev.block_len = num_bytes; + aev.log_pos = mi->master_log_pos; + if (unlikely(mi->rli.relay_log.append(&aev))) + { + sql_print_error("Slave I/O: error writing Append_block event to \ +relay log"); + goto err; + } + mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total) ; + } + } + } + error=0; +err: + DBUG_RETURN(error); +} + /* Start using a new binary log on the master @@ -2803,6 +2900,12 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, tmp_buf[event_len]=0; // Create_file constructor wants null-term buffer buf = (const char*)tmp_buf; } + /* + This will transform LOAD_EVENT into CREATE_FILE_EVENT, ask the master to + send the loaded file, and write it to the relay log in the form of + Append_block/Exec_load (the SQL thread needs the data, as that thread is not + connected to the master). + */ Log_event *ev = Log_event::read_log_event(buf,event_len, &errmsg, 1 /*old format*/ ); if (unlikely(!ev)) @@ -2831,6 +2934,24 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, mi->ignore_stop_event=1; inc_pos= 0; break; + case CREATE_FILE_EVENT: + /* + Yes it's possible to have CREATE_FILE_EVENT here, even if we're in + queue_old_event() which is for 3.23 events which don't comprise + CREATE_FILE_EVENT. This is because read_log_event() above has just + transformed LOAD_EVENT into CREATE_FILE_EVENT. + */ + { + /* We come here when and only when tmp_buf != 0 */ + DBUG_ASSERT(tmp_buf); + int error = process_io_create_file(mi,(Create_file_log_event*)ev); + delete ev; + mi->master_log_pos += event_len; + DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); + pthread_mutex_unlock(&mi->data_lock); + my_free((char*)tmp_buf, MYF(0)); + DBUG_RETURN(error); + } default: mi->ignore_stop_event=0; inc_pos= event_len; From a72587ffb0f6da3e7a774bb3286207001ff08b54 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 21 Aug 2003 10:44:17 +0200 Subject: [PATCH 81/87] sorted --- sql/set_var.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index 6dc36e312cb..8c0859fbca4 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -530,15 +530,15 @@ struct show_var_st init_vars[]= { {"log_error", (char*) log_error_file, SHOW_CHAR}, {"port", (char*) &mysql_port, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, - {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, - {sys_readonly.name, (char*) &sys_readonly, SHOW_SYS}, - {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, - {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, #ifdef HAVE_QUERY_CACHE {sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS}, {sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS}, {sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS}, #endif /* HAVE_QUERY_CACHE */ + {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, + {sys_readonly.name, (char*) &sys_readonly, SHOW_SYS}, + {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, + {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, {sys_server_id.name, (char*) &sys_server_id, SHOW_SYS}, {sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS}, {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL}, From cba9cbddfcea237ee158b28dee01666fbb216d8c Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Thu, 21 Aug 2003 12:15:22 +0200 Subject: [PATCH 82/87] - added missing option "--without-embedded" to be able to compile without the embedded server (it was missing in the previous push) --- Build-tools/Do-compile | 1 + 1 file changed, 1 insertion(+) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 6cf577162ed..e5783dbf515 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -51,6 +51,7 @@ GetOptions( "with-low-memory", "with-other-libc=s", "with-small-disk", + "without-embedded", ) || usage(); usage() if ($opt_help); From 3d41d57765a375a5123de0359e327e912b26fdef Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 21 Aug 2003 20:13:26 +0200 Subject: [PATCH 83/87] crash BUG#1116 fixed --- strings/ctype-tis620.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 885d4406cd6..edadadf3a43 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -49,7 +49,7 @@ #include "m_ctype.h" #include "t_ctype.h" -static uchar* thai2sortable(const uchar *tstr,uint len); +static uchar* thai2sortable(const uchar *tstr,int len); #define BUFFER_MULTIPLY 4 #define buffsize(s) (BUFFER_MULTIPLY * (strlen(s) + 1)) @@ -456,7 +456,7 @@ uchar NEAR sort_order_tis620[]= /* NOTE: isn't it faster to alloc buffer in calling function? */ -static uchar* thai2sortable(const uchar * tstr,uint len) +static uchar* thai2sortable(const uchar * tstr,int len) { /* We use only 3 levels (neglect capitalization). */ @@ -467,16 +467,16 @@ static uchar* thai2sortable(const uchar * tstr,uint len) uint bufSize; uint RightSize; - len= (uint) strnlen((char*) tstr,len); + len= (int) strnlen((char*) tstr,len); bufSize= (uint) buffsize((char*) tstr); RightSize= sizeof(uchar) * (len + 1); - if (!(outBuf= pLeft1= pRight1= + if (!(outBuf= pLeft1= pRight1= (uchar *)malloc(sizeof(uchar) * bufSize + RightSize*2))) return (uchar*) tstr; pLeft2= pRight2= pRight1 + sizeof(uchar) * bufSize; pLeft3= pRight3= pRight2 + RightSize; - while (--len) + while (--len > 0) { int *t_ctype0= t_ctype[p[0]]; if (isldvowel(*p) && isconsnt(p[1])) @@ -567,8 +567,8 @@ int my_strcoll_tis620(const uchar * s1, const uchar * s2) { uchar *tc1, *tc2; int i; - tc1= thai2sortable(s1, (uint) strlen((char*)s1)); - tc2= thai2sortable(s2, (uint) strlen((char*)s2)); + tc1= thai2sortable(s1, (int) strlen((char*)s1)); + tc2= thai2sortable(s2, (int) strlen((char*)s2)); i= strcmp((char*)tc1, (char*)tc2); free(tc1); free(tc2); From 5bc4965d70c0a0340c8ab34deabe4b9ca4dd6ae6 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 21 Aug 2003 20:21:07 +0200 Subject: [PATCH 84/87] fix for SHOW CREATE TABLE to report corerct second field's length --- sql/item.cc | 5 ++++ sql/sql_show.cc | 70 ++++++++++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index a2d9f0b2575..a09aa9962bc 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -355,6 +355,11 @@ void Item_string::make_field(Send_field *tmp_field) init_make_field(tmp_field,FIELD_TYPE_STRING); } +void Item_empty_string::make_field(Send_field *tmp_field) +{ + init_make_field(tmp_field,FIELD_TYPE_VAR_STRING); +} + void Item_datetime::make_field(Send_field *tmp_field) { init_make_field(tmp_field,FIELD_TYPE_DATETIME); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index dc81510051b..6acdb1cc72b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -564,49 +564,47 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) DBUG_RETURN(1); } + String packet; + packet.length(0); + net_store_data(&packet, table->table_name); + /* + A hack - we need to reserve some space for the length before + we know what it is - let's assume that the length of create table + statement will fit into 3 bytes ( 16 MB max :-) ) + */ + ulong store_len_offset = packet.length(); + packet.length(store_len_offset + 4); + if (store_create_info(thd, table, &packet)) + DBUG_RETURN(-1); + ulong create_len = packet.length() - store_len_offset - 4; + if (create_len > 0x00ffffff) // better readable in HEX ... + { + /* + Just in case somebody manages to create a table + with *that* much stuff in the definition + */ + DBUG_RETURN(1); + } + + /* + Now we have to store the length in three bytes, even if it would fit + into fewer bytes, so we cannot use net_store_data() anymore, + and do it ourselves + */ + char* p = (char*)packet.ptr() + store_len_offset; + *p++ = (char) 253; // The client the length is stored using 3-bytes + int3store(p, create_len); + List field_list; field_list.push_back(new Item_empty_string("Table",NAME_LEN)); - field_list.push_back(new Item_empty_string("Create Table",1024)); + field_list.push_back(new Item_empty_string("Create Table",packet.length())); if (send_fields(thd,field_list,1)) DBUG_RETURN(1); - String *packet = &thd->packet; - { - packet->length(0); - net_store_data(packet, table->table_name); - /* - A hack - we need to reserve some space for the length before - we know what it is - let's assume that the length of create table - statement will fit into 3 bytes ( 16 MB max :-) ) - */ - ulong store_len_offset = packet->length(); - packet->length(store_len_offset + 4); - if (store_create_info(thd, table, packet)) - DBUG_RETURN(-1); - ulong create_len = packet->length() - store_len_offset - 4; - if (create_len > 0x00ffffff) // better readable in HEX ... - { - /* - Just in case somebody manages to create a table - with *that* much stuff in the definition - */ - DBUG_RETURN(1); - } + if (my_net_write(&thd->net, (char*)packet.ptr(), packet.length())) + DBUG_RETURN(1); - /* - Now we have to store the length in three bytes, even if it would fit - into fewer bytes, so we cannot use net_store_data() anymore, - and do it ourselves - */ - char* p = (char*)packet->ptr() + store_len_offset; - *p++ = (char) 253; // The client the length is stored using 3-bytes - int3store(p, create_len); - - // now we are in business :-) - if (my_net_write(&thd->net, (char*)packet->ptr(), packet->length())) - DBUG_RETURN(1); - } send_eof(&thd->net); DBUG_RETURN(0); } From 7f1ffcc453a47d9ccc344498db4556a09a7cdb6e Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Thu, 21 Aug 2003 21:14:02 +0200 Subject: [PATCH 85/87] Bug #1064: SHOW CREATE TABLE: avoid allocations for simple tables, old client compatibility --- sql/item.h | 1 + sql/sql_show.cc | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/item.h b/sql/item.h index 3cf5a17805c..d9d125b8bd4 100644 --- a/sql/item.h +++ b/sql/item.h @@ -275,6 +275,7 @@ class Item_empty_string :public Item_string public: Item_empty_string(const char *header,uint length) :Item_string("",0) { name=(char*) header; max_length=length;} + void make_field(Send_field *field); }; class Item_varbinary :public Item diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 6acdb1cc72b..f2d6dd8e058 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -564,7 +564,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) DBUG_RETURN(1); } - String packet; + char buff[1024]; + String packet(buff,sizeof(buff)); packet.length(0); net_store_data(&packet, table->table_name); /* @@ -597,7 +598,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) List field_list; field_list.push_back(new Item_empty_string("Table",NAME_LEN)); - field_list.push_back(new Item_empty_string("Create Table",packet.length())); + field_list.push_back(new Item_empty_string("Create Table", + max(packet.length(),1024))); // 1024 is for not to confuse old clients if (send_fields(thd,field_list,1)) DBUG_RETURN(1); From efa85aad49be43ef3cdf8f631b43e9a87d0189b4 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Fri, 22 Aug 2003 04:07:40 +0300 Subject: [PATCH 86/87] Move test that uses many tables (in query_cache.test) to separate test so that we can get it 'skipped' instead of 'failed' on system where we can't open many files. --- client/mysqltest.c | 29 ++++++++++++++++---- libmysql/errmsg.c | 36 ++++++++++++------------ libmysql/libmysql.c | 7 +++++ mysql-test/include/check_var_limit.inc | 9 ++++++ mysql-test/mysql-test-run.sh | 8 +++++- mysql-test/r/check_var_limit.require | 2 ++ mysql-test/r/loaddata.result | 10 +++++++ mysql-test/r/query_cache.result | 20 +------------- mysql-test/r/query_cache_merge.result | 20 ++++++++++++++ mysql-test/r/select_safe.result | 4 +-- mysql-test/std_data/loaddata2.dat | 5 ++++ mysql-test/t/loaddata.test | 7 +++-- mysql-test/t/query_cache.test | 24 +--------------- mysql-test/t/query_cache_merge.test | 38 ++++++++++++++++++++++++++ mysql-test/t/select_safe.test | 4 +-- sql/field.cc | 9 +++++- sql/mysqld.cc | 16 +++++++++++ sql/sql_load.cc | 8 ++++-- 18 files changed, 180 insertions(+), 76 deletions(-) create mode 100644 mysql-test/include/check_var_limit.inc create mode 100644 mysql-test/r/check_var_limit.require create mode 100644 mysql-test/r/query_cache_merge.result create mode 100644 mysql-test/std_data/loaddata2.dat create mode 100644 mysql-test/t/query_cache_merge.test diff --git a/client/mysqltest.c b/client/mysqltest.c index f5afa0fa0df..7a5712cc597 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -42,7 +42,7 @@ **********************************************************************/ -#define MTEST_VERSION "1.27" +#define MTEST_VERSION "1.28" #include #include @@ -845,7 +845,28 @@ int var_query_set(VAR* v, const char* p, const char** p_end) } if ((row = mysql_fetch_row(res)) && row[0]) - eval_expr(v, row[0], 0); + { + /* + Concatenate all row results with tab in between to allow us to work + with results from many columns (for example from SHOW VARIABLES) + */ + DYNAMIC_STRING result; + uint i; + ulong *lengths; + char *end; + + init_dynamic_string(&result, "", 16384, 65536); + lengths= mysql_fetch_lengths(res); + for (i=0; i < mysql_num_fields(res); i++) + { + if (row[0]) + dynstr_append_mem(&result, row[i], lengths[i]); + dynstr_append_mem(&result, "\t", 1); + } + end= result.str + result.length-1; + eval_expr(v, result.str, (const char**) &end); + dynstr_free(&result); + } else eval_expr(v, "", 0); @@ -902,8 +923,6 @@ int eval_expr(VAR* v, const char* p, const char** p_end) return 0; } - if (p_end) - *p_end = 0; die("Invalid expr: %s", p); return 1; } @@ -1197,7 +1216,7 @@ static char *get_string(char **to_ptr, char **from_ptr, VAR *var=var_get(start, &end, 0, 1); if (var && to == (char*) end+1) { - DBUG_PRINT("info",("var: %s -> %s", start, var->str_val)); + DBUG_PRINT("info",("var: '%s' -> '%s'", start, var->str_val)); DBUG_RETURN(var->str_val); /* return found variable value */ } } diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c index 375ca7329c0..7accbf8f1d2 100644 --- a/libmysql/errmsg.c +++ b/libmysql/errmsg.c @@ -26,24 +26,24 @@ const char *client_errors[]= { "Unbekannter MySQL Fehler", "Kann UNIX-Socket nicht anlegen (%d)", - "Keine Verbindung zu lokalem MySQL Server, socket: '%-.64s' (%d)", - "Keine Verbindung zu MySQL Server auf %-.64s (%d)", + "Keine Verbindung zu lokalem MySQL Server, socket: '%-.100s' (%d)", + "Keine Verbindung zu MySQL Server auf %-.100s (%d)", "Kann TCP/IP-Socket nicht anlegen (%d)", - "Unbekannter MySQL Server Host (%-.64s) (%d)", + "Unbekannter MySQL Server Host (%-.100s) (%d)", "MySQL Server nicht vorhanden", "Protokolle ungleich. Server Version = % d Client Version = %d", "MySQL client got out of memory", "Wrong host info", "Localhost via UNIX socket", - "%-.64s via TCP/IP", + "%-.100s via TCP/IP", "Error in server handshake", "Lost connection to MySQL server during query", "Commands out of sync; You can't run this command now", - "Verbindung ueber Named Pipe; Host: %-.64s", + "Verbindung ueber Named Pipe; Host: %-.100s", "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)", "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)", "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)", - "Can't initialize character set %-.64s (path: %-.64s)", + "Can't initialize character set %-.32s (path: %-.100s)", "Got packet bigger than 'max_allowed_packet'", "Embedded server", "Error on SHOW SLAVE STATUS:", @@ -61,24 +61,24 @@ const char *client_errors[]= { "Erro desconhecido do MySQL", "Não pode criar 'UNIX socket' (%d)", - "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.64s' (%d)", - "Não pode se conectar ao servidor MySQL em '%-.64s' (%d)", + "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.100s' (%d)", + "Não pode se conectar ao servidor MySQL em '%-.100s' (%d)", "Não pode criar 'socket TCP/IP' (%d)", - "'Host' servidor MySQL '%-.64s' (%d) desconhecido", + "'Host' servidor MySQL '%-.100s' (%d) desconhecido", "Servidor MySQL desapareceu", "Incompatibilidade de protocolos. Versão do Servidor: %d - Versão do Cliente: %d", "Cliente do MySQL com falta de memória", "Informação inválida de 'host'", "Localhost via 'UNIX socket'", - "%-.64s via 'TCP/IP'", + "%-.100s via 'TCP/IP'", "Erro na negociação de acesso ao servidor", "Conexão perdida com servidor MySQL durante 'query'", "Comandos fora de sincronismo. Você não pode executar este comando agora", - "%-.64s via 'named pipe'", + "%-.100s via 'named pipe'", "Não pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", "Não pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", "Não pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", - "Não pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)", + "Não pode inicializar conjunto de caracteres %-.32s (caminho %-.100s)", "Obteve pacote maior do que 'max_allowed_packet'", "Embedded server" "Error on SHOW SLAVE STATUS:", @@ -94,24 +94,24 @@ const char *client_errors[]= { "Unknown MySQL error", "Can't create UNIX socket (%d)", - "Can't connect to local MySQL server through socket '%-.64s' (%d)", - "Can't connect to MySQL server on '%-.64s' (%d)", + "Can't connect to local MySQL server through socket '%-.100s' (%d)", + "Can't connect to MySQL server on '%-.100s' (%d)", "Can't create TCP/IP socket (%d)", - "Unknown MySQL Server Host '%-.64s' (%d)", + "Unknown MySQL Server Host '%-.100s' (%d)", "MySQL server has gone away", "Protocol mismatch. Server Version = %d Client Version = %d", "MySQL client run out of memory", "Wrong host info", "Localhost via UNIX socket", - "%-.64s via TCP/IP", + "%-.100s via TCP/IP", "Error in server handshake", "Lost connection to MySQL server during query", "Commands out of sync; You can't run this command now", - "%-.64s via named pipe", + "%-.100s via named pipe", "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)", - "Can't initialize character set %-.64s (path: %-.64s)", + "Can't initialize character set %-.32s (path: %-.100s)", "Got packet bigger than 'max_allowed_packet'", "Embedded server", "Error on SHOW SLAVE STATUS:", diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index aa169335dfb..9e32e60f7da 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -110,9 +110,16 @@ void STDCALL mysql_server_end() { /* If library called my_init(), free memory allocated by it */ if (!org_my_init_done) + { my_end(0); +#ifndef THREAD + /* Remove TRACING, if enabled by mysql_debug() */ + DBUG_POP(); +#endif + } else mysql_thread_end(); + mysql_client_init= org_my_init_done= 0; } my_bool STDCALL mysql_thread_init() diff --git a/mysql-test/include/check_var_limit.inc b/mysql-test/include/check_var_limit.inc new file mode 100644 index 00000000000..5f26e2b99a9 --- /dev/null +++ b/mysql-test/include/check_var_limit.inc @@ -0,0 +1,9 @@ +# +# Check that second part of $LIMIT is between $MIN_LIMIT and $MAX_LIMIT +# This is useful to check that a variable from SHOW_VARIABLES is within +# certain limits. Check query_cache_merge.test for an example of using this. +# +-- require r/check_var_limit.require +disable_query_log; +eval select SUBSTRING_INDEX($LIMIT, "\t", 2) BETWEEN $MIN_LIMIT AND $MAX_LIMIT as "limit"; +enable_query_log; diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index bf5546483d3..1d1293f81d2 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -16,6 +16,9 @@ USE_MANAGER=0 MY_TZ=GMT-3 TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work +# For query_cache test +ulimit -n 1024 + #++ # Program Definitions #-- @@ -829,7 +832,6 @@ start_master() /bin/sh $master_init_script fi cd $BASEDIR # for gcov - #start master if [ -z "$DO_BENCH" ] then master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ @@ -848,6 +850,7 @@ start_master() --tmpdir=$MYSQL_TMP_DIR \ --language=$LANGUAGE \ --innodb_data_file_path=ibdata1:50M \ + --open-files-limit=1024 \ $MASTER_40_ARGS \ $SMALL_SERVER \ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" @@ -1363,6 +1366,9 @@ fi $ECHO "Starting Tests" +# +# This can probably be deleted +# if [ "$DO_BENCH" = 1 ] then BENCHDIR=$BASEDIR/sql-bench/ diff --git a/mysql-test/r/check_var_limit.require b/mysql-test/r/check_var_limit.require new file mode 100644 index 00000000000..01a59782180 --- /dev/null +++ b/mysql-test/r/check_var_limit.require @@ -0,0 +1,2 @@ +limit +1 diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 59153f3353a..0b7925de1c5 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -16,3 +16,13 @@ NULL NULL 0000-00-00 0000-00-00 NULL 0000-00-00 0000-00-00 0000-00-00 NULL 2003-03-03 2003-03-03 NULL drop table t1; +create table t1 (a text, b text); +load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; +select concat('|',a,'|'), concat('|',b,'|') from t1; +concat('|',a,'|') concat('|',b,'|') +|Field A| |Field B| +|Field 1| |Field 2' +Field 3,'Field 4| +|Field 5' ,'Field 6| NULL +|Field 6| | 'Field 7'| +drop table t1; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 48df3b4b563..0b86c79afbf 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2,7 +2,7 @@ flush query cache; flush query cache; reset query cache; flush status; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00,mysqltest.t1; +drop table if exists t1,t2,t3; drop database if exists mysqltest; create table t1 (a int not null); insert into t1 values (1),(2),(3); @@ -640,21 +640,3 @@ Variable_name Value Qcache_queries_in_cache 2 SET OPTION SQL_SELECT_LIMIT=DEFAULT; drop table t1; -flush status; -select count(*) from t00; -count(*) -514 -select count(*) from t00; -count(*) -514 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 1 -delete from t256; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00; diff --git a/mysql-test/r/query_cache_merge.result b/mysql-test/r/query_cache_merge.result new file mode 100644 index 00000000000..c6df4266de2 --- /dev/null +++ b/mysql-test/r/query_cache_merge.result @@ -0,0 +1,20 @@ +SET @@global.query_cache_size=1355776; +flush status; +select count(*) from t00; +count(*) +514 +select count(*) from t00; +count(*) +514 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +delete from t256; +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 0 +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00; +SET @@global.query_cache_size=0; diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result index ca5c03bdb50..c4e5984d360 100644 --- a/mysql-test/r/select_safe.result +++ b/mysql-test/r/select_safe.result @@ -67,12 +67,12 @@ analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"); -explain select * from t1,t1 as t2 where t1.b=t2.b; +explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; table type possible_keys key key_len ref rows Extra t1 ALL b NULL NULL NULL 21 t2 ALL b NULL NULL NULL 16 Using where set MAX_SEEKS_FOR_KEY=1; -explain select * from t1,t1 as t2 where t1.b=t2.b; +explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; table type possible_keys key key_len ref rows Extra t1 ALL b NULL NULL NULL 21 t2 ref b b 21 t1.b 6 Using where diff --git a/mysql-test/std_data/loaddata2.dat b/mysql-test/std_data/loaddata2.dat new file mode 100644 index 00000000000..6e9d6745b8d --- /dev/null +++ b/mysql-test/std_data/loaddata2.dat @@ -0,0 +1,5 @@ +Field A,'Field B' +Field 1,'Field 2' +Field 3,'Field 4' +'Field 5' ,'Field 6' +Field 6, 'Field 7' diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index e63f0780e3e..732ed248702 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -14,6 +14,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated SELECT * from t1; drop table t1; - - - +create table t1 (a text, b text); +load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; +select concat('|',a,'|'), concat('|',b,'|') from t1; +drop table t1; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index f72a4a504a0..9e1c22ac642 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -10,7 +10,7 @@ flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush status; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00,mysqltest.t1; +drop table if exists t1,t2,t3; drop database if exists mysqltest; # @@ -450,25 +450,3 @@ select * from t1; show status like "Qcache_queries_in_cache"; SET OPTION SQL_SELECT_LIMIT=DEFAULT; drop table t1; - -# -# more then 255 (257) merged tables test -# -flush status; -disable_query_log; -let $1 = 257; -while ($1) -{ - eval create table t$1(a int); - eval insert into t$1 values (1),(2); - dec $1; -} -create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; -enable_query_log; -select count(*) from t00; -select count(*) from t00; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -delete from t256; -show status like "Qcache_queries_in_cache"; -drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00; diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test new file mode 100644 index 00000000000..9d9e311af06 --- /dev/null +++ b/mysql-test/t/query_cache_merge.test @@ -0,0 +1,38 @@ +# Test query cache with many tables + +--source include/have_query_cache.inc +let $LIMIT=`SHOW VARIABLES LIKE 'open_files_limit'`; +let $MIN_LIMIT=100 +let $MAX_LIMIT=65536 +--source include/check_var_limit.inc + +SET @@global.query_cache_size=1355776; + +# +# more then 255 (257) merged tables test +# + +flush status; +disable_query_log; +--disable_warnings +let $1 = 257; +while ($1) +{ + eval drop table if exists t$1; + eval create table t$1(a int); + eval insert into t$1 values (1),(2); + dec $1; +} +--enable_warnings + +create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; +enable_query_log; +select count(*) from t00; +select count(*) from t00; +show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +delete from t256; +show status like "Qcache_queries_in_cache"; +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00; + +SET @@global.query_cache_size=0; diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test index 206f911d028..904479635c2 100644 --- a/mysql-test/t/select_safe.test +++ b/mysql-test/t/select_safe.test @@ -56,9 +56,9 @@ SELECT * from t1; SELECT @@MAX_SEEKS_FOR_KEY; analyze table t1; insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"); -explain select * from t1,t1 as t2 where t1.b=t2.b; +explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; set MAX_SEEKS_FOR_KEY=1; -explain select * from t1,t1 as t2 where t1.b=t2.b; +explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; SET MAX_SEEKS_FOR_KEY=DEFAULT; drop table t1; diff --git a/sql/field.cc b/sql/field.cc index 592252bb294..43481ca0963 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1836,9 +1836,16 @@ double Field_longlong::val_real(void) else #endif longlongget(j,ptr); - return unsigned_flag ? ulonglong2double((ulonglong) j) : (double) j; + /* The following is open coded to avoid a bug in gcc 3.3 */ + if (unsigned_flag) + { + ulonglong tmp= (ulonglong) j; + return ulonglong2double(tmp); + } + return (double) j; } + longlong Field_longlong::val_int(void) { longlong j; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b90ab1a4a3a..ae5b46671a5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2158,7 +2158,10 @@ int main(int argc, char **argv) max_connections,table_cache_size)); sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size); } + open_files_limit= files; } +#else + open_files_limit= 0; /* Can't set or detect limit */ #endif unireg_init(opt_specialflag); /* Set up extern variabels */ init_errmessage(); /* Read error messages from file */ @@ -4903,6 +4906,19 @@ static void fix_paths(void) } +/* + set how many open files we want to be able to handle + + SYNOPSIS + set_maximum_open_files() + max_file_limit Files to open + + NOTES + The request may not fulfilled becasue of system limitations + + RETURN + Files available to open +*/ #ifdef SET_RLIMIT_NOFILE static uint set_maximum_open_files(uint max_file_limit) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index ee573672c35..4911b1a6b75 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -767,9 +767,13 @@ int READ_INFO::read_field() row_end= to; return 0; } - /* Copy the found '"' character */ + /* + The string didn't terminate yet. + Store back next character for the loop + */ PUSH(chr); - chr='"'; + /* copy the found term character to 'to' */ + chr= found_enclosed_char; } else if (chr == field_term_char && found_enclosed_char == INT_MAX) { From 759a3c1e3c1679056f834d2033daef2322f7a50a Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Fri, 22 Aug 2003 15:39:24 +0200 Subject: [PATCH 87/87] 2 minor edits, plus fix for BUG#1113 "INSERT into non-trans table SELECT ; ROLLBACK" does not send warning" and fix for BUG#873 "In transaction, INSERT to non-trans table is written too early to binlog". Now we don't always write the non-trans update immediately to the binlog; if there is something in the binlog cache we write it to the binlog cache (because the non-trans update could depend on a trans table which was modified earlier in the transaction); then in case of ROLLBACK, we write the binlog cache to the binlog, wrapped with BEGIN/ROLLBACK. This guarantees that the slave does the same updates. For ROLLBACK TO SAVEPOINT: when we execute a SAVEPOINT command we write it to the binlog cache. At ROLLBACK TO SAVEPOINT, if some non-trans table was updated, we write ROLLBACK TO SAVEPOINT to the binlog cache; when the transaction terminates (COMMIT/ROLLBACK), the binlog cache will be flushed to the binlog (because of the non-trans update) so we'll have SAVEPOINT and ROLLBACK TO SAVEPOINT in the binlog. Apart from this rare case of updates of mixed table types in transaction, the usual way is still clear the binlog cache at ROLLBACK, or chop it at ROLLBACK TO SAVEPOINT (meaning the SAVEPOINT command is also chopped, which is fine). Note that BUG#873 encompasses subbugs 1) and 2) of BUG#333 "3 binlogging bugs when doing INSERT with mixed InnoDB/MyISAM". --- client/mysqldump.c | 5 +- mysql-test/r/mix_innodb_myisam_binlog.result | 180 +++++++++++++++++++ mysql-test/r/rpl_loaddata.result | 6 +- mysql-test/t/mix_innodb_myisam_binlog.test | 175 ++++++++++++++++++ mysql-test/t/rpl_loaddata.test | 14 +- sql/handler.cc | 69 ++++++- sql/log.cc | 31 +++- sql/log_event.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_insert.cc | 4 + sql/sql_parse.cc | 13 +- 11 files changed, 471 insertions(+), 30 deletions(-) create mode 100644 mysql-test/r/mix_innodb_myisam_binlog.result create mode 100644 mysql-test/t/mix_innodb_myisam_binlog.test diff --git a/client/mysqldump.c b/client/mysqldump.c index 459cb9fda31..f1425faf0ed 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1459,9 +1459,8 @@ int main(int argc, char **argv) fprintf(md_result_file, "\n--\n-- Position to start replication from\n--\n\n"); fprintf(md_result_file, - "CHANGE MASTER TO MASTER_LOG_FILE='%s' ;\n", row[0]); - fprintf(md_result_file, "CHANGE MASTER TO MASTER_LOG_POS=%s ;\n", - row[1]); + "CHANGE MASTER TO MASTER_LOG_FILE='%s', \ +MASTER_LOG_POS=%s ;\n",row[0],row[1]); } mysql_free_result(master); } diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result new file mode 100644 index 00000000000..8a3415a81d0 --- /dev/null +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -0,0 +1,180 @@ +drop table if exists ti, tm; +create table ti (a int) type=innodb; +create table tm (a int) type=myisam; +reset master; +begin; +insert into ti values(1); +insert into tm select * from ti; +commit; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(1) +master-bin.001 178 Query 1 79 use test; insert into tm select * from ti +master-bin.001 244 Query 1 244 use test; COMMIT +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(2); +insert into tm select * from ti; +rollback; +Warning: Some non-transactional changed tables couldn't be rolled back +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(2) +master-bin.001 178 Query 1 79 use test; insert into tm select * from ti +master-bin.001 244 Query 1 244 use test; ROLLBACK +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(3); +savepoint my_savepoint; +insert into ti values(4); +insert into tm select * from ti; +rollback to savepoint my_savepoint; +Warning: Some non-transactional changed tables couldn't be rolled back +commit; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(3) +master-bin.001 178 Query 1 79 use test; savepoint my_savepoint +master-bin.001 235 Query 1 79 use test; insert into ti values(4) +master-bin.001 294 Query 1 79 use test; insert into tm select * from ti +master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint +master-bin.001 429 Query 1 429 use test; COMMIT +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(5); +savepoint my_savepoint; +insert into ti values(6); +insert into tm select * from ti; +rollback to savepoint my_savepoint; +Warning: Some non-transactional changed tables couldn't be rolled back +insert into ti values(7); +commit; +select a from ti order by a; +a +5 +7 +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(5) +master-bin.001 178 Query 1 79 use test; savepoint my_savepoint +master-bin.001 235 Query 1 79 use test; insert into ti values(6) +master-bin.001 294 Query 1 79 use test; insert into tm select * from ti +master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint +master-bin.001 429 Query 1 79 use test; insert into ti values(7) +master-bin.001 488 Query 1 488 use test; COMMIT +delete from ti; +delete from tm; +reset master; +select get_lock("a",10); +get_lock("a",10) +1 +begin; +insert into ti values(8); +insert into tm select * from ti; +select get_lock("a",10); +get_lock("a",10) +1 +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(8) +master-bin.001 178 Query 1 79 use test; insert into tm select * from ti +master-bin.001 244 Query 1 244 use test; ROLLBACK +delete from ti; +delete from tm; +reset master; +insert into ti values(9); +insert into tm select * from ti; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; insert into ti values(9) +master-bin.001 138 Query 1 138 use test; insert into tm select * from ti +delete from ti; +delete from tm; +reset master; +insert into ti values(10); +begin; +insert into tm select * from ti; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; insert into ti values(10) +master-bin.001 139 Query 1 139 use test; insert into tm select * from ti +insert into ti values(11); +commit; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; insert into ti values(10) +master-bin.001 139 Query 1 139 use test; insert into tm select * from ti +master-bin.001 205 Query 1 205 use test; BEGIN +master-bin.001 245 Query 1 205 use test; insert into ti values(11) +master-bin.001 305 Query 1 305 use test; COMMIT +alter table tm type=INNODB; +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(12); +insert into tm select * from ti; +commit; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(12) +master-bin.001 179 Query 1 79 use test; insert into tm select * from ti +master-bin.001 245 Query 1 245 use test; COMMIT +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(13); +insert into tm select * from ti; +rollback; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(14); +savepoint my_savepoint; +insert into ti values(15); +insert into tm select * from ti; +rollback to savepoint my_savepoint; +commit; +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(14) +master-bin.001 179 Query 1 179 use test; COMMIT +delete from ti; +delete from tm; +reset master; +begin; +insert into ti values(16); +savepoint my_savepoint; +insert into ti values(17); +insert into tm select * from ti; +rollback to savepoint my_savepoint; +insert into ti values(18); +commit; +select a from ti order by a; +a +16 +18 +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.001 79 Query 1 79 use test; BEGIN +master-bin.001 119 Query 1 79 use test; insert into ti values(16) +master-bin.001 179 Query 1 79 use test; insert into ti values(18) +master-bin.001 239 Query 1 239 use test; COMMIT +drop table ti,tm; diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index e93f8487c32..0302381c119 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -20,9 +20,9 @@ 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 -show binlog events from 898; -Log_name Pos Event_type Server_id Orig_log_pos Info -slave-bin.001 898 Query 1 898 use test; insert into t3 select * from t2 +show master status; +File Position Binlog_do_db Binlog_ignore_db +slave-bin.001 964 drop table t1; drop table t2; drop table t3; diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test new file mode 100644 index 00000000000..240aaefb349 --- /dev/null +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -0,0 +1,175 @@ +# Check that binlog is ok when a transaction mixes updates to InnoDB and +# MyISAM. It would be nice to make this a replication test, but in 4.0 the slave +# is always with --skip-innodb in the testsuite. I (Guilhem) however did some +# tests manually on a slave; tables are replicated fine and Exec_master_log_pos +# advances as expected. + +-- source include/have_innodb.inc + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; + +drop table if exists ti, tm; +create table ti (a int) type=innodb; +create table tm (a int) type=myisam; + +reset master; + +begin; +insert into ti values(1); +insert into tm select * from ti; +commit; + +show binlog events from 79; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(2); +insert into tm select * from ti; +# should say some changes to non-transactional tables couldn't be rolled back +--error 1196 +rollback; + +show binlog events from 79; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(3); +savepoint my_savepoint; +insert into ti values(4); +insert into tm select * from ti; +--error 1196 +rollback to savepoint my_savepoint; +commit; + +show binlog events from 79; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(5); +savepoint my_savepoint; +insert into ti values(6); +insert into tm select * from ti; +--error 1196 +rollback to savepoint my_savepoint; +insert into ti values(7); +commit; +select a from ti order by a; # check that savepoints work :) + +show binlog events from 79; + +# and when ROLLBACK is not explicit? +delete from ti; +delete from tm; +reset master; + +select get_lock("a",10); +begin; +insert into ti values(8); +insert into tm select * from ti; +disconnect con1; + +connection con2; +# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no +# guarantee that logging of the terminated con1 has been done yet (it may not +# even be started, so con1 may have not even attempted to lock the binlog yet; +# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that +# logging has been done, we use a user lock. +select get_lock("a",10); +show binlog events from 79; + +# and when not in a transaction? +delete from ti; +delete from tm; +reset master; + +insert into ti values(9); +insert into tm select * from ti; + +show binlog events from 79; + +# Check that when the query updating the MyISAM table is the first in the +# transaction, we log it immediately. +delete from ti; +delete from tm; +reset master; + +insert into ti values(10); # first make ti non-empty +begin; +insert into tm select * from ti; +show binlog events from 79; +insert into ti values(11); +commit; + +show binlog events from 79; + + +# Check that things work like before this BEGIN/ROLLBACK code was added, when tm +# is INNODB + +alter table tm type=INNODB; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(12); +insert into tm select * from ti; +commit; + +show binlog events from 79; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(13); +insert into tm select * from ti; +rollback; + +show binlog events from 79; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(14); +savepoint my_savepoint; +insert into ti values(15); +insert into tm select * from ti; +rollback to savepoint my_savepoint; +commit; + +show binlog events from 79; + +delete from ti; +delete from tm; +reset master; + +begin; +insert into ti values(16); +savepoint my_savepoint; +insert into ti values(17); +insert into tm select * from ti; +rollback to savepoint my_savepoint; +insert into ti values(18); +commit; +select a from ti order by a; # check that savepoints work :) + +show binlog events from 79; + +drop table ti,tm; diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index 65e07aaa823..4c4ff6a093e 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -32,15 +32,13 @@ sync_with_master; select * from t1; select * from t3; # We want to be sure that LOAD DATA is in the slave's binlog. -# But we can't simply read this binlog, because the file_id is uncertain (would -# cause test failures). So instead, we test if the binlog looks long enough to +# But we can't simply read this binlog, because as the slave has not been +# restarted for this test, the file_id is uncertain (would cause test +# failures). So instead, we test if the binlog looks long enough to # contain LOAD DATA. That is, I (Guilhem) have done SHOW BINLOG EVENTS on my -# machine, saw that the last event is 'create table t3' and is at position 898 -# when things go fine. If LOAD DATA was not logged, the binlog would be shorter -# than 898 bytes and there would be an error in SHOW BINLOG EVENTS. Of course, -# if someone changes the content of '../../std_data/rpl_loaddata2.dat', 898 will -# have to be changed too. -show binlog events from 898; +# machine, saw that the binlog is of size 964 when things go fine. +# If LOAD DATA was not logged, the binlog would be shorter. +show master status; connection master; diff --git a/sql/handler.cc b/sql/handler.cc index 96611301bfa..0d29dbeaa31 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -349,7 +349,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) if (trans == &thd->transaction.all && mysql_bin_log.is_open() && my_b_tell(&thd->transaction.trans_log)) { - mysql_bin_log.write(thd, &thd->transaction.trans_log); + mysql_bin_log.write(thd, &thd->transaction.trans_log, 1); reinit_io_cache(&thd->transaction.trans_log, WRITE_CACHE, (my_off_t) 0, 0, 1); thd->transaction.trans_log.end_of_file= max_binlog_cache_size; @@ -432,9 +432,21 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) } #endif if (trans == &thd->transaction.all) + { + /* + Update the binary log with a BEGIN/ROLLBACK block if we have cached some + queries and we updated some non-transactional table. Such cases should + be rare (updating a non-transactional table inside a transaction...). + */ + if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && + mysql_bin_log.is_open() && + my_b_tell(&thd->transaction.trans_log))) + mysql_bin_log.write(thd, &thd->transaction.trans_log, 0); + /* Flushed or not, empty the binlog cache */ reinit_io_cache(&thd->transaction.trans_log, - WRITE_CACHE, (my_off_t) 0, 0, 1); - thd->transaction.trans_log.end_of_file= max_binlog_cache_size; + WRITE_CACHE, (my_off_t) 0, 0, 1); + thd->transaction.trans_log.end_of_file= max_binlog_cache_size; + } thd->variables.tx_isolation=thd->session_tx_isolation; if (operation_done) { @@ -448,9 +460,27 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) /* -Rolls the current transaction back to a savepoint. -Return value: 0 if success, 1 if there was not a savepoint of the given -name. + Rolls the current transaction back to a savepoint. + Return value: 0 if success, 1 if there was not a savepoint of the given + name. + NOTE: how do we handle this (unlikely but legal) case: + [transaction] + [update to non-trans table] + [rollback to savepoint] ? + The problem occurs when a savepoint is before the update to the + non-transactional table. Then when there's a rollback to the savepoint, if we + simply truncate the binlog cache, we lose the part of the binlog cache where + the update is. If we want to not lose it, we need to write the SAVEPOINT + command and the ROLLBACK TO SAVEPOINT command to the binlog cache. The latter + is easy: it's just write at the end of the binlog cache, but the former should + be *inserted* to the place where the user called SAVEPOINT. The solution is + that when the user calls SAVEPOINT, we write it to the binlog cache (so no + need to later insert it). As transactions are never intermixed in the binary log + (i.e. they are serialized), we won't have conflicts with savepoint names when + using mysqlbinlog or in the slave SQL thread. + Then when ROLLBACK TO SAVEPOINT is called, if we updated some + non-transactional table, we don't truncate the binlog cache but instead write + ROLLBACK TO SAVEPOINT to it; otherwise we truncate the binlog cache (which + will chop the SAVEPOINT command from the binlog cache, which is good as in + that case there is no need to have it in the binlog). */ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name) @@ -475,8 +505,24 @@ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name) error=1; } else - reinit_io_cache(&thd->transaction.trans_log, WRITE_CACHE, - binlog_cache_pos, 0, 0); + { + /* + Write ROLLBACK TO SAVEPOINT to the binlog cache if we have updated some + non-transactional table. Otherwise, truncate the binlog cache starting + from the SAVEPOINT command. + */ + if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && + mysql_bin_log.is_open() && + my_b_tell(&thd->transaction.trans_log))) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE); + if (mysql_bin_log.write(&qinfo)) + error= 1; + } + else + reinit_io_cache(&thd->transaction.trans_log, WRITE_CACHE, + binlog_cache_pos, 0, 0); + } operation_done=1; #endif if (operation_done) @@ -505,6 +551,13 @@ int ha_savepoint(THD *thd, char *savepoint_name) #ifdef HAVE_INNOBASE_DB innobase_savepoint(thd,savepoint_name, binlog_cache_pos); #endif + /* Write it to the binary log (see comments of ha_rollback_to_savepoint). */ + if (mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE); + if (mysql_bin_log.write(&qinfo)) + error= 1; + } } #endif /* USING_TRANSACTIONS */ DBUG_RETURN(error); diff --git a/sql/log.cc b/sql/log.cc index ee774ea3700..6e9fa38c407 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1062,7 +1062,17 @@ bool MYSQL_LOG::write(Log_event* event_info) bool should_rotate = 0; const char *local_db = event_info->get_db(); #ifdef USING_TRANSACTIONS - IO_CACHE *file = ((event_info->get_cache_stmt()) ? + /* + Should we write to the binlog cache or to the binlog on disk? + Write to the binlog cache if: + - it is already not empty (meaning we're in a transaction; note that the + present event could be about a non-transactional table, but still we need + to write to the binlog cache in that case to handle updates to mixed + trans/non-trans table types the best possible in binlogging) + - or if the event asks for it (cache_stmt == true). + */ + IO_CACHE *file = ((event_info->get_cache_stmt() || + my_b_tell(&thd->transaction.trans_log)) ? &thd->transaction.trans_log : &log_file); #else @@ -1258,6 +1268,13 @@ uint MYSQL_LOG::next_file_id() /* Write a cached log entry to the binary log + SYNOPSIS + write() + thd + cache The cache to copy to the binlog + commit_or_rollback If true, will write "COMMIT" in the end, if false will + write "ROLLBACK". + NOTE - We only come here if there is something in the cache. - The thing in the cache is always a complete transaction @@ -1265,10 +1282,13 @@ uint MYSQL_LOG::next_file_id() IMPLEMENTATION - To support transaction over replication, we wrap the transaction - with BEGIN/COMMIT in the binary log. + with BEGIN/COMMIT or BEGIN/ROLLBACK in the binary log. + We want to write a BEGIN/ROLLBACK block when a non-transactional table was + updated in a transaction which was rolled back. This is to ensure that the + same updates are run on the slave. */ -bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) +bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) { VOID(pthread_mutex_lock(&LOCK_log)); DBUG_ENTER("MYSQL_LOG::write(cache"); @@ -1322,7 +1342,10 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) */ { - Query_log_event qinfo(thd, "COMMIT", 6, TRUE); + Query_log_event qinfo(thd, + commit_or_rollback ? "COMMIT" : "ROLLBACK", + commit_or_rollback ? 6 : 8, + TRUE); qinfo.set_log_pos(this); if (qinfo.write(&log_file) || flush_io_cache(&log_file)) goto err; diff --git a/sql/log_event.cc b/sql/log_event.cc index 9e7546dd635..54e4d34f77e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1803,7 +1803,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) */ if (!strcmp(thd->query,"BEGIN")) rli->inside_transaction= opt_using_transactions; - else if (!strcmp(thd->query,"COMMIT")) + else if (!(strcmp(thd->query,"COMMIT") && strcmp(thd->query,"ROLLBACK"))) rli->inside_transaction=0; /* diff --git a/sql/sql_class.h b/sql/sql_class.h index 49a364856eb..b30faa3e9d9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -140,7 +140,7 @@ public: bool write(THD *thd, const char *query, uint query_length, time_t query_start=0); bool write(Log_event* event_info); // binary log write - bool write(THD *thd, IO_CACHE *cache); + bool write(THD *thd, IO_CACHE *cache, bool commit_or_rollback); /* v stands for vector diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 167ccf974c7..0a83358e8c6 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1367,6 +1367,8 @@ void select_insert::send_error(uint errcode,const char *err) table->file->has_transactions()); mysql_bin_log.write(&qinfo); } + if (!table->tmp_table) + thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } ha_rollback_stmt(thd); if (info.copied || info.deleted) @@ -1398,6 +1400,8 @@ bool select_insert::send_eof() if (info.copied || info.deleted) { query_cache_invalidate3(thd, table, 1); + if (!(table->file->has_transactions() || table->tmp_table)) + thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } if (error) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1479a611b5a..548714345f8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2553,7 +2553,16 @@ mysql_execute_command(void) thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_rollback(thd)) { - if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) + /* + If a non-transactional table was updated, warn; don't warn if this is a + slave thread (because when a slave thread executes a ROLLBACK, it has + been read from the binary log, so it's 100% sure and normal to produce + error ER_WARNING_NOT_COMPLETE_ROLLBACK. If we sent the warning to the + slave SQL thread, it would not stop the thread but just be printed in + the error log; but we don't want users to wonder why they have this + message in the error log, so we don't send it. + */ + if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && !thd->slave_thread) send_warning(&thd->net,ER_WARNING_NOT_COMPLETE_ROLLBACK,0); else send_ok(&thd->net); @@ -2565,7 +2574,7 @@ mysql_execute_command(void) case SQLCOM_ROLLBACK_TO_SAVEPOINT: if (!ha_rollback_to_savepoint(thd, lex->savepoint_name)) { - if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) + if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && !thd->slave_thread) send_warning(&thd->net,ER_WARNING_NOT_COMPLETE_ROLLBACK,0); else send_ok(&thd->net);