Commit 96f2e21e authored by unknown's avatar unknown

Fixed bug in blocking handling when compiling with OPENSSL (caused hangup in client code)

Fixed bug in SELECT DISTINCT ... ORDER BY not-used-column.
Fixed bug in pthread_mutex_trylock with HPUX 11.0


Docs/manual.texi:
  Changelog
include/my_pthread.h:
  Fix for pthread_mutex_trylock when used with SAFEMUTEX
include/violite.h:
  Fixed bug in blocking handling when compiling with OPENSSL (caused hangup in client code)
innobase/buf/buf0buf.c:
  Fixed wrong format string
libmysqld/lib_sql.cc:
  Fixed hangup in embedded server.
mysql-test/r/distinct.result:
  Fixed bug in SELECT DISTINCT ... ORDER BY not-used-column
mysql-test/t/distinct.test:
  Fixed bug in SELECT DISTINCT ... ORDER BY not-used-column
mysys/my_pthread.c:
  Cleanup of pthread_xxx rewrite code.
  Fixed bug in pthread_mutex_trylock with HPUX 11.0
sql/gen_lex_hash.cc:
  Smaller hash array
sql/mysqld.cc:
  Fixed hangup in embedded server.
sql/sql_select.cc:
  Fixed bug in SELECT DISTINCT ... ORDER BY not-used-column
vio/vio.c:
  Added vio_ssl_blocking
vio/viossl.c:
  Added vio_ssl_blocking
parent 7139794e
......@@ -50257,6 +50257,9 @@ each individual 4.0.x release.
@itemize @bullet
@item
Fixed bug in @code{SELECT DISTINCT ... FROM many_tables ORDER BY
not-used-column}.
@item
Added @code{QUOTE()} function that performs SQL quoting to produce values
that can be used as data values in queries.
@item
......@@ -430,11 +430,14 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime);
#endif
#if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#undef pthread_mutex_trylock
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
......
......@@ -137,8 +137,6 @@ void vio_ssl_delete(Vio* vio);
int vio_ssl_read(Vio* vio,gptr buf, int size);
int vio_ssl_write(Vio* vio,const gptr buf,int size);
int vio_ssl_blocking(Vio* vio,my_bool onoff);
my_bool vio_ssl_is_blocking(Vio* vio);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
int vio_ssl_fastsend(Vio* vio);
......@@ -152,6 +150,7 @@ int vio_ssl_close(Vio* vio);
int vio_ssl_errno(Vio *vio);
my_bool vio_ssl_peer_addr(Vio* vio, char *buf);
void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
int vio_ssl_blocking(Vio * vio, my_bool set_blocking_mode, my_bool *old_mode);
/* Single copy for server */
enum vio_ssl_acceptorfd_state
......
......@@ -285,7 +285,7 @@ buf_page_print(
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Page dump in ascii and hex (%u bytes):\n%s",
" InnoDB: Page dump in ascii and hex (%lu bytes):\n%s",
(ulint)UNIV_PAGE_SIZE, buf);
fprintf(stderr, "InnoDB: End of page dump\n");
......
......@@ -551,9 +551,14 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
sql_print_error("Warning: Can't create thread to manage maintenance");
}
/* Update mysqld variables from client variables */
global_system_variables.max_allowed_packet=max_allowed_packet;
global_system_variables.net_buffer_length=net_buffer_length;
/*
Update mysqld variables from client variables if set
The client variables are set also by get_one_option() in mysqld.cc
*/
if (max_allowed_packet)
global_system_variables.max_allowed_packet= max_allowed_packet;
if (net_buffer_length)
global_system_variables.net_buffer_length= net_buffer_length;
return 0;
}
......
......@@ -349,3 +349,33 @@ select distinct a from t1 where a >= '1' order by a desc;
a
1
drop table t1;
CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
DATETIME);
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
INSERT INTO t1 (email, infoID, dateentered) VALUES
('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
('test3@testdomain.com', 1, '2002-05-19 22:17:32');
INSERT INTO t2(infoID, shipcode) VALUES
(1, 'Z001'),
(2, 'R002');
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
email shipcode
test1@testdomain.com Z001
test2@testdomain.com Z001
test3@testdomain.com Z001
test2@testdomain.com R002
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
email
test1@testdomain.com
test2@testdomain.com
test3@testdomain.com
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
email shipcode
test1@testdomain.com Z001
test2@testdomain.com Z001
test2@testdomain.com R002
test3@testdomain.com Z001
drop table t1,t2;
......@@ -218,3 +218,27 @@ select * from t1 where a >= '1';
select distinct a from t1 order by a desc;
select distinct a from t1 where a >= '1' order by a desc;
drop table t1;
#
# Test when using a not previously used column in ORDER BY
#
CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
DATETIME);
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
INSERT INTO t1 (email, infoID, dateentered) VALUES
('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
('test3@testdomain.com', 1, '2002-05-19 22:17:32');
INSERT INTO t2(infoID, shipcode) VALUES
(1, 'Z001'),
(2, 'R002');
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
drop table t1,t2;
......@@ -17,6 +17,7 @@
/* Functions to get threads more portable */
#define DONT_REMAP_PTHREAD_FUNCTIONS
#include "mysys_priv.h"
#ifdef THREAD
#include <signal.h>
......@@ -372,16 +373,33 @@ int pthread_signal(int sig, void (*func)())
sigaction(sig, &sact, (struct sigaction*) 0);
return 0;
}
#endif
/****************************************************************************
The following functions fixes that all pthread functions should work
according to latest posix standard
****************************************************************************/
/* Undefined wrappers set my_pthread.h so that we call os functions */
#undef pthread_mutex_init
#undef pthread_mutex_lock
#undef pthread_mutex_unlock
#undef pthread_mutex_destroy
#undef pthread_mutex_wait
#undef pthread_mutex_timedwait
#undef pthread_mutex_t
#undef pthread_cond_wait
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#undef pthread_mutex_t
#undef pthread_cond_t
/*****************************************************************************
** Patches for AIX and DEC OSF/1 3.2
*****************************************************************************/
#if (defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) && !defined(HAVE_UNIXWARE7_THREADS)) || defined(HAVE_DEC_3_2_THREADS)
#undef pthread_mutex_init
#undef pthread_cond_init
#include <netdb.h>
......@@ -419,7 +437,6 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
****************************************************************************/
#if defined(HPUX) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
#undef pthread_cond_timedwait
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
......@@ -462,13 +479,13 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
RETURN VALUES
0 If we are able successfully lock the mutex.
EBUSY Mutex was locked by another thread
!= errno set by pthread_mutex_trylock()
# Other error number returned by pthread_mutex_trylock()
(Not likely)
*/
#undef pthread_mutex_trylock
int my_pthread_mutex_trylock(pthread_mutex_t *mutex)
{
int error=pthread_mutex_trylock(mutex);
int error= pthread_mutex_trylock(mutex);
if (error == 1)
return 0; /* Got lock on mutex */
if (error == 0) /* Someon else is locking mutex */
......
......@@ -73,15 +73,6 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"version", 'V', "Output version information and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"rnd1", 'r', "Set 1 part of rnd value for hash generator",
(gptr*) &best_t1, (gptr*) &best_t1, 0, GET_ULONG, REQUIRED_ARG, 5075635L,
0, 0, 0, 0, 0},
{"rnd2", 'R', "Set 2 part of rnd value for hash generator",
(gptr*) &best_t2, (gptr*) &best_t2, 0, GET_ULONG, REQUIRED_ARG, 1345933L,
0, 0, 0, 0, 0},
{"type", 't', "Set type of char table to generate",
(gptr*) &best_type, (gptr*) &best_type, 0, GET_UINT, REQUIRED_ARG, 4, 0, 0,
0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
......@@ -478,8 +469,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
start_value=3807640L; /* mode=6971 add=3 type: 0 */
start_value=7281255L; best_t1=4459515L; best_t2=321142L; best_type=2; /* mode=5953 add=7 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
......
......@@ -3970,6 +3970,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
safemalloc_mem_limit = atoi(argument);
#endif
break;
#ifdef EMBEDDED_LIBRARY
case OPT_MAX_ALLOWED_PACKET:
max_allowed_packet= atoi(argument);
break;
case OPT_NET_BUFFER_LENGTH:
net_buffer_length= atoi(argument);
break;
#endif
case 'v':
case 'V':
print_version();
......
......@@ -641,6 +641,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
DBUG_PRINT("info",("Creating tmp table"));
thd->proc_info="Creating tmp table";
join.tmp_table_param.hidden_field_count=(all_fields.elements-
fields.elements);
if (!(tmp_table =
create_tmp_table(thd,&join.tmp_table_param,all_fields,
((!simple_group && !procedure &&
......@@ -3862,6 +3864,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
'param->hidden_field_count' extra columns, whose null bits are stored
in the first 'hidden_null_pack_length' bytes of the row.
*/
DBUG_PRINT("info",("hidden_field_count: %d", param->hidden_field_count));
null_pack_length-=hidden_null_pack_length;
keyinfo->key_parts= ((field_count-param->hidden_field_count)+
test(null_pack_length));
......@@ -3884,7 +3888,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
goto err;
table->key_info=keyinfo;
keyinfo->key_part=key_part_info;
keyinfo->flags=HA_NOSAME|HA_NULL_ARE_EQUAL;
keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL;
keyinfo->key_length=(uint16) reclength;
keyinfo->name=(char*) "tmp";
if (null_pack_length)
......
......@@ -60,7 +60,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->vioclose =vio_ssl_close;
vio->peer_addr =vio_ssl_peer_addr;
vio->in_addr =vio_ssl_in_addr;
vio->vioblocking =vio_blocking;
vio->vioblocking =vio_ssl_blocking;
vio->is_blocking =vio_is_blocking;
}
else /* default is VIO_TYPE_TCPIP */
......
......@@ -362,4 +362,14 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
DBUG_VOID_RETURN;
}
int vio_ssl_blocking(Vio * vio __attribute__((unused)),
my_bool set_blocking_mode,
my_bool *old_mode)
{
/* Return error if we try to change to non_blocking mode */
*old_mode=1; /* Mode is always blocking */
return set_blocking_mode ? 0 : 1;
}
#endif /* HAVE_OPENSSL */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment