mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed problem with BIGINT and shutdown on AIX
Moved IF(test,column,NULL) code to 4.0 Changed mysys_priv.h to include my_pthread.h or my_no_pthread.h. Removed some CR's in os2 files. Docs/manual.texi: Changelog include/global.h: Fix for BIGINT problem on AIX include/my_no_pthread.h: Fixed typo libmysql/Makefile.shared: Fix for BIGINT problem on AIX mysql-test/mysql-test-run.sh: Fix to find xterm on AIX 4.3 mysql-test/r/bigint.result: Fix for BIGINT problem on AIX mysql-test/r/func_if.result: Change results for IF() after reverting change. mysql-test/t/bigint.test: Fix for BIGINT problem on AIX mysys/Makefile.am: Fix for BIGINT problem on AIX mysys/my_gethostbyname.c: Cleanup mysys/my_init.c: Cleanup mysys/my_net.c: Cleanup mysys/my_os2cond.c: Space & CRLF cleanup mysys/my_os2dirsrch.c: Space & CRLF cleanup mysys/my_os2dirsrch.h: Space & CRLF cleanup mysys/my_os2dlfcn.c: Space & CRLF cleanup mysys/my_os2file64.c: Space & CRLF cleanup mysys/my_os2mutex.c: Space & CRLF cleanup mysys/my_os2thread.c: Space & CRLF cleanup mysys/my_os2tls.c: Space & CRLF cleanup mysys/mysys_priv.h: cleanup mysys/thr_rwlock.c: cleanup sql/ha_innobase.cc: Removed usage of sprintf() Fixed missing end \0 which caused control characters to appear in SHOW INNODB STATUS sql/item_cmpfunc.cc: Reverted change for IF() sql/mysqld.cc: Fix for shutdown on AIX
This commit is contained in:
@ -46928,9 +46928,10 @@ not yet 100% confident in this code.
|
||||
@appendixsubsec Changes in release 3.23.52
|
||||
@itemize @bullet
|
||||
@item
|
||||
Changed behaviour that @code{IF(condition,column,NULL)} returns column type
|
||||
Fixed problem with @code{UNSIGNED BIGINT} on AIX.
|
||||
@item
|
||||
Fixed a security bug with empty db column in db table
|
||||
Fixed security bug when having an empty databasename in the @code{user.db}
|
||||
table.
|
||||
@item
|
||||
Changed initialisation of @code{RND()} to make it less predicatable.
|
||||
@item
|
||||
|
@ -104,6 +104,8 @@
|
||||
#define _H_STRINGS
|
||||
#define _SYS_STREAM_H
|
||||
#define _AIX32_CURSES
|
||||
#define longlong2double(A) my_longlong2double(A)
|
||||
double my_longlong2double(unsigned long long A);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
|
||||
|
@ -21,7 +21,7 @@
|
||||
environment, easier to use.
|
||||
*/
|
||||
|
||||
#if !defined(_my_no_pthread_h) && !defined(THREADS)
|
||||
#if !defined(_my_no_pthread_h) && !defined(THREAD)
|
||||
#define _my_no_pthread_h
|
||||
|
||||
#define pthread_mutex_init(A,B)
|
||||
|
@ -57,7 +57,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
|
||||
thr_mutex.lo mulalloc.lo string.lo default.lo \
|
||||
my_compress.lo array.lo my_once.lo list.lo my_net.lo \
|
||||
charset.lo hash.lo mf_iocache.lo my_seek.lo \
|
||||
my_pread.lo mf_cache.lo my_gethostbyname.lo
|
||||
my_pread.lo mf_cache.lo my_gethostbyname.lo my_port.lo
|
||||
# Not needed in the minimum library
|
||||
mysysobjects2 = getopt.lo getopt1.lo getvar.lo my_lib.lo
|
||||
mysysobjects = $(mysysobjects1) $(mysysobjects2)
|
||||
|
@ -18,7 +18,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
|
||||
# Program Definitions
|
||||
#--
|
||||
|
||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin
|
||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/bin/X11
|
||||
|
||||
# Standard functions
|
||||
|
||||
|
@ -10,4 +10,6 @@ a
|
||||
a
|
||||
18446744073709551615
|
||||
a
|
||||
18446744073709551615
|
||||
a
|
||||
18446744073709551614
|
||||
|
@ -34,4 +34,4 @@ aaa
|
||||
sum(if(num is null,0.00,num))
|
||||
144.54
|
||||
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
|
||||
6 56
|
||||
16 6
|
||||
|
@ -5,12 +5,18 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
|
||||
select 9223372036854775807,-009223372036854775808;
|
||||
select +9999999999999999999,-9999999999999999999;
|
||||
|
||||
#
|
||||
# In 3.23 we have to disable the test of column to bigint as
|
||||
# this fails on AIX powerpc (the resolution for double is not good enough)
|
||||
# This will work on 4.0 as we then have internal handling of bigint variables.
|
||||
#
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned not null, primary key(a));
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
||||
select * from t1;
|
||||
select * from t1 where a=18446744073709551615;
|
||||
#select * from t1 where a='18446744073709551615';
|
||||
select * from t1 where a='18446744073709551615';
|
||||
delete from t1 where a=18446744073709551615;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -49,7 +49,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
|
||||
my_quick.c my_lockmem.c my_static.c \
|
||||
getopt.c getopt1.c getvar.c my_mkdir.c \
|
||||
default.c my_compress.c checksum.c raid.cc raid2.c \
|
||||
my_net.c \
|
||||
my_net.c my_port.c \
|
||||
my_vsnprintf.c charset.c my_bitmap.c my_gethostbyname.c
|
||||
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
|
||||
thr_mutex.c thr_rwlock.c
|
||||
|
@ -18,7 +18,6 @@
|
||||
/* Thread safe version of gethostbyname_r() */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#include "my_pthread.h"
|
||||
#include <assert.h>
|
||||
#if !defined(MSDOS) && !defined(__WIN__)
|
||||
#include <netdb.h>
|
||||
@ -28,11 +27,6 @@
|
||||
/* This file is not needed if my_gethostbyname_r is a macro */
|
||||
#if !defined(my_gethostbyname_r)
|
||||
|
||||
#ifndef THREAD
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Emulate SOLARIS style calls, not because it's better, but just to make the
|
||||
usage of getbostbyname_r simpler.
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include "m_ctype.h"
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
#include <sys/resource.h>
|
||||
/* extern int getrusage(int, struct rusage *); */
|
||||
|
@ -34,11 +34,6 @@
|
||||
#endif
|
||||
#endif /* !defined(MSDOS) && !defined(__WIN__) */
|
||||
|
||||
#ifndef THREAD
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
#endif
|
||||
|
||||
void my_inet_ntoa(struct in_addr in, char *buf)
|
||||
{
|
||||
char *ptr;
|
||||
|
40
mysys/my_port.c
Normal file
40
mysys/my_port.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/*
|
||||
Small functions to make code portable
|
||||
*/
|
||||
|
||||
#include "mysys_priv.h"
|
||||
|
||||
#ifdef _AIX
|
||||
|
||||
/*
|
||||
On AIX, at least with gcc 3.1, the expression
|
||||
'(double) (ulonglong) var' doesn't always work for big unsigned
|
||||
integers like '18446744073709551615'. The end result is that the
|
||||
high bit is simply dropped. (probably bug in gcc optimizations)
|
||||
Handling the conversion in a sub function seems to work.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
double my_longlong2double(unsigned long long nr)
|
||||
{
|
||||
return (double) nr;
|
||||
}
|
||||
#endif /* _AIX */
|
@ -23,10 +23,10 @@
|
||||
#endif
|
||||
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
|
||||
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
|
||||
extern pthread_mutex_t LOCK_bitmap;
|
||||
#else /* THREAD */
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
#else
|
||||
#include <my_no_pthread.h>
|
||||
#endif
|
||||
|
@ -18,7 +18,6 @@
|
||||
/* Synchronization - readers / writer thread locks */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#include <my_pthread.h>
|
||||
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
|
||||
|
||||
/*
|
||||
|
@ -267,43 +267,6 @@ innobase_mysql_print_thd(
|
||||
|
||||
thd = (THD*) input_thd;
|
||||
|
||||
buf += sprintf(buf, "MySQL thread id %lu, query id %lu",
|
||||
thd->thread_id, thd->query_id);
|
||||
if (thd->host) {
|
||||
buf += sprintf(buf, " %.30s", thd->host);
|
||||
}
|
||||
|
||||
if (thd->ip) {
|
||||
buf += sprintf(buf, " %.20s", thd->ip);
|
||||
}
|
||||
|
||||
if (thd->user) {
|
||||
buf += sprintf(buf, " %.20s", thd->user);
|
||||
}
|
||||
|
||||
if (thd->proc_info) {
|
||||
buf += sprintf(buf, " %.50s", thd->proc_info);
|
||||
}
|
||||
|
||||
if (thd->query) {
|
||||
buf += sprintf(buf, "\n%.150s", thd->query);
|
||||
}
|
||||
|
||||
buf += sprintf(buf, "\n");
|
||||
|
||||
#ifdef notdefined
|
||||
/* August 8, 2002
|
||||
Revert these changes because they make control characters sometimes
|
||||
appear in the output and scramble it:
|
||||
the reason is that the last character of the ouptput will be
|
||||
'\n', not the null character '\0'. We do not know where the output
|
||||
ends in buf!
|
||||
|
||||
On platforms (what are those?) where sprintf does not work
|
||||
we should define sprintf as 'my_emulated_sprintf'; InnoDB code
|
||||
contains lots of sprintfs, it does not help to remove them from
|
||||
just a single file. */
|
||||
|
||||
/* We can't use value of sprintf() as this is not portable */
|
||||
buf+= my_sprintf(buf,
|
||||
(buf, "MySQL thread id %lu",
|
||||
@ -337,9 +300,8 @@ innobase_mysql_print_thd(
|
||||
*buf++='\n';
|
||||
buf=strnmov(buf, thd->query, 150);
|
||||
}
|
||||
*buf='\n';
|
||||
/* Here we should add '\0' to the end of output to mark its end */
|
||||
#endif
|
||||
buf[0]='\n';
|
||||
buf[1]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,12 +494,7 @@ Item_func_if::fix_length_and_dec()
|
||||
decimals=max(args[1]->decimals,args[2]->decimals);
|
||||
enum Item_result arg1_type=args[1]->result_type();
|
||||
enum Item_result arg2_type=args[2]->result_type();
|
||||
bool null1=args[1]->null_value;
|
||||
bool null2=args[2]->null_value;
|
||||
if (null1 && !null2)
|
||||
arg1_type=arg2_type;
|
||||
else if (!null1 && null2)
|
||||
arg2_type=arg1_type;
|
||||
|
||||
binary=1;
|
||||
if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
|
||||
{
|
||||
|
@ -43,6 +43,8 @@
|
||||
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
|
||||
#define HAVE_CLOSE_SERVER_SOCK 1
|
||||
void close_server_sock();
|
||||
#else
|
||||
#define close_server_sock()
|
||||
#endif
|
||||
|
||||
extern "C" { // Because of SCO 3.2V4.2
|
||||
@ -465,9 +467,7 @@ static void close_connections(void)
|
||||
if (error != 0 && !count++)
|
||||
sql_print_error("Got error %d from pthread_cond_timedwait",error);
|
||||
#endif
|
||||
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
|
||||
close_server_sock();
|
||||
#endif
|
||||
}
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
#endif /* __WIN__ */
|
||||
@ -598,18 +598,26 @@ if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
|
||||
void close_server_sock()
|
||||
{
|
||||
DBUG_ENTER("close_server_sock");
|
||||
|
||||
if (ip_sock != INVALID_SOCKET)
|
||||
{
|
||||
DBUG_PRINT("info",("closing TCP/IP socket"));
|
||||
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
|
||||
VOID(shutdown(ip_sock,2));
|
||||
#ifdef NOT_USED
|
||||
/*
|
||||
The following code is disabled as it cases MySQL to hang on
|
||||
AIX 4.3 during shutdown
|
||||
*/
|
||||
DBUG_PRINT("info",("calling closesocket on TCP/IP socket"));
|
||||
VOID(closesocket(ip_sock));
|
||||
#endif
|
||||
ip_sock=INVALID_SOCKET;
|
||||
}
|
||||
if (unix_sock != INVALID_SOCKET)
|
||||
{
|
||||
DBUG_PRINT("info",("closing Unix socket"));
|
||||
DBUG_PRINT("info",("calling shutdown on unix socket"));
|
||||
VOID(shutdown(unix_sock,2));
|
||||
VOID(closesocket(unix_sock));
|
||||
DBUG_PRINT("info",("calling closesocket on unix socket"));
|
||||
VOID(unlink(mysql_unix_port));
|
||||
unix_sock=INVALID_SOCKET;
|
||||
}
|
||||
@ -621,7 +629,8 @@ void kill_mysql(void)
|
||||
{
|
||||
DBUG_ENTER("kill_mysql");
|
||||
#ifdef SIGNALS_DONT_BREAK_READ
|
||||
close_server_sock(); /* force accept to wake up */
|
||||
abort_loop=1; // Break connection loops
|
||||
close_server_sock(); // Force accept to wake up
|
||||
#endif
|
||||
#if defined(__WIN__)
|
||||
{
|
||||
@ -647,10 +656,9 @@ void kill_mysql(void)
|
||||
DBUG_PRINT("quit",("After pthread_kill"));
|
||||
shutdown_in_progress=1; // Safety if kill didn't work
|
||||
#ifdef SIGNALS_DONT_BREAK_READ
|
||||
if (!abort_loop)
|
||||
if (!kill_in_progress)
|
||||
{
|
||||
pthread_t tmp;
|
||||
abort_loop=1;
|
||||
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
|
||||
(void*) 0))
|
||||
sql_print_error("Error: Can't create thread to kill server");
|
||||
@ -1220,7 +1228,7 @@ static void sig_reload(int signo)
|
||||
|
||||
static void sig_kill(int signo)
|
||||
{
|
||||
if (!abort_loop)
|
||||
if (!kill_in_progress)
|
||||
{
|
||||
abort_loop=1; // mark abort for threads
|
||||
kill_server((void*) signo);
|
||||
|
Reference in New Issue
Block a user