From 465745a20063c4c368750415d9c8b331374b91dd Mon Sep 17 00:00:00 2001 From: "timour@mysql.com" <> Date: Wed, 22 Feb 2006 10:04:10 +0200 Subject: [PATCH 01/14] Fix for BUG#17523: natural join and information schema. The cause of the bug was an ASSERT that checked the consistency of TABLE_SHARE::db and TABLE_LIST::db and failed for I_S tables. The fix relaxes the requirement for consistency for I_S. --- mysql-test/r/join.result | 5 +++++ mysql-test/t/join.test | 6 ++++++ sql/table.cc | 19 +++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 724d1b1e39f..54536d6c32a 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -677,6 +677,11 @@ select t1.b from v1a; ERROR 42S22: Unknown column 't1.b' in 'field list' select * from v1a join v1b on t1.b = t2.b; ERROR 42S22: Unknown column 't1.b' in 'on clause' +select * from information_schema.statistics join information_schema.columns +using(table_name,column_name) where table_name='user'; +TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 20 60 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references +user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 5 16 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references drop table t1; drop table t2; drop table t3; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 553aaf987bb..90abc61ca07 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -523,6 +523,12 @@ select t1.b from v1a; -- error 1054 select * from v1a join v1b on t1.b = t2.b; +# +# Bug #17523 natural join and information_schema +# +select * from information_schema.statistics join information_schema.columns + using(table_name,column_name) where table_name='user'; + drop table t1; drop table t2; drop table t3; diff --git a/sql/table.cc b/sql/table.cc index 9ae5348b5c6..1a2c2b8f073 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2595,8 +2595,15 @@ const char *Natural_join_column::db_name() if (view_field) return table_ref->view_db.str; + /* + Test that TABLE_LIST::db is the same as st_table_share::db to + ensure consistency. An exception are I_S schema tables, which + are inconsistent in this respect. + */ DBUG_ASSERT(!strcmp(table_ref->db, - table_ref->table->s->db)); + table_ref->table->s->db) || + (table_ref->schema_table && + table_ref->table->s->db[0] == 0)); return table_ref->db; } @@ -2798,7 +2805,15 @@ const char *Field_iterator_table_ref::db_name() else if (table_ref->is_natural_join) return natural_join_it.column_ref()->db_name(); - DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db)); + /* + Test that TABLE_LIST::db is the same as st_table_share::db to + ensure consistency. An exception are I_S schema tables, which + are inconsistent in this respect. + */ + DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db) || + (table_ref->schema_table && + table_ref->table->s->db[0] == 0)); + return table_ref->db; } From 6d4dc91bbfcdc00334a850bb4fdd5e6336e1b48f Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 12:01:24 -0600 Subject: [PATCH 02/14] mysqltest.c: Fix typos. --- client/mysqltest.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 613c4e12763..805c9330c6a 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -115,8 +115,8 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD, The list of error codes to --error are stored in an internal array of structs. This struct can hold numeric SQL error codes or SQLSTATE codes as strings. The element next to the last active element in the list is - set to type ERR_EMPTY. When an SQL statement return an error we use - this list to check if this is an expected error. + set to type ERR_EMPTY. When an SQL statement returns an error, we use + this list to check if this is an expected error. */ enum match_err_type @@ -986,8 +986,8 @@ int do_source(struct st_query *query) *p++= 0; query->last_argument= p; /* - If this file has already been sourced, dont source it again. - It's already available in the q_lines cache + If this file has already been sourced, don't source it again. + It's already available in the q_lines cache. */ if (parser.current_line < (parser.read_lines - 1)) return 0; @@ -2151,7 +2151,7 @@ my_bool end_of_query(int c) Normally that means it will read lines until it reaches the "delimiter" that marks end of query. Default delimiter is ';' The function should be smart enough not to detect delimiter's - found inside strings sorrounded with '"' and '\'' escaped strings. + found inside strings surrounded with '"' and '\'' escaped strings. If the first line in a query starts with '#' or '-' this line is treated as a comment. A comment is always terminated when end of line '\n' is @@ -2485,7 +2485,7 @@ static struct my_option my_long_options[] = {"result-file", 'R', "Read/Store result from/in this file.", (gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"server-arg", 'A', "Send enbedded server this as a paramenter.", + {"server-arg", 'A', "Send option value to embedded server as a parameter.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-file", 'F', "Read embedded server arguments from file.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -4074,8 +4074,8 @@ int main(int argc, char **argv) /* my_stat() successful on result file. Check if we have not run a single query, but we do have a result file that contains data. - Note that we don't care, if my_stat() fails. For example for - non-existing or non-readable file we assume it's fine to have + Note that we don't care, if my_stat() fails. For example, for a + non-existing or non-readable file, we assume it's fine to have no query output from the test file, e.g. regarded as no error. */ if (res_info.st_size) From a052ef7d829bda1240d99baddce5e11d62bd485f Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 12:19:30 -0600 Subject: [PATCH 03/14] mysqltest.c: Fix typos. --- client/mysqltest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 57bb907170e..0ee8486a31d 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1370,7 +1370,7 @@ int do_modify_var(struct st_query *query, const char *name, system Eval the query to expand any $variables in the command. - Execute the command withe the "system" command. + Execute the command with the "system" command. NOTE If mysqltest is executed from cygwin shell, the command will be @@ -2099,7 +2099,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user, /* - Connect to a server and handle connection errors in case when they occur. + Connect to a server and handle connection errors in case they occur. SYNOPSIS connect_n_handle_errors() @@ -2819,7 +2819,7 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use the compressed server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statment", + {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.", (gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, From fc8ed82da4ed31e24647cd41fc77dcc112fd811a Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 14:00:17 -0600 Subject: [PATCH 04/14] mysqltest.c: Correct/clarify comments. --- client/mysqltest.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 805c9330c6a..83be283a050 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -320,13 +320,6 @@ 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 mysqltest's command line 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", @@ -1536,11 +1529,19 @@ int do_disable_rpl_parse(struct st_query *query __attribute__((unused))) do_sleep() q called command real_sleep use the value from opt_sleep as number of seconds to sleep + if real_sleep is false DESCRIPTION sleep - real_sleep + real_sleep + The difference between the sleep and real_sleep commands is that sleep + uses the delay from the --sleep command-line option if there is one. + (If the --sleep option is not given, the sleep command uses the delay + specified by its argument.) The real_sleep command always uses the + delay specified by its 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. */ int do_sleep(struct st_query *query, my_bool real_sleep) From 7ff2ede8c98d53a4262ecefba815f574320ee9ec Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 14:04:21 -0600 Subject: [PATCH 05/14] mysqltest.c: Fix reference to incorrect (non-existent) options in comment. --- client/mysqltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 3493a781875..1ddbe76700e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -4316,7 +4316,7 @@ void get_query_type(struct st_query* q) q->type=(enum enum_commands) type; /* Found command */ /* If queries are disabled, only recognize - --enable-queries and --disable-queries + --enable_parsing and --disable_parsing */ if (parsing_disabled && q->type != Q_ENABLE_PARSING && q->type != Q_DISABLE_PARSING) From d6654fe9cbcb438c91b7d69b9197d61f8d31dc54 Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 15:08:16 -0600 Subject: [PATCH 06/14] mysql-test-run.sh: Fix URLs. README: Fix URL. mysqltest.result: Update test result for real_sleep error message. mysqltest.c: Fix do_sleep() to print correct command name for real_sleep. --- client/mysqltest.c | 7 ++++--- mysql-test/README | 2 +- mysql-test/mysql-test-run.sh | 4 ++-- mysql-test/r/mysqltest.result | 2 ++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 83be283a050..a525adfd819 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1550,18 +1550,19 @@ int do_sleep(struct st_query *query, my_bool real_sleep) char *p= query->first_argument; char *sleep_start, *sleep_end= query->end; double sleep_val; + char *cmd = (real_sleep ? "real_sleep" : "sleep"); while (my_isspace(charset_info, *p)) p++; if (!*p) - die("Missing argument to sleep"); + die("Missing argument to %s", cmd); sleep_start= p; /* Check that arg starts with a digit, not handled by my_strtod */ if (!my_isdigit(charset_info, *sleep_start)) - die("Invalid argument to sleep \"%s\"", query->first_argument); + die("Invalid argument to %s \"%s\"", cmd, query->first_argument); sleep_val= my_strtod(sleep_start, &sleep_end, &error); if (error) - die("Invalid argument to sleep \"%s\"", query->first_argument); + die("Invalid argument to %s \"%s\"", cmd, query->first_argument); /* Fixed sleep time selected by --sleep option */ if (opt_sleep && !real_sleep) diff --git a/mysql-test/README b/mysql-test/README index 10d64784ed4..0e20ca884a3 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -21,7 +21,7 @@ conflict with it. All tests must pass. If one or more of them fail on your system, please read the following manual section of how to report the problem: -http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html +http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html You can create your own test cases. To create a test case: diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 9fcdacb22cb..b9512f7dd79 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -789,7 +789,7 @@ show_failed_diff () $DIFF -c $result_file $reject_file echo "-------------------------------------------------------" echo "Please follow the instructions outlined at" - echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html" + echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html" echo "to find the reason to this problem and how to report this." echo "" fi @@ -884,7 +884,7 @@ report_stats () { $ECHO "The log files in $MY_LOG_DIR may give you some hint" $ECHO "of what when wrong." $ECHO "If you want to report this error, please read first the documentation at" - $ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html" + $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html" fi if test -z "$USE_RUNNING_SERVER" diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 0e3d3812781..990f04e5ba9 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -280,7 +280,9 @@ here is the sourced script In loop here is the sourced script mysqltest: At line 1: Missing argument to sleep +mysqltest: At line 1: Missing argument to real_sleep mysqltest: At line 1: Invalid argument to sleep "abc" +mysqltest: At line 1: Invalid argument to real_sleep "abc" 1 2 101 From 67e4580e2954fb9b37b27a9117e8d049e9beafed Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 15:11:44 -0600 Subject: [PATCH 07/14] mysqltest.c: expand tab --- client/mysqltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 5d97bb2e330..0558df7a568 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1626,7 +1626,7 @@ int do_disable_rpl_parse(struct st_query *query __attribute__((unused))) do_sleep() q called command real_sleep use the value from opt_sleep as number of seconds to sleep - if real_sleep is false + if real_sleep is false DESCRIPTION sleep From 7f7f5969c0108dbb8365d798a8b01a4a59d3f956 Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Tue, 28 Feb 2006 17:54:11 -0600 Subject: [PATCH 08/14] mysqltest.test: Add real_sleep tests. --- mysql-test/t/mysqltest.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 7ed204fc6d3..f5c6a7617c5 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -605,10 +605,14 @@ real_sleep 1; # Missing parameter --error 1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "real_sleep ;" | $MYSQL_TEST 2>&1 # Illegal parameter --error 1 --exec echo "sleep abc;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- # Test inc From dc052a3a0048da961906a50add352b6ba4ab8bd7 Mon Sep 17 00:00:00 2001 From: "holyfoot@deer.(none)" <> Date: Wed, 1 Mar 2006 15:50:15 +0400 Subject: [PATCH 09/14] bug #9088 (bigint WHERE fails) --- mysql-test/r/bigint.result | 9 +++++++++ mysql-test/t/bigint.test | 9 +++++++++ sql/item.h | 5 +++-- sql/item_cmpfunc.cc | 3 ++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 84779858b75..3cdf4b17027 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -332,3 +332,12 @@ SELECT * FROM t1; col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 fix1 fix2 fix3 fix4 fix5 fix6 fix7 fix8 fix9 fix10 fix11 fix12 fix13 fix14 fix15 fix16 fix17 fix18 fix19 fix20 fix21 fix22 fix23 fix24 fix25 fix26 fix27 fix28 fix29 fix30 9 99 999 9999 99999 999999 9999999 99999999 999999999 9999999999 99999999999 999999999999 9999999999999 99999999999999 999999999999999 9999999999999999 99999999999999999 999999999999999999 9999999999999999999 99999999999999999999 999999999999999999999 9999999999999999999999 99999999999999999999999 999999999999999999999999 9999999999999999999999999 99999999999999999999999999 999999999999999999999999999 9999999999999999999999999999 99999999999999999999999999999 999999999999999999999999999999 9999999999999999999999999999999 99999999999999999999999999999999 999999999999999999999999999999999 9999999999999999999999999999999999 99999999999999999999999999999999999 999999999999999999999999999999999999 9999999999999999999999999999999999999 99999999999999999999999999999999999999 9999999999999999999999999999999999999.9 999999999999999999999999999999999999.99 99999999999999999999999999999999999.999 9999999999999999999999999999999999.9999 999999999999999999999999999999999.99999 99999999999999999999999999999999.999999 9999999999999999999999999999999.9999999 999999999999999999999999999999.99999999 99999999999999999999999999999.999999999 9999999999999999999999999999.9999999999 999999999999999999999999999.99999999999 99999999999999999999999999.999999999999 9999999999999999999999999.9999999999999 999999999999999999999999.99999999999999 99999999999999999999999.999999999999999 9999999999999999999999.9999999999999999 999999999999999999999.99999999999999999 99999999999999999999.999999999999999999 9999999999999999999.9999999999999999999 999999999999999999.99999999999999999999 99999999999999999.999999999999999999999 9999999999999999.9999999999999999999999 999999999999999.99999999999999999999999 99999999999999.999999999999999999999999 9999999999999.9999999999999999999999999 999999999999.99999999999999999999999999 99999999999.999999999999999999999999999 9999999999.9999999999999999999999999999 999999999.99999999999999999999999999999 99999999.999999999999999999999999999999 DROP TABLE t1; +create table t1 (bigint_col bigint unsigned); +insert into t1 values (17666000000000000000); +select * from t1 where bigint_col=17666000000000000000; +bigint_col +17666000000000000000 +select * from t1 where bigint_col='17666000000000000000'; +bigint_col +17666000000000000000 +drop table t1; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 7871b3647e3..35cda11646a 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -270,3 +270,12 @@ VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, SELECT * FROM t1; DROP TABLE t1; + +#bug #9088 BIGINT WHERE CLAUSE +create table t1 (bigint_col bigint unsigned); +insert into t1 values (17666000000000000000); +select * from t1 where bigint_col=17666000000000000000; +select * from t1 where bigint_col='17666000000000000000'; +drop table t1; + + diff --git a/sql/item.h b/sql/item.h index 2029658d476..a859b067632 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1887,9 +1887,10 @@ class Item_int_with_ref :public Item_int { Item *ref; public: - Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg) + Item_int_with_ref(longlong i, Item *ref_arg, my_bool unsigned_arg) : + Item_int(i), ref(ref_arg) { - unsigned_flag= ref_arg->unsigned_flag; + unsigned_flag= unsigned_arg; } int save_in_field(Field *field, bool no_conversions) { diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index d812ce913c5..7ba8a536ac7 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -216,7 +216,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item) field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES; if (!(*item)->save_in_field(field, 1) && !((*item)->null_value)) { - Item *tmp=new Item_int_with_ref(field->val_int(), *item); + Item *tmp=new Item_int_with_ref(field->val_int(), *item, + test(field->flags & UNSIGNED_FLAG)); field->table->in_use->variables.sql_mode= orig_sql_mode; if (tmp) thd->change_item_tree(item, tmp); From 3a325cb81e07cfc949396ea05baf199a70268614 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Wed, 1 Mar 2006 15:21:03 +0100 Subject: [PATCH 10/14] Bug#2845 client fails to reconnect if using TCP/IP - Change to use non blocking read to empty channel in case of too large sd number - Don't check for too large socket number on Windows. --- sql/net_serv.cc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index b3ee28607ad..c5794fb4d25 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -229,8 +229,12 @@ static int net_data_is_ready(my_socket sd) struct timeval tv; int res; +#ifndef __WIN__ + /* Windows uses an _array_ of 64 fd's as default, so it's safe */ if (sd >= FD_SETSIZE) return -1; + #define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE +#endif FD_ZERO(&sfds); FD_SET(sd, &sfds); @@ -271,7 +275,7 @@ void net_clear(NET *net) int count, ready; DBUG_ENTER("net_clear"); #if !defined(EMBEDDED_LIBRARY) - while((ready= net_data_is_ready(net->vio->sd)) != 0) + while((ready= net_data_is_ready(net->vio->sd)) > 0) { /* The socket is ready */ if ((count= vio_read(net->vio, (char*) (net->buff), @@ -286,15 +290,27 @@ void net_clear(NET *net) } else { - /* No data to read and 'net_data_is_ready' returned "don't know" */ - if (ready == -1) - break; - DBUG_PRINT("info",("socket ready but only EOF to read - disconnected")); net->error= 2; break; } } +#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE + /* 'net_data_is_ready' returned "don't know" */ + if (ready == -1) + { + /* Read unblocking to clear net */ + my_bool old_mode; + if (!vio_blocking(net->vio, FALSE, &old_mode)) + { + while ((count= vio_read(net->vio, (char*) (net->buff), + (uint32) net->max_packet)) > 0) + DBUG_PRINT("info",("skipped %d bytes from file: %s", + count, vio_description(net->vio))); + vio_blocking(net->vio, TRUE, &old_mode); + } + } +#endif #endif net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */ net->write_pos=net->buff; From b802826fc90d3f6039bab1af2842d6a5009f4aa0 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Wed, 1 Mar 2006 15:22:47 +0100 Subject: [PATCH 11/14] Dont' run the mysql_protocols on Windows --- mysql-test/t/mysql_protocols.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/mysql_protocols.test b/mysql-test/t/mysql_protocols.test index 0253c2b5d17..5eba780420c 100644 --- a/mysql-test/t/mysql_protocols.test +++ b/mysql-test/t/mysql_protocols.test @@ -1,5 +1,7 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +# Windows does not have SOCKET, but will try to create a PIPE as well as MEMORY +--source include/not_windows.inc # test for Bug #4998 "--protocol doesn't reject bad values" From 7b4f0dc8b05229d6d3d6208ecd1c6863939538e5 Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Wed, 1 Mar 2006 17:37:07 -0600 Subject: [PATCH 12/14] README: Revise mysql-test README. --- mysql-test/README | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mysql-test/README b/mysql-test/README index 6ad97adbd2b..0e20ca884a3 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -1,6 +1,19 @@ This directory contains a test suite for mysql daemon. To run the currently existing test cases, simply execute ./mysql-test-run in this directory. It will fire up the newly built mysqld and test it. + +If you want to run a test with a running MySQL server use the --extern +option to mysql-test-run. Please note that in this mode the test suite +expects user to specify test names to run. Otherwise it falls back to the +normal "non-extern" behaviour. The reason is that some tests +could not run with external server. Here is the sample command +to test "alias" and "analyze" tests on external server: + +mysql-test-run --extern alias analyze + +To match your setup you might also need to provide --socket, --user and +other relevant options. + Note that you do not have to have to do make install, and you could actually have a co-existing MySQL installation - the tests will not conflict with it. @@ -8,13 +21,12 @@ conflict with it. All tests must pass. If one or more of them fail on your system, please read the following manual section of how to report the problem: -http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html +http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html You can create your own test cases. To create a test case: - cd t - vi test_case_name.test + xemacs t/test_case_name.test in the file, put a set of SQL commands that will create some tables, load test data, run some queries to manipulate it. From be887ea8305c212a73dd065e51340e95545a7337 Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Wed, 1 Mar 2006 17:55:10 -0600 Subject: [PATCH 13/14] README.gcov: Revise README.gcov. --- mysql-test/README.gcov | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mysql-test/README.gcov b/mysql-test/README.gcov index 83ddd6df2e1..6d2852e8ca0 100644 --- a/mysql-test/README.gcov +++ b/mysql-test/README.gcov @@ -1,11 +1,13 @@ To be able to see the level of coverage with the current test suite, do the following: - - make sure gcov is installed - - compile with BUILD/compile-pentium-gcov ( if your machine is not pentium, hack -this script, or just live with the pentium-specific stuff) - - ./mysql-test-run -gcov - - to see the level of coverage for a given source file: + - Make sure gcov is installed + - Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your + machine does not have a pentium CPU, hack this script, or just live with + the pentium-specific stuff) + - In the mysql-test directory, run this command: ./mysql-test-run -gcov + - To see the level of coverage for a given source file: grep source_file_name /tmp/gcov.out - - to see which lines are not yet covered, look at source_file_name.gcov in the source tree. Then think hard about a test case that will cover those -lines, and write one! + - To see which lines are not yet covered, look at source_file_name.gcov in + the source tree. Then think hard about a test case that will cover those + lines, and write one! From fe613502af9b7594df9099853b9d97fd8d7418c5 Mon Sep 17 00:00:00 2001 From: "paul@snake-hub.snake.net" <> Date: Wed, 1 Mar 2006 18:37:41 -0600 Subject: [PATCH 14/14] README: revise README. --- mysql-test/README | 60 ++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/mysql-test/README b/mysql-test/README index 0e20ca884a3..77b398ebf39 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -1,45 +1,51 @@ -This directory contains a test suite for mysql daemon. To run +This directory contains a test suite for the MySQL daemon. To run the currently existing test cases, simply execute ./mysql-test-run in this directory. It will fire up the newly built mysqld and test it. -If you want to run a test with a running MySQL server use the --extern -option to mysql-test-run. Please note that in this mode the test suite -expects user to specify test names to run. Otherwise it falls back to the -normal "non-extern" behaviour. The reason is that some tests -could not run with external server. Here is the sample command -to test "alias" and "analyze" tests on external server: - -mysql-test-run --extern alias analyze - -To match your setup you might also need to provide --socket, --user and -other relevant options. - -Note that you do not have to have to do make install, and you could -actually have a co-existing MySQL installation - the tests will not +Note that you do not have to have to do "make install", and you could +actually have a co-existing MySQL installation. The tests will not conflict with it. All tests must pass. If one or more of them fail on your system, please -read the following manual section of how to report the problem: +read the following manual section for instructions on how to report the +problem: http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html +If you want to use an already running MySQL server for specific tests, +use the --extern option to mysql-test-run. Please note that in this mode, +the test suite expects you to provide the names of the tests to run. +For example, here is the command to run the "alias" and "analyze" tests +with an external server: -You can create your own test cases. To create a test case: +mysql-test-run --extern alias analyze + +To match your setup, you might also need to provide --socket, --user, and +other relevant options. + +With no test cases named on the command line, mysql-test-run falls back +to the normal "non-extern" behavior. The reason for this is that some +tests cannot run with an external server. + + +You can create your own test cases. To create a test case, create a new +file in the t subdirectory using a text editor. The file should have a .test +extension. For example: xemacs t/test_case_name.test - in the file, put a set of SQL commands that will create some tables, - load test data, run some queries to manipulate it. + In the file, put a set of SQL statements that create some tables, + load test data, and run some queries to manipulate it. - We would appreciate if the test tables were called t1, t2, t3 ... (to not + We would appreciate it if you name your test tables t1, t2, t3 ... (to not conflict too much with existing tables). Your test should begin by dropping the tables you are going to create and - end by dropping them again. This will ensure that one can run the test - over and over again. + end by dropping them again. This ensures that you can run the test over + and over again. If you are using mysqltest commands (like result file names) in your - test case you should do create the result file as follows: + test case, you should create the result file as follows: mysql-test-run --record test_case_name @@ -47,8 +53,8 @@ You can create your own test cases. To create a test case: mysqltest --record < t/test_case_name.test - If you only have a simple test cases consistent of SQL commands and comments - you can create the test case one of the following ways: + If you only have a simple test cases consisting of SQL statements and + comments, you can create the test case in one of the following ways: mysql-test-run --record test_case_name @@ -57,11 +63,11 @@ You can create your own test cases. To create a test case: mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test When this is done, take a look at r/test_case_name.result - - If the result is wrong, you have found a bug; In this case you should + - If the result is incorrect, you have found a bug. In this case, you should edit the test result to the correct results so that we can verify that the bug is corrected in future releases. To submit your test case, put your .test file and .result file(s) into a tar.gz archive, add a README that explains the problem, ftp the -archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail +archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail to bugs@lists.mysql.com