From de9909faec7ae81b7946f314b97ff2da8be7fe2e Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Thu, 7 Jul 2005 11:49:44 -0700 Subject: [PATCH 01/13] Fix crash caused by calling DES_ENCRYPT() without the --des-key-file option having been passed to the server. (Bug #11643) --- BitKeeper/etc/config | 2 +- mysql-test/r/func_des_encrypt.result | 3 +++ mysql-test/t/func_des_encrypt.test | 9 +++++++++ sql/des_key_file.cc | 18 ++++++++++++------ sql/item_strfunc.cc | 11 +++++++++++ sql/mysql_priv.h | 1 + 6 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 mysql-test/r/func_des_encrypt.result create mode 100644 mysql-test/t/func_des_encrypt.test diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index c609fcdbd49..f1e8e29fbfb 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -24,7 +24,7 @@ description: MySQL - fast and reliable SQL database # repository is commercial it can be an internal email address or "none" # to disable logging. # -logging: logging@openlogging.org +logging: none # # If this field is set, all checkins will appear to be made by this user, # in effect making this a single user package. Single user packages are diff --git a/mysql-test/r/func_des_encrypt.result b/mysql-test/r/func_des_encrypt.result new file mode 100644 index 00000000000..46b30bdab58 --- /dev/null +++ b/mysql-test/r/func_des_encrypt.result @@ -0,0 +1,3 @@ +select des_encrypt('hello'); +des_encrypt('hello') +€Ö2nV“Ø} diff --git a/mysql-test/t/func_des_encrypt.test b/mysql-test/t/func_des_encrypt.test new file mode 100644 index 00000000000..201a0051c58 --- /dev/null +++ b/mysql-test/t/func_des_encrypt.test @@ -0,0 +1,9 @@ +-- source include/have_openssl.inc + +# This test can't be in func_encrypt.test, because it requires +# --des-key-file to not be set. + +# +# Bug #11643: des_encrypt() causes server to die +# +select des_encrypt('hello'); diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index c6b4c5f2c34..558e3f16ad2 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -22,7 +22,17 @@ struct st_des_keyschedule des_keyschedule[10]; uint des_default_key; pthread_mutex_t LOCK_des_key_file; -static int initialized; +static int initialized= 0; + +void +init_des_key_file() +{ + if (!initialized) + { + initialized=1; + pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST); + } +} /* Function which loads DES keys from plaintext file into memory on MySQL @@ -45,11 +55,7 @@ load_des_key_file(const char *file_name) DBUG_ENTER("load_des_key_file"); DBUG_PRINT("enter",("name: %s",file_name)); - if (!initialized) - { - initialized=1; - pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST); - } + init_des_key_file(); VOID(pthread_mutex_lock(&LOCK_des_key_file)); if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 || diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 881a8a7c915..7fb27470b8e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -388,6 +388,9 @@ String *Item_func_des_encrypt::val_str(String *str) if (arg_count == 1) { + /* Make sure LOCK_des_key_file was initialized. */ + init_des_key_file(); + /* Protect against someone doing FLUSH DES_KEY_FILE */ VOID(pthread_mutex_lock(&LOCK_des_key_file)); keyschedule= des_keyschedule[key_number=des_default_key]; @@ -398,6 +401,10 @@ String *Item_func_des_encrypt::val_str(String *str) key_number= (uint) args[1]->val_int(); if (key_number > 9) goto error; + + /* Make sure LOCK_des_key_file was initialized. */ + init_des_key_file(); + VOID(pthread_mutex_lock(&LOCK_des_key_file)); keyschedule= des_keyschedule[key_number]; VOID(pthread_mutex_unlock(&LOCK_des_key_file)); @@ -485,6 +492,10 @@ String *Item_func_des_decrypt::val_str(String *str) // Check if automatic key and that we have privilege to uncompress using it if (!(current_thd->master_access & SUPER_ACL) || key_number > 9) goto error; + + /* Make sure LOCK_des_key_file was initialized. */ + init_des_key_file(); + VOID(pthread_mutex_lock(&LOCK_des_key_file)); keyschedule= des_keyschedule[key_number]; VOID(pthread_mutex_unlock(&LOCK_des_key_file)); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index cc58e34d582..5c97269b5ce 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -624,6 +624,7 @@ extern char *des_key_file; extern struct st_des_keyschedule des_keyschedule[10]; extern uint des_default_key; extern pthread_mutex_t LOCK_des_key_file; +void init_des_key_file(); bool load_des_key_file(const char *file_name); void free_des_key_file(); #endif /* HAVE_OPENSSL */ From 48e10134927e1bdb963cb00d82b006b5e28d5d96 Mon Sep 17 00:00:00 2001 From: "ramil@mysql.com" <> Date: Fri, 8 Jul 2005 16:25:07 +0500 Subject: [PATCH 02/13] portability fix: the Max_data_length replaced with # --- mysql-test/r/view.result | 14 +++++++------- mysql-test/t/view.test | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index cebf88464cf..c0ed41bb8e6 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -149,13 +149,13 @@ v5 VIEW v6 VIEW show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 MyISAM 10 Fixed 5 9 45 2533274790395903 1024 0 NULL # # NULL latin1_swedish_ci NULL -v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view -v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view -v3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view -v4 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view -v5 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view -v6 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view +t1 MyISAM 10 Fixed 5 9 45 # 1024 0 NULL # # NULL latin1_swedish_ci NULL +v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view +v2 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view +v3 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view +v4 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view +v5 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view +v6 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view drop view v1,v2,v3,v4,v5,v6; create view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a = all (select a from t1) from t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index f3e32754821..81ac644a80b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -83,8 +83,7 @@ explain extended select c from v6; # show table/table status test show tables; show full tables; ---replace_column 12 # 13 # ---replace_result 2147483647 38654705663 +--replace_column 8 # 12 # 13 # show table status; drop view v1,v2,v3,v4,v5,v6; From 8295cec7bc779818b7c5639ce3365391574d75db Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Fri, 8 Jul 2005 14:59:02 +0200 Subject: [PATCH 03/13] sql_insert.cc: Use the test() macro instead of assigning a pointer to a bool --- sql/sql_insert.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 576866cb17d..2060d6ade81 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1118,7 +1118,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, table_list= (table_list->belong_to_view ? table_list->belong_to_view : table_list); - view= (table_list->view); + view= test(table_list->view); } if (view) { From 7ae4a6043c074235fc944e7fba25b903d5a17bb8 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Mon, 11 Jul 2005 10:37:21 -0700 Subject: [PATCH 04/13] Apply security patch to bundled zlib for CAN-2005-2096. (Bug #11844) --- zlib/inftrees.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zlib/inftrees.c b/zlib/inftrees.c index 8a896b28793..509461d9273 100644 --- a/zlib/inftrees.c +++ b/zlib/inftrees.c @@ -134,7 +134,7 @@ unsigned short FAR *work; left -= count[len]; if (left < 0) return -1; /* over-subscribed */ } - if (left > 0 && (type == CODES || (codes - count[0] != 1))) + if (left > 0 && (type == CODES || max != 1)) return -1; /* incomplete set */ /* generate offsets into symbol table for each length for sorting */ From dc55af92ffee58f45f9c53cbeda7ca34931f2f74 Mon Sep 17 00:00:00 2001 From: "lars@mysql.com" <> Date: Tue, 12 Jul 2005 06:01:26 +0200 Subject: [PATCH 05/13] BUG#6987: Added note when stat is failing on relay log, added mutex for log rotatation. --- sql/log.cc | 2 ++ sql/slave.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sql/log.cc b/sql/log.cc index c8a3b512b6d..a67f35e30bf 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -853,6 +853,8 @@ int MYSQL_LOG::purge_logs(const char *to_log, of space that deletion will free. In most cases, deletion won't work either, so it's not a problem. */ + sql_print_information("Failed to execute my_stat on file '%s'", + log_info.log_file_name); tmp= 0; } } diff --git a/sql/slave.cc b/sql/slave.cc index 5a2d3af3845..68769fc1f98 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4462,6 +4462,7 @@ void rotate_relay_log(MASTER_INFO* mi) RELAY_LOG_INFO* rli= &mi->rli; lock_slave_threads(mi); + pthread_mutex_lock(&mi->data_lock); pthread_mutex_lock(&rli->data_lock); /* We need to test inited because otherwise, new_file() will attempt to lock @@ -4492,6 +4493,7 @@ void rotate_relay_log(MASTER_INFO* mi) rli->relay_log.harvest_bytes_written(&rli->log_space_total); end: pthread_mutex_unlock(&rli->data_lock); + pthread_mutex_unlock(&mi->data_lock); unlock_slave_threads(mi); DBUG_VOID_RETURN; } From c31d71c065304b7cd1c237174da19a8d4270fb26 Mon Sep 17 00:00:00 2001 From: "reggie@linux.site" <> Date: Tue, 12 Jul 2005 10:31:09 -0600 Subject: [PATCH 06/13] Fixed some vio code that was using ___WIN__ instead of __WIN__ --- include/my_global.h | 2 +- sql/net_serv.cc | 2 +- vio/vio.c | 4 ++-- vio/viosocket.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index a7e6bba82b6..eab6050d2dc 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -797,7 +797,7 @@ typedef off_t os_off_t; #define socket_errno WSAGetLastError() #define SOCKET_EINTR WSAEINTR #define SOCKET_EAGAIN WSAEINPROGRESS -#define SOCKET_EWOULDBLOCK WSAEINPROGRESS +#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK #define SOCKET_ENFILE ENFILE #define SOCKET_EMFILE EMFILE #elif defined(OS2) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index bd4505a3d7f..9d84d0b2427 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -132,7 +132,7 @@ my_bool my_net_init(NET *net, Vio* vio) if (vio != 0) /* If real connection */ { net->fd = vio_fd(vio); /* For perl DBI/DBD */ -#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2) +#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) if (!(test_flags & TEST_BLOCKING)) { my_bool old_mode; diff --git a/vio/vio.c b/vio/vio.c index 978780d2632..4660efe3048 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -130,7 +130,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) sprintf(vio->desc, (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"), vio->sd); -#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(NO_FCNTL_NONBLOCK) #if defined(__FreeBSD__) fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */ @@ -145,7 +145,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) { /* set to blocking mode by default */ ulong arg=0, r; - r = ioctlsocket(sd,FIONBIO,(void*) &arg, sizeof(arg)); + r = ioctlsocket(sd,FIONBIO,(void*) &arg); vio->fcntl_mode &= ~O_NONBLOCK; } #endif diff --git a/vio/viosocket.c b/vio/viosocket.c index 904b75583a9..c7561890ead 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -82,7 +82,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d", (int) set_blocking_mode, (int) *old_mode)); -#if !defined(___WIN__) && !defined(__EMX__) +#if !defined(__WIN__) && !defined(__EMX__) #if !defined(NO_FCNTL_NONBLOCK) if (vio->sd >= 0) { @@ -115,7 +115,7 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, vio->fcntl_mode |= O_NONBLOCK; /* set bit */ } if (old_fcntl != vio->fcntl_mode) - r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg)); + r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg); } #ifndef __EMX__ else From db28fb113e4043627f525c88d899b8c684364b05 Mon Sep 17 00:00:00 2001 From: "igor@igor-inspiron.creware.com" <> Date: Tue, 12 Jul 2005 10:44:32 -0700 Subject: [PATCH 07/13] view.test, view.result: Expanded the test case for bug #6120 to cover DROP VIEW / CREATE VIEW scenario. sql_view.cc: Expanded the fix for bug #6120 to cover the case of DROP VIEW / CREATE_VIEW. --- mysql-test/r/view.result | 5 +++++ mysql-test/t/view.test | 3 +++ sql/sql_view.cc | 1 + 3 files changed, 9 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 3fd85cc883b..6d75d934cd9 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1945,6 +1945,11 @@ ALTER VIEW v1 AS SELECT s1 AS s1, s2 AS s2 FROM t1; CALL p1(); s1 s2 1 2 +DROP VIEW v1; +CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1; +CALL p1(); +s1 s2 +2 1 DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 2ccac059724..6cb6764b6c0 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1784,6 +1784,9 @@ CREATE PROCEDURE p1 () SELECT * FROM v1; CALL p1(); ALTER VIEW v1 AS SELECT s1 AS s1, s2 AS s2 FROM t1; CALL p1(); +DROP VIEW v1; +CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1; +CALL p1(); DROP PROCEDURE p1; DROP VIEW v1; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index d74b96de2cd..a60bf80a6d8 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1004,6 +1004,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) if (my_delete(path, MYF(MY_WME))) goto err; query_cache_invalidate3(thd, view, 0); + sp_cache_invalidate(); VOID(pthread_mutex_unlock(&LOCK_open)); } send_ok(thd); From de016ca78a732e65f55e040f12b5461ca2c1d27d Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Tue, 12 Jul 2005 23:22:08 +0400 Subject: [PATCH 08/13] Fix bug#11709 View was ordered by wrong column. When searching column to sort on, item was compared to field under view column, but not the column itself. Because names of view column and underlaid field may differ, it leads to possibly choosing wrong column for sorting on. This patch makes Item_direct_view_ref::eq(Item *item,...) compare item's name with it's own name proir to comparing to *ref item. --- mysql-test/r/view.result | 9 +++++++++ mysql-test/t/view.test | 9 +++++++++ sql/item.cc | 29 +++++++++++++++++++++++++++++ sql/item.h | 1 + 4 files changed, 48 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 7bcfaf8bdc3..bd4e94bd1b3 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1940,3 +1940,12 @@ s1 s2 DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; +create table t1 (f1 int, f2 int); +create view v1 as select f1 as f3, f2 as f1 from t1; +insert into t1 values (1,3),(2,1),(3,2); +select * from v1 order by f1; +f3 f1 +2 1 +3 2 +1 3 +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6b6b3d8a00f..6b4113c0b05 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1778,3 +1778,12 @@ CALL p1(); DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; + +# +# Test for bug #11709 View was ordered by wrong column +# +create table t1 (f1 int, f2 int); +create view v1 as select f1 as f3, f2 as f1 from t1; +insert into t1 values (1,3),(2,1),(3,2); +select * from v1 order by f1; +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index e53c1ebf734..08395df4b73 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4499,6 +4499,35 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) return Item_direct_ref::fix_fields(thd, reference); } +/* + Compare view field's name with item's name before call to referenced + item's eq() + + SYNOPSIS + Item_direct_view_ref::eq() + item item to compare with + binary_cmp make binary comparison + + DESCRIPTION + Consider queries: + create view v1 as select t1.f1 as f2, t1.f2 as f1 from t1; + select * from v1 order by f1; + In order to choose right field for sorting we need to compare + given item's name (f1) to view field's name prior to calling + referenced item's eq(). + + RETURN + TRUE Referenced item is equal to given item + FALSE otherwise +*/ + + +bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const +{ + Item *it= ((Item *) item)->real_item(); + return (!it->name || !my_strcasecmp(system_charset_info, it->name, + field_name)) && ref && (*ref)->real_item()->eq(it, binary_cmp); +} void Item_null_helper::print(String *str) { diff --git a/sql/item.h b/sql/item.h index 560f1124fb4..f748286b2f7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1516,6 +1516,7 @@ public: :Item_direct_ref(thd, item) {} bool fix_fields(THD *, Item **); + bool eq(const Item *item, bool binary_cmp) const; }; From d72f1c9b0c0699b9b64e7e5cfcdd54b31e2bf198 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Wed, 13 Jul 2005 04:10:19 +0400 Subject: [PATCH 09/13] view.result, view.test: Fix for test case for bug#11709 --- mysql-test/r/view.result | 1 + mysql-test/t/view.test | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index f9843d40f07..3d4c8e1ae6f 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1956,6 +1956,7 @@ f3 f1 2 1 3 2 1 3 +drop view v1; drop table t1; CREATE TABLE t1 (f1 char) ENGINE = innodb; INSERT INTO t1 VALUES ('A'); diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6b10edc7abd..956c705de74 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1796,6 +1796,7 @@ create table t1 (f1 int, f2 int); create view v1 as select f1 as f3, f2 as f1 from t1; insert into t1 values (1,3),(2,1),(3,2); select * from v1 order by f1; +drop view v1; drop table t1; # From 30b76e5d78ad265a55e4977abcb9ed289cc1235d Mon Sep 17 00:00:00 2001 From: "lars@mysql.com" <> Date: Wed, 13 Jul 2005 04:00:55 +0200 Subject: [PATCH 10/13] Manual merge --- sql/slave.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index 33f27064aab..c6c0de7160b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4968,7 +4968,6 @@ void rotate_relay_log(MASTER_INFO* mi) /* We don't lock rli->run_lock. This would lead to deadlocks. */ pthread_mutex_lock(&mi->run_lock); - pthread_mutex_lock(&mi->data_lock); /* We need to test inited because otherwise, new_file() will attempt to lock @@ -4998,7 +4997,6 @@ void rotate_relay_log(MASTER_INFO* mi) */ rli->relay_log.harvest_bytes_written(&rli->log_space_total); end: - pthread_mutex_unlock(&mi->data_lock); pthread_mutex_unlock(&mi->run_lock); DBUG_VOID_RETURN; } From 6da9cf09c90e377fb7f2480ba711c2d830104b2e Mon Sep 17 00:00:00 2001 From: "ramil@mysql.com" <> Date: Wed, 13 Jul 2005 11:49:54 +0500 Subject: [PATCH 11/13] a fix (bug #11808: Test case 'mysql_client_test' fails in assert 'double_data == o_double_data') --- tests/mysql_client_test.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b237387ef35..ffb848a6ef2 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -173,6 +173,14 @@ DIE_UNLESS(stmt == 0);\ #define mytest_r(x) if (x) {myerror(NULL);DIE_UNLESS(FALSE);} +/* A workaround for Sun Forte 5.6 on Solaris x86 */ + +static int cmp_double(double *a, double *b) +{ + return *a == *b; +} + + /* Print the error message */ static void print_error(const char *msg) @@ -1645,7 +1653,7 @@ static void test_prepare() DIE_UNLESS(real_data == o_real_data); DIE_UNLESS(length[5] == 4); - DIE_UNLESS(double_data == o_double_data); + DIE_UNLESS(cmp_double(&double_data, &o_double_data)); DIE_UNLESS(length[6] == 8); DIE_UNLESS(strcmp(data, str_data) == 0); @@ -9858,7 +9866,7 @@ static void test_bug3035() uint32 uint32_val; longlong int64_val; ulonglong uint64_val; - double double_val, udouble_val; + double double_val, udouble_val, double_tmp; char longlong_as_string[22], ulonglong_as_string[22]; /* mins and maxes */ @@ -10005,7 +10013,8 @@ static void test_bug3035() DIE_UNLESS(int64_val == int64_min); DIE_UNLESS(uint64_val == uint64_min); DIE_UNLESS(double_val == (longlong) uint64_min); - DIE_UNLESS(udouble_val == ulonglong2double(uint64_val)); + double_tmp= ulonglong2double(uint64_val); + DIE_UNLESS(cmp_double(&udouble_val, &double_tmp)); DIE_UNLESS(!strcmp(longlong_as_string, "0")); DIE_UNLESS(!strcmp(ulonglong_as_string, "0")); @@ -10029,7 +10038,8 @@ static void test_bug3035() DIE_UNLESS(int64_val == int64_max); DIE_UNLESS(uint64_val == uint64_max); DIE_UNLESS(double_val == (longlong) uint64_val); - DIE_UNLESS(udouble_val == ulonglong2double(uint64_val)); + double_tmp= ulonglong2double(uint64_val); + DIE_UNLESS(cmp_double(&udouble_val, &double_tmp)); DIE_UNLESS(!strcmp(longlong_as_string, "-1")); DIE_UNLESS(!strcmp(ulonglong_as_string, "18446744073709551615")); From 9c3349f5c6a5521a7474d5c12f39b9cdae1d552e Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Wed, 13 Jul 2005 13:30:39 +0500 Subject: [PATCH 12/13] Fix for bug#11685 SHOW TABLES; doesn't update Com_show_tables --- mysql-test/r/information_schema.result | 2 +- sql/sql_parse.cc | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index ffc5f5102a4..98f3d59485f 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -674,7 +674,7 @@ Database Table In_use Name_locked mysql user 0 0 show status where variable_name like "%database%"; Variable_name Value -Com_show_databases 0 +Com_show_databases 3 show variables where variable_name like "skip_show_databas"; Variable_name Value show global status like "Threads_running"; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ecaaa82553f..2fab847c4c3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2193,6 +2193,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, TABLE_LIST *table_list= (TABLE_LIST*) select_lex->table_list.first; table_list->schema_select_lex= sel; table_list->schema_table_reformed= 1; + statistic_increment(thd->status_var.com_stat[lex->orig_sql_command], + &LOCK_status); DBUG_RETURN(0); } @@ -2365,9 +2367,10 @@ mysql_execute_command(THD *thd) my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only"); DBUG_RETURN(-1); } + if(lex->orig_sql_command == SQLCOM_END) + statistic_increment(thd->status_var.com_stat[lex->sql_command], + &LOCK_status); - statistic_increment(thd->status_var.com_stat[lex->sql_command], - &LOCK_status); switch (lex->sql_command) { case SQLCOM_SELECT: { From a2ffbb55159e7f929b8f742201ec4ac629be19b9 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Wed, 13 Jul 2005 13:07:09 +0200 Subject: [PATCH 13/13] Bug #11903, make perl test script run ndbcluster tests by default --- mysql-test/mysql-test-run.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f16f9d00f5f..0bc32c9eaeb 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -287,6 +287,7 @@ sub executable_setup (); sub environment_setup (); sub kill_running_server (); sub kill_and_cleanup (); +sub ndbcluster_support (); sub ndbcluster_install (); sub ndbcluster_start (); sub ndbcluster_stop (); @@ -319,6 +320,12 @@ sub main () { initial_setup(); command_line_setup(); executable_setup(); + + if (! $opt_skip_ndbcluster and ! $opt_with_ndbcluster) + { + $opt_with_ndbcluster= ndbcluster_support(); + } + environment_setup(); signal_setup(); @@ -1026,6 +1033,23 @@ sub kill_and_cleanup () { # ############################################################################## +sub ndbcluster_support () { + + # check ndbcluster support by testing using a switch + # that is only available in that case + if ( mtr_run($exe_mysqld, + ["--no-defaults", + "--ndb-use-exact-count", + "--help"], + "", "/dev/null", "/dev/null", "") != 0 ) + { + mtr_report("No ndbcluster support"); + return 0; + } + mtr_report("Has ndbcluster support"); + return 1; +} + # FIXME why is there a different start below?! sub ndbcluster_install () {