mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge with 3.23.52
This commit is contained in:
@ -50881,7 +50881,10 @@ not yet 100% confident in this code.
|
|||||||
@appendixsubsec Changes in release 3.23.52
|
@appendixsubsec Changes in release 3.23.52
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
Fixed a security bug with empty db column in db table
|
Fixed problem with @code{UNSIGNED BIGINT} on AIX.
|
||||||
|
@item
|
||||||
|
Fixed security bug when having an empty databasename in the @code{user.db}
|
||||||
|
table.
|
||||||
@item
|
@item
|
||||||
Changed initialisation of @code{RND()} to make it less predicatable.
|
Changed initialisation of @code{RND()} to make it less predicatable.
|
||||||
@item
|
@item
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
environment, easier to use.
|
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 _my_no_pthread_h
|
||||||
|
|
||||||
#define pthread_mutex_init(A,B)
|
#define pthread_mutex_init(A,B)
|
||||||
|
@ -158,22 +158,21 @@ extern my_string my_strdup(const char *from,myf MyFlags);
|
|||||||
#define CALLER_INFO /* nothing */
|
#define CALLER_INFO /* nothing */
|
||||||
#define ORIG_CALLER_INFO /* nothing */
|
#define ORIG_CALLER_INFO /* nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ALLOCA
|
#ifdef HAVE_ALLOCA
|
||||||
#ifdef __GNUC__
|
#if defined(_AIX) && !defined(__GNUC__)
|
||||||
/* Remove any previous definitions. */
|
|
||||||
#undef alloca
|
|
||||||
#define alloca(size) __builtin_alloca (size)
|
|
||||||
#else /* xlc */
|
|
||||||
#ifdef _AIX
|
|
||||||
#pragma alloca
|
#pragma alloca
|
||||||
#endif /* _AIX */
|
#endif /* _AIX */
|
||||||
#endif /* __GNUC__ */
|
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H)
|
||||||
|
#define alloca __builtin_alloca
|
||||||
|
#endif /* GNUC */
|
||||||
#define my_alloca(SZ) alloca((size_t) (SZ))
|
#define my_alloca(SZ) alloca((size_t) (SZ))
|
||||||
#define my_afree(PTR) {}
|
#define my_afree(PTR) {}
|
||||||
#else
|
#else
|
||||||
#define my_alloca(SZ) my_malloc(SZ,MYF(0))
|
#define my_alloca(SZ) my_malloc(SZ,MYF(0))
|
||||||
#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
|
#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
|
||||||
#endif /* HAVE_ALLOCA */
|
#endif /* HAVE_ALLOCA */
|
||||||
|
|
||||||
#ifdef MSDOS
|
#ifdef MSDOS
|
||||||
#ifdef __ZTC__
|
#ifdef __ZTC__
|
||||||
void * __CDECL halloc(long count,size_t length);
|
void * __CDECL halloc(long count,size_t length);
|
||||||
|
@ -70,7 +70,9 @@ os_thread_create(
|
|||||||
void* arg, /* in: argument to start
|
void* arg, /* in: argument to start
|
||||||
function */
|
function */
|
||||||
os_thread_id_t* thread_id); /* out: id of created
|
os_thread_id_t* thread_id); /* out: id of created
|
||||||
thread */
|
thread; currently this is
|
||||||
|
identical to the handle to
|
||||||
|
the thread */
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
A thread calling this function ends its execution. */
|
A thread calling this function ends its execution. */
|
||||||
|
|
||||||
|
@ -117,6 +117,13 @@ void
|
|||||||
trx_start_if_not_started(
|
trx_start_if_not_started(
|
||||||
/*=====================*/
|
/*=====================*/
|
||||||
trx_t* trx); /* in: transaction */
|
trx_t* trx); /* in: transaction */
|
||||||
|
/*****************************************************************
|
||||||
|
Starts the transaction if it is not yet started. */
|
||||||
|
|
||||||
|
void
|
||||||
|
trx_start_if_not_started_noninline(
|
||||||
|
/*===============================*/
|
||||||
|
trx_t* trx); /* in: transaction */
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Commits a transaction. */
|
Commits a transaction. */
|
||||||
|
|
||||||
@ -262,7 +269,7 @@ void
|
|||||||
trx_print(
|
trx_print(
|
||||||
/*======*/
|
/*======*/
|
||||||
char* buf, /* in/out: buffer where to print, must be at least
|
char* buf, /* in/out: buffer where to print, must be at least
|
||||||
500 bytes */
|
800 bytes */
|
||||||
trx_t* trx); /* in: transaction */
|
trx_t* trx); /* in: transaction */
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +63,12 @@ Microsoft Visual C++ */
|
|||||||
#define HAVE_PWRITE
|
#define HAVE_PWRITE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Apparently in some old SCO Unixes the return type of sprintf is not
|
||||||
|
an integer as it should be according to the modern Posix standard. Because
|
||||||
|
of that we define sprintf inside InnoDB code as our own function ut_sprintf */
|
||||||
|
#undef sprintf
|
||||||
|
#define sprintf ut_sprintf
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* DEBUG VERSION CONTROL
|
/* DEBUG VERSION CONTROL
|
||||||
|
@ -17,6 +17,18 @@ Created 1/20/1994 Heikki Tuuri
|
|||||||
|
|
||||||
typedef time_t ib_time_t;
|
typedef time_t ib_time_t;
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
Uses vsprintf to emulate sprintf so that the function always returns
|
||||||
|
the printed length. Apparently in some old SCO Unixes sprintf did not
|
||||||
|
return the printed length but a pointer to the end of the printed string. */
|
||||||
|
|
||||||
|
ulint
|
||||||
|
ut_sprintf(
|
||||||
|
/*=======*/
|
||||||
|
char* buf, /* in/out: buffer where to print */
|
||||||
|
const char* format, /* in: format of prints */
|
||||||
|
...); /* in: arguments to be printed */
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
|
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
|
||||||
but since there seem to be compiler bugs in both gcc and Visual C++,
|
but since there seem to be compiler bugs in both gcc and Visual C++,
|
||||||
|
@ -2755,6 +2755,8 @@ lock_deadlock_occurs(
|
|||||||
err_buf += sprintf(err_buf,
|
err_buf += sprintf(err_buf,
|
||||||
"*** WE ROLL BACK TRANSACTION (2)\n");
|
"*** WE ROLL BACK TRANSACTION (2)\n");
|
||||||
|
|
||||||
|
ut_a(strlen(lock_latest_err_buf) < 4100);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sess_raise_error_low(trx, DB_DEADLOCK, lock->type_mode, table,
|
sess_raise_error_low(trx, DB_DEADLOCK, lock->type_mode, table,
|
||||||
index, NULL, NULL, NULL);
|
index, NULL, NULL, NULL);
|
||||||
@ -3626,7 +3628,7 @@ lock_print_info(
|
|||||||
trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
|
trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
|
||||||
|
|
||||||
while (trx) {
|
while (trx) {
|
||||||
if (buf_end - buf < 600) {
|
if (buf_end - buf < 900) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3663,7 +3665,7 @@ loop:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf_end - buf < 600) {
|
if (buf_end - buf < 900) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,17 +97,20 @@ os_thread_create(
|
|||||||
function */
|
function */
|
||||||
os_thread_id_t* thread_id __attribute__((unused)))
|
os_thread_id_t* thread_id __attribute__((unused)))
|
||||||
/* out: id of created
|
/* out: id of created
|
||||||
thread */
|
thread; currently this is
|
||||||
|
identical to the handle to
|
||||||
|
the thread */
|
||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
os_thread_t thread;
|
os_thread_t thread;
|
||||||
|
ulint win_thread_id;
|
||||||
|
|
||||||
thread = CreateThread(NULL, /* no security attributes */
|
thread = CreateThread(NULL, /* no security attributes */
|
||||||
0, /* default size stack */
|
0, /* default size stack */
|
||||||
(LPTHREAD_START_ROUTINE)start_f,
|
(LPTHREAD_START_ROUTINE)start_f,
|
||||||
arg,
|
arg,
|
||||||
0, /* thread runs immediately */
|
0, /* thread runs immediately */
|
||||||
thread_id);
|
&win_thread_id);
|
||||||
|
|
||||||
if (srv_set_thread_priorities) {
|
if (srv_set_thread_priorities) {
|
||||||
|
|
||||||
@ -118,6 +121,8 @@ os_thread_create(
|
|||||||
ut_a(SetThreadPriority(thread, srv_query_thread_priority));
|
ut_a(SetThreadPriority(thread, srv_query_thread_priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*thread_id = thread;
|
||||||
|
|
||||||
return(thread);
|
return(thread);
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
@ -135,6 +140,8 @@ os_thread_create(
|
|||||||
my_pthread_setprio(pthread, srv_query_thread_priority);
|
my_pthread_setprio(pthread, srv_query_thread_priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*thread_id = pthread;
|
||||||
|
|
||||||
return(pthread);
|
return(pthread);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2228,6 +2228,7 @@ srv_sprintf_innodb_monitor(
|
|||||||
|
|
||||||
ut_sprintf_timestamp(buf);
|
ut_sprintf_timestamp(buf);
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
buf += sprintf(buf, " INNODB MONITOR OUTPUT\n"
|
buf += sprintf(buf, " INNODB MONITOR OUTPUT\n"
|
||||||
"=====================================\n");
|
"=====================================\n");
|
||||||
@ -2242,6 +2243,7 @@ srv_sprintf_innodb_monitor(
|
|||||||
sync_print(buf, buf_end);
|
sync_print(buf, buf_end);
|
||||||
|
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
buf += sprintf(buf, "------------\n"
|
buf += sprintf(buf, "------------\n"
|
||||||
"TRANSACTIONS\n"
|
"TRANSACTIONS\n"
|
||||||
@ -2254,15 +2256,18 @@ srv_sprintf_innodb_monitor(
|
|||||||
"--------\n");
|
"--------\n");
|
||||||
os_aio_print(buf, buf_end);
|
os_aio_print(buf, buf_end);
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
buf += sprintf(buf, "-------------------------------------\n"
|
buf += sprintf(buf, "-------------------------------------\n"
|
||||||
"INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
|
"INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
|
||||||
"-------------------------------------\n");
|
"-------------------------------------\n");
|
||||||
ibuf_print(buf, buf_end);
|
ibuf_print(buf, buf_end);
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
ha_print_info(buf, buf_end, btr_search_sys->hash_index);
|
ha_print_info(buf, buf_end, btr_search_sys->hash_index);
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
buf += sprintf(buf,
|
buf += sprintf(buf,
|
||||||
"%.2f hash searches/s, %.2f non-hash searches/s\n",
|
"%.2f hash searches/s, %.2f non-hash searches/s\n",
|
||||||
@ -2278,6 +2283,7 @@ srv_sprintf_innodb_monitor(
|
|||||||
"---\n");
|
"---\n");
|
||||||
log_print(buf, buf_end);
|
log_print(buf, buf_end);
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
buf += sprintf(buf, "----------------------\n"
|
buf += sprintf(buf, "----------------------\n"
|
||||||
"BUFFER POOL AND MEMORY\n"
|
"BUFFER POOL AND MEMORY\n"
|
||||||
@ -2288,6 +2294,7 @@ srv_sprintf_innodb_monitor(
|
|||||||
mem_pool_get_reserved(mem_comm_pool));
|
mem_pool_get_reserved(mem_comm_pool));
|
||||||
buf_print_io(buf, buf_end);
|
buf_print_io(buf, buf_end);
|
||||||
buf = buf + strlen(buf);
|
buf = buf + strlen(buf);
|
||||||
|
ut_a(buf < buf_end + 1500);
|
||||||
|
|
||||||
buf += sprintf(buf, "--------------\n"
|
buf += sprintf(buf, "--------------\n"
|
||||||
"ROW OPERATIONS\n"
|
"ROW OPERATIONS\n"
|
||||||
@ -2321,6 +2328,8 @@ srv_sprintf_innodb_monitor(
|
|||||||
buf += sprintf(buf, "----------------------------\n"
|
buf += sprintf(buf, "----------------------------\n"
|
||||||
"END OF INNODB MONITOR OUTPUT\n"
|
"END OF INNODB MONITOR OUTPUT\n"
|
||||||
"============================\n");
|
"============================\n");
|
||||||
|
ut_a(buf < buf_end + 1900);
|
||||||
|
|
||||||
mutex_exit(&srv_innodb_monitor_mutex);
|
mutex_exit(&srv_innodb_monitor_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2378,7 +2387,9 @@ loop:
|
|||||||
|
|
||||||
buf = mem_alloc(100000);
|
buf = mem_alloc(100000);
|
||||||
|
|
||||||
srv_sprintf_innodb_monitor(buf, 100000);
|
srv_sprintf_innodb_monitor(buf, 90000);
|
||||||
|
|
||||||
|
ut_a(strlen(buf) < 99000);
|
||||||
|
|
||||||
printf("%s", buf);
|
printf("%s", buf);
|
||||||
|
|
||||||
|
@ -39,6 +39,17 @@ sess_t* trx_dummy_sess = NULL;
|
|||||||
the kernel mutex */
|
the kernel mutex */
|
||||||
ulint trx_n_mysql_transactions = 0;
|
ulint trx_n_mysql_transactions = 0;
|
||||||
|
|
||||||
|
/*****************************************************************
|
||||||
|
Starts the transaction if it is not yet started. */
|
||||||
|
|
||||||
|
void
|
||||||
|
trx_start_if_not_started_noninline(
|
||||||
|
/*===============================*/
|
||||||
|
trx_t* trx) /* in: transaction */
|
||||||
|
{
|
||||||
|
trx_start_if_not_started(trx);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Retrieves the error_info field from a trx. */
|
Retrieves the error_info field from a trx. */
|
||||||
|
|
||||||
@ -1465,7 +1476,7 @@ void
|
|||||||
trx_print(
|
trx_print(
|
||||||
/*======*/
|
/*======*/
|
||||||
char* buf, /* in/out: buffer where to print, must be at least
|
char* buf, /* in/out: buffer where to print, must be at least
|
||||||
500 bytes */
|
800 bytes */
|
||||||
trx_t* trx) /* in: transaction */
|
trx_t* trx) /* in: transaction */
|
||||||
{
|
{
|
||||||
char* start_of_line;
|
char* start_of_line;
|
||||||
|
@ -12,10 +12,35 @@ Created 5/11/1994 Heikki Tuuri
|
|||||||
#include "ut0ut.ic"
|
#include "ut0ut.ic"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "ut0sort.h"
|
#include "ut0sort.h"
|
||||||
|
|
||||||
ibool ut_always_false = FALSE;
|
ibool ut_always_false = FALSE;
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
Uses vsprintf to emulate sprintf so that the function always returns
|
||||||
|
the printed length. Apparently in some old SCO Unixes sprintf did not
|
||||||
|
return the printed length but a pointer to the end of the printed string. */
|
||||||
|
|
||||||
|
ulint
|
||||||
|
ut_sprintf(
|
||||||
|
/*=======*/
|
||||||
|
char* buf, /* in/out: buffer where to print */
|
||||||
|
const char* format, /* in: format of prints */
|
||||||
|
...) /* in: arguments to be printed */
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
|
||||||
|
vsprintf(buf, format, args);
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
return((ulint)strlen(buf));
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
|
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
|
||||||
but since there seem to be compiler bugs in both gcc and Visual C++,
|
but since there seem to be compiler bugs in both gcc and Visual C++,
|
||||||
|
@ -60,7 +60,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
|
|||||||
charset.lo hash.lo mf_iocache.lo \
|
charset.lo hash.lo mf_iocache.lo \
|
||||||
mf_iocache2.lo my_seek.lo \
|
mf_iocache2.lo my_seek.lo \
|
||||||
my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo \
|
my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo \
|
||||||
my_getopt.lo my_gethostbyname.lo
|
my_getopt.lo my_gethostbyname.lo my_port.lo
|
||||||
sqlobjects = net.lo
|
sqlobjects = net.lo
|
||||||
|
|
||||||
# Not needed in the minimum library
|
# Not needed in the minimum library
|
||||||
|
@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
|
|||||||
# Program Definitions
|
# Program Definitions
|
||||||
#--
|
#--
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin
|
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11
|
||||||
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
|
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
|
||||||
|
|
||||||
# Standard functions
|
# Standard functions
|
||||||
|
@ -5,6 +5,12 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
|
|||||||
select 9223372036854775807,-009223372036854775808;
|
select 9223372036854775807,-009223372036854775808;
|
||||||
select +9999999999999999999,-9999999999999999999;
|
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;
|
drop table if exists t1;
|
||||||
create table t1 (a bigint unsigned not null, primary key(a));
|
create table t1 (a bigint unsigned not null, primary key(a));
|
||||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
||||||
|
@ -28,3 +28,7 @@ create table t1 (num double(12,2));
|
|||||||
insert into t1 values (144.54);
|
insert into t1 values (144.54);
|
||||||
select sum(if(num is null,0.00,num)) from t1;
|
select sum(if(num is null,0.00,num)) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (x int, y int);
|
||||||
|
insert into t1 values (0,6),(10,16),(20,26),(30,10),(40,46),(50,56);
|
||||||
|
select min(if(y -x > 5,y,NULL)), max(if(y - x > 5,y,NULL)) 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 \
|
my_quick.c my_lockmem.c my_static.c \
|
||||||
my_getopt.c my_mkdir.c \
|
my_getopt.c my_mkdir.c \
|
||||||
default.c my_compress.c checksum.c raid.cc \
|
default.c my_compress.c checksum.c raid.cc \
|
||||||
my_net.c my_semaphore.c \
|
my_net.c my_semaphore.c my_port.c \
|
||||||
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
|
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
|
||||||
my_gethostbyname.c rijndael.c my_aes.c sha1.c
|
my_gethostbyname.c rijndael.c my_aes.c sha1.c
|
||||||
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
|
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
/* Thread safe version of gethostbyname_r() */
|
/* Thread safe version of gethostbyname_r() */
|
||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
#ifdef THREAD
|
|
||||||
#include "my_pthread.h"
|
|
||||||
#endif
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#if !defined(MSDOS) && !defined(__WIN__)
|
#if !defined(MSDOS) && !defined(__WIN__)
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
#include "m_ctype.h"
|
#include "m_ctype.h"
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
#ifdef THREAD
|
|
||||||
#include <my_pthread.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_GETRUSAGE
|
#ifdef HAVE_GETRUSAGE
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
/* extern int getrusage(int, struct rusage *); */
|
/* extern int getrusage(int, struct rusage *); */
|
||||||
|
@ -33,11 +33,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /* !defined(MSDOS) && !defined(__WIN__) */
|
#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)
|
void my_inet_ntoa(struct in_addr in, char *buf)
|
||||||
{
|
{
|
||||||
char *ptr;
|
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 */
|
@ -22,10 +22,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
|
#include <my_pthread.h>
|
||||||
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
|
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;
|
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
|
||||||
extern pthread_mutex_t LOCK_bitmap;
|
extern pthread_mutex_t LOCK_bitmap;
|
||||||
#else /* THREAD */
|
#else
|
||||||
#define pthread_mutex_lock(A)
|
#include <my_no_pthread.h>
|
||||||
#define pthread_mutex_unlock(A)
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
/* Synchronization - readers / writer thread locks */
|
/* Synchronization - readers / writer thread locks */
|
||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
#include <my_pthread.h>
|
|
||||||
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
|
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
/* TODO list for the InnoDB handler:
|
/* TODO list for the InnoDB handler:
|
||||||
- Ask Monty if strings of different languages can exist in the same
|
- Ask Monty if strings of different languages can exist in the same
|
||||||
database. Answer: in near future yes, but not yet.
|
database. Answer: in 4.1 yes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
@ -308,6 +308,8 @@ innobase_mysql_print_thd(
|
|||||||
}
|
}
|
||||||
buf[0]='\n';
|
buf[0]='\n';
|
||||||
buf[1]=0;
|
buf[1]=0;
|
||||||
|
|
||||||
|
ut_a(strlen(old_buf) < 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,6 +395,61 @@ ha_innobase::update_thd(
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
Call this when you have opened a new table handle in HANDLER, before you
|
||||||
|
call index_read_idx() etc. Actually, we can let the cursor stay open even
|
||||||
|
over a transaction commit! Then you should call this before every operation,
|
||||||
|
fecth next etc. This function inits the necessary things even after a
|
||||||
|
transaction commit. */
|
||||||
|
|
||||||
|
/* TODO: THIS CODE HAS NOT BEEN TESTED!!! */
|
||||||
|
|
||||||
|
void
|
||||||
|
ha_innobase::init_table_handle_for_HANDLER(void)
|
||||||
|
/*============================================*/
|
||||||
|
{
|
||||||
|
row_prebuilt_t* prebuilt;
|
||||||
|
|
||||||
|
/* If current thd does not yet have a trx struct, create one.
|
||||||
|
If the current handle does not yet have a prebuilt struct, create
|
||||||
|
one. Update the trx pointers in the prebuilt struct. Normally
|
||||||
|
this operation is done in external_lock. */
|
||||||
|
|
||||||
|
update_thd(current_thd);
|
||||||
|
|
||||||
|
/* Initialize the prebuilt struct much like it would be inited in
|
||||||
|
external_lock */
|
||||||
|
|
||||||
|
prebuilt = (row_prebuilt_t*)innobase_prebuilt;
|
||||||
|
|
||||||
|
/* If the transaction is not started yet, start it */
|
||||||
|
|
||||||
|
trx_start_if_not_started_noninline(prebuilt->trx);
|
||||||
|
|
||||||
|
/* Assign a read view if the transaction does not have it yet */
|
||||||
|
|
||||||
|
trx_assign_read_view(prebuilt->trx);
|
||||||
|
|
||||||
|
/* We did the necessary inits in this function, no need to repeat them
|
||||||
|
in row_search_for_mysql */
|
||||||
|
|
||||||
|
prebuilt->sql_stat_start = FALSE;
|
||||||
|
|
||||||
|
/* We let HANDLER always to do the reads as consistent reads, even
|
||||||
|
if the trx isolation level would have been specified as SERIALIZABLE */
|
||||||
|
|
||||||
|
prebuilt->select_lock_type = LOCK_NONE;
|
||||||
|
|
||||||
|
/* Always fetch all columns in the index record */
|
||||||
|
|
||||||
|
prebuilt->hint_no_need_to_fetch_extra_cols = FALSE;
|
||||||
|
|
||||||
|
/* We want always to fetch all columns in the whole row? Or do
|
||||||
|
we???? */
|
||||||
|
|
||||||
|
prebuilt->read_just_key = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Opens an InnoDB database. */
|
Opens an InnoDB database. */
|
||||||
|
|
||||||
@ -3460,8 +3517,10 @@ innodb_show_status(
|
|||||||
|
|
||||||
DBUG_ENTER("innodb_show_status");
|
DBUG_ENTER("innodb_show_status");
|
||||||
|
|
||||||
/* We let the InnoDB Monitor to output at most 100 kB of text */
|
/* We let the InnoDB Monitor to output at most 100 kB of text, add
|
||||||
buf = (char*)ut_malloc(100 * 1024);
|
a safety margin of 10 kB for buffer overruns */
|
||||||
|
|
||||||
|
buf = (char*)ut_malloc(110 * 1024);
|
||||||
|
|
||||||
srv_sprintf_innodb_monitor(buf, 100 * 1024);
|
srv_sprintf_innodb_monitor(buf, 100 * 1024);
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ class ha_innobase: public handler
|
|||||||
void free_foreign_key_create_info(char* str);
|
void free_foreign_key_create_info(char* str);
|
||||||
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
|
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
|
||||||
enum thr_lock_type lock_type);
|
enum thr_lock_type lock_type);
|
||||||
|
void init_table_handle_for_HANDLER(); /* TODO: NOT TESTED!!! */
|
||||||
longlong get_auto_increment();
|
longlong get_auto_increment();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -501,12 +501,12 @@ Item_func_if::fix_length_and_dec()
|
|||||||
if (null1)
|
if (null1)
|
||||||
{
|
{
|
||||||
cached_result_type= arg2_type;
|
cached_result_type= arg2_type;
|
||||||
binary= args[1]->binary;
|
binary= args[2]->binary;
|
||||||
}
|
}
|
||||||
else if (null2)
|
else if (null2)
|
||||||
{
|
{
|
||||||
cached_result_type= arg2_type;
|
cached_result_type= arg1_type;
|
||||||
binary= args[2]->binary;
|
binary= args[1]->binary;
|
||||||
}
|
}
|
||||||
else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
|
else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
|
||||||
{
|
{
|
||||||
|
@ -646,29 +646,45 @@ static void close_server_sock()
|
|||||||
if (tmp_sock != INVALID_SOCKET)
|
if (tmp_sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
ip_sock=INVALID_SOCKET;
|
ip_sock=INVALID_SOCKET;
|
||||||
DBUG_PRINT("info",("closing TCP/IP socket"));
|
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
|
||||||
VOID(shutdown(tmp_sock,2));
|
VOID(shutdown(tmp_sock,2));
|
||||||
|
#ifdef NOT_USED
|
||||||
|
/*
|
||||||
|
The following code is disabled as it causes MySQL to hang on
|
||||||
|
AIX 4.3 during shutdown
|
||||||
|
*/
|
||||||
|
DBUG_PRINT("info",("calling closesocket on TCP/IP socket"));
|
||||||
VOID(closesocket(tmp_sock));
|
VOID(closesocket(tmp_sock));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
tmp_sock=unix_sock;
|
tmp_sock=unix_sock;
|
||||||
if (tmp_sock != INVALID_SOCKET)
|
if (tmp_sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
unix_sock=INVALID_SOCKET;
|
unix_sock=INVALID_SOCKET;
|
||||||
DBUG_PRINT("info",("closing Unix socket"));
|
DBUG_PRINT("info",("calling shutdown on unix socket"));
|
||||||
VOID(shutdown(tmp_sock,2));
|
VOID(shutdown(tmp_sock,2));
|
||||||
|
#ifdef NOT_USED
|
||||||
|
/*
|
||||||
|
The following code is disabled as it may cause MySQL to hang on
|
||||||
|
AIX 4.3 during shutdown (not tested, but likely)
|
||||||
|
*/
|
||||||
|
DBUG_PRINT("info",("calling closesocket on unix/IP socket"));
|
||||||
VOID(closesocket(tmp_sock));
|
VOID(closesocket(tmp_sock));
|
||||||
|
#endif
|
||||||
VOID(unlink(mysql_unix_port));
|
VOID(unlink(mysql_unix_port));
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void kill_mysql(void)
|
void kill_mysql(void)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("kill_mysql");
|
DBUG_ENTER("kill_mysql");
|
||||||
|
|
||||||
#ifdef SIGNALS_DONT_BREAK_READ
|
#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
|
#endif
|
||||||
|
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
@ -699,7 +715,7 @@ void kill_mysql(void)
|
|||||||
DBUG_PRINT("quit",("After pthread_kill"));
|
DBUG_PRINT("quit",("After pthread_kill"));
|
||||||
shutdown_in_progress=1; // Safety if kill didn't work
|
shutdown_in_progress=1; // Safety if kill didn't work
|
||||||
#ifdef SIGNALS_DONT_BREAK_READ
|
#ifdef SIGNALS_DONT_BREAK_READ
|
||||||
if (!abort_loop)
|
if (!kill_in_progress)
|
||||||
{
|
{
|
||||||
pthread_t tmp;
|
pthread_t tmp;
|
||||||
abort_loop=1;
|
abort_loop=1;
|
||||||
@ -1273,7 +1289,7 @@ static void sig_reload(int signo)
|
|||||||
|
|
||||||
static void sig_kill(int signo)
|
static void sig_kill(int signo)
|
||||||
{
|
{
|
||||||
if (!abort_loop)
|
if (!kill_in_progress)
|
||||||
{
|
{
|
||||||
abort_loop=1; // mark abort for threads
|
abort_loop=1; // mark abort for threads
|
||||||
kill_server((void*) signo);
|
kill_server((void*) signo);
|
||||||
|
@ -345,7 +345,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
|
|||||||
else
|
else
|
||||||
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted,
|
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted,
|
||||||
thd->cuted_fields);
|
thd->cuted_fields);
|
||||||
::send_ok(&thd->net,info.copied+info.deleted,0L,buff);
|
::send_ok(&thd->net,info.copied+info.deleted,(ulonglong)id,buff);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user