Commit 3542dad3 authored by jani@ua126d19.elisa.omakaista.fi's avatar jani@ua126d19.elisa.omakaista.fi

Merge jani@192.168.0.2:/my/mysql-4.0

into ua126d19.elisa.omakaista.fi:/home/my/bk/mysql-4.0
parents c9d76b51 4ead61f8
...@@ -71,6 +71,22 @@ else ...@@ -71,6 +71,22 @@ else
make=make make=make
fi fi
if test -z $CXX ; then if test -z "$CXX" ; then
CXX=gcc CXX=gcc
fi fi
# If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it.
# We use 'grep' and hope 'grep' will work as expected
# (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1
then
if ! (echo "$CC" | grep "ccache" > /dev/null)
then
CC="ccache $CC"
fi
if ! (echo "$CXX" | grep "ccache" > /dev/null)
then
CXX="ccache $CXX"
fi
fi
...@@ -33,6 +33,7 @@ jani@hynda.mysql.fi ...@@ -33,6 +33,7 @@ jani@hynda.mysql.fi
jani@janikt.pp.saunalahti.fi jani@janikt.pp.saunalahti.fi
jani@rhols221.adsl.netsonic.fi jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi jani@rhols221.arenanet.fi
jani@ua126d19.elisa.omakaista.fi
jcole@abel.spaceapes.com jcole@abel.spaceapes.com
jcole@main.burghcom.com jcole@main.burghcom.com
jcole@mugatu.spaceapes.com jcole@mugatu.spaceapes.com
...@@ -62,6 +63,7 @@ monty@work.mysql.com ...@@ -62,6 +63,7 @@ monty@work.mysql.com
mwagner@cash.mwagner.org mwagner@cash.mwagner.org
mwagner@evoq.mwagner.org mwagner@evoq.mwagner.org
mwagner@work.mysql.com mwagner@work.mysql.com
mysqldev@build.mysql2.com
nick@mysql.com nick@mysql.com
nick@nick.leippe.com nick@nick.leippe.com
paul@central.snake.net paul@central.snake.net
......
...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. ...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 4.0.13) AM_INIT_AUTOMAKE(mysql, 4.0.14)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
...@@ -361,7 +361,7 @@ then ...@@ -361,7 +361,7 @@ then
# we will gets some problems when linking static programs. # we will gets some problems when linking static programs.
# The following code is used to fix this problem. # The following code is used to fix this problem.
if test "$CXX" = "gcc" if test "$CXX" = "gcc" -o "$CXX" = "ccache gcc"
then then
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1 if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
then then
...@@ -1025,8 +1025,16 @@ case $SYSTEM_TYPE in ...@@ -1025,8 +1025,16 @@ case $SYSTEM_TYPE in
;; ;;
*freebsd*) *freebsd*)
echo "Adding fix for interrupted reads" echo "Adding fix for interrupted reads"
CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH" OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH" if test "$OSVERSION" -gt "480100" && \
test "$OSVERSION" -lt "500000" || \
test "$OSVERSION" -gt "500109"
then
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
else
CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
fi
;; ;;
*netbsd*) *netbsd*)
echo "Adding flag -Dunix" echo "Adding flag -Dunix"
...@@ -1369,10 +1377,8 @@ then ...@@ -1369,10 +1377,8 @@ then
with_named_thread="-Kthread -lsocket -lnsl" with_named_thread="-Kthread -lsocket -lnsl"
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
then then
# AC_DEFINE(HAVE_OpenUNIX8_THREADS)
AC_DEFINE(HAVE_UNIXWARE7_THREADS) AC_DEFINE(HAVE_UNIXWARE7_THREADS)
else else
# AC_DEFINE(HAVE_OpenUNIX8_POSIX)
AC_DEFINE(HAVE_UNIXWARE7_POSIX) AC_DEFINE(HAVE_UNIXWARE7_POSIX)
fi fi
# We must have cc # We must have cc
...@@ -1381,10 +1387,8 @@ then ...@@ -1381,10 +1387,8 @@ then
then then
{ echo "configure: error: On OpenUNIX8 and UnixWare7 MySQL must be compiled with cc. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; { echo "configure: error: On OpenUNIX8 and UnixWare7 MySQL must be compiled with cc. See the Installation chapter in the Reference Manual." 1>&2; exit 1; };
else else
# CC="$CC -Kthread -DOpenUNIX8"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
# CXX="$CXX -Kthread -DOpenUNIX8"; CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
fi fi
AC_MSG_RESULT("yes") AC_MSG_RESULT("yes")
else else
......
...@@ -291,7 +291,6 @@ C_MODE_END ...@@ -291,7 +291,6 @@ C_MODE_END
#define HAVE_ERRNO_AS_DEFINE #define HAVE_ERRNO_AS_DEFINE
#define HAVE_FCNTL_LOCK #define HAVE_FCNTL_LOCK
#undef HAVE_FINITE #undef HAVE_FINITE
#undef HAVE_RINT
#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ #undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */
#undef LONGLONG_MAX /* standard system library 'limits.h' */ #undef LONGLONG_MAX /* standard system library 'limits.h' */
#endif #endif
...@@ -360,7 +359,7 @@ typedef unsigned short ushort; ...@@ -360,7 +359,7 @@ typedef unsigned short ushort;
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#ifndef HAVE_RINT #ifndef HAVE_RINT
#define rint(A) floor((A)+((A) < 0) -0.5 : 0.5) #define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))
#endif #endif
/* Define some general constants */ /* Define some general constants */
......
...@@ -103,7 +103,7 @@ void init_thr_alarm(uint max_alarm); ...@@ -103,7 +103,7 @@ void init_thr_alarm(uint max_alarm);
bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff); bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id); void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed); void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(void); void end_thr_alarm(my_bool free_structures);
sig_handler process_alarm(int); sig_handler process_alarm(int);
#ifndef thr_got_alarm #ifndef thr_got_alarm
bool thr_got_alarm(thr_alarm_t *alrm); bool thr_got_alarm(thr_alarm_t *alrm);
......
...@@ -1613,7 +1613,7 @@ buf_pool_invalidate(void) ...@@ -1613,7 +1613,7 @@ buf_pool_invalidate(void)
freed = TRUE; freed = TRUE;
while (freed) { while (freed) {
freed = buf_LRU_search_and_free_block(0); freed = buf_LRU_search_and_free_block(100);
} }
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
...@@ -1845,7 +1845,8 @@ buf_get_modified_ratio_pct(void) ...@@ -1845,7 +1845,8 @@ buf_get_modified_ratio_pct(void)
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list)) ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
/ (1 + UT_LIST_GET_LEN(buf_pool->LRU)); / (1 + UT_LIST_GET_LEN(buf_pool->LRU)
+ UT_LIST_GET_LEN(buf_pool->free));
/* 1 + is there to avoid division by zero */ /* 1 + is there to avoid division by zero */
...@@ -1898,8 +1899,10 @@ buf_print_io( ...@@ -1898,8 +1899,10 @@ buf_print_io(
buf += sprintf(buf, buf += sprintf(buf,
"Pending writes: LRU %lu, flush list %lu, single page %lu\n", "Pending writes: LRU %lu, flush list %lu, single page %lu\n",
buf_pool->n_flush[BUF_FLUSH_LRU], buf_pool->n_flush[BUF_FLUSH_LRU]
buf_pool->n_flush[BUF_FLUSH_LIST], + buf_pool->init_flush[BUF_FLUSH_LRU],
buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->init_flush[BUF_FLUSH_LIST],
buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]); buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
current_time = time(NULL); current_time = time(NULL);
......
...@@ -573,15 +573,7 @@ buf_flush_try_neighbors( ...@@ -573,15 +573,7 @@ buf_flush_try_neighbors(
low = offset; low = offset;
high = offset + 1; high = offset + 1;
} else if (flush_type == BUF_FLUSH_LIST) { }
/* Since semaphore waits require us to flush the
doublewrite buffer to disk, it is best that the
search area is just the page itself, to minimize
chances for semaphore waits */
low = offset;
high = offset + 1;
}
/* printf("Flush area: low %lu high %lu\n", low, high); */ /* printf("Flush area: low %lu high %lu\n", low, high); */
...@@ -598,13 +590,20 @@ buf_flush_try_neighbors( ...@@ -598,13 +590,20 @@ buf_flush_try_neighbors(
if (block && flush_type == BUF_FLUSH_LRU && i != offset if (block && flush_type == BUF_FLUSH_LRU && i != offset
&& !block->old) { && !block->old) {
/* We avoid flushing 'non-old' blocks in an LRU flush, /* We avoid flushing 'non-old' blocks in an LRU flush,
because the flushed blocks are soon freed */ because the flushed blocks are soon freed */
continue; continue;
} }
if (block && buf_flush_ready_for_flush(block, flush_type)) { if (block && buf_flush_ready_for_flush(block, flush_type)
&& (i == offset || block->buf_fix_count == 0)) {
/* We only try to flush those neighbors != offset
where the buf fix count is zero, as we then know that
we probably can latch the page without a semaphore
wait. Semaphore waits are expensive because we must
flush the doublewrite buffer before we start
waiting. */
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
...@@ -723,7 +722,6 @@ buf_flush_batch( ...@@ -723,7 +722,6 @@ buf_flush_batch(
page_count += page_count +=
buf_flush_try_neighbors(space, offset, buf_flush_try_neighbors(space, offset,
flush_type); flush_type);
/* printf( /* printf(
"Flush type %lu, page no %lu, neighb %lu\n", "Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset, flush_type, offset,
...@@ -849,11 +847,19 @@ buf_flush_free_margin(void) ...@@ -849,11 +847,19 @@ buf_flush_free_margin(void)
/*=======================*/ /*=======================*/
{ {
ulint n_to_flush; ulint n_to_flush;
ulint n_flushed;
n_to_flush = buf_flush_LRU_recommendation(); n_to_flush = buf_flush_LRU_recommendation();
if (n_to_flush > 0) { if (n_to_flush > 0) {
buf_flush_batch(BUF_FLUSH_LRU, n_to_flush, ut_dulint_zero); n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
ut_dulint_zero);
if (n_flushed == ULINT_UNDEFINED) {
/* There was an LRU type flush batch already running;
let us wait for it to end */
buf_flush_wait_batch_end(BUF_FLUSH_LRU);
}
} }
} }
......
...@@ -104,12 +104,15 @@ ibool ...@@ -104,12 +104,15 @@ ibool
buf_LRU_search_and_free_block( buf_LRU_search_and_free_block(
/*==========================*/ /*==========================*/
/* out: TRUE if freed */ /* out: TRUE if freed */
ulint n_iterations __attribute__((unused))) /* in: how many times ulint n_iterations) /* in: how many times this has been called
this has been called repeatedly without repeatedly without result: a high value means
result: a high value means that we should that we should search farther; if value is
search farther */ k < 10, then we only search k/10 * [number
of pages in the buffer pool] from the end
of the LRU list */
{ {
buf_block_t* block; buf_block_t* block;
ulint distance = 0;
ibool freed; ibool freed;
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
...@@ -146,6 +149,18 @@ buf_LRU_search_and_free_block( ...@@ -146,6 +149,18 @@ buf_LRU_search_and_free_block(
} }
block = UT_LIST_GET_PREV(LRU, block); block = UT_LIST_GET_PREV(LRU, block);
distance++;
if (!freed && n_iterations <= 10
&& distance > 100 + (n_iterations * buf_pool->curr_size)
/ 10) {
buf_pool->LRU_flush_ended = 0;
mutex_exit(&(buf_pool->mutex));
return(FALSE);
}
} }
if (buf_pool->LRU_flush_ended > 0) { if (buf_pool->LRU_flush_ended > 0) {
...@@ -180,7 +195,7 @@ buf_LRU_try_free_flushed_blocks(void) ...@@ -180,7 +195,7 @@ buf_LRU_try_free_flushed_blocks(void)
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
buf_LRU_search_and_free_block(0); buf_LRU_search_and_free_block(1);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
} }
...@@ -200,7 +215,7 @@ buf_LRU_get_free_block(void) ...@@ -200,7 +215,7 @@ buf_LRU_get_free_block(void)
{ {
buf_block_t* block = NULL; buf_block_t* block = NULL;
ibool freed; ibool freed;
ulint n_iterations = 0; ulint n_iterations = 1;
ibool mon_value_was = 0; /* remove bug */ ibool mon_value_was = 0; /* remove bug */
ibool started_monitor = FALSE; ibool started_monitor = FALSE;
loop: loop:
...@@ -246,14 +261,6 @@ buf_LRU_get_free_block(void) ...@@ -246,14 +261,6 @@ buf_LRU_get_free_block(void)
srv_print_innodb_monitor = FALSE; srv_print_innodb_monitor = FALSE;
} }
if (buf_pool->LRU_flush_ended > 0) {
mutex_exit(&(buf_pool->mutex));
buf_LRU_try_free_flushed_blocks();
mutex_enter(&(buf_pool->mutex));
}
/* If there is a block in the free list, take it */ /* If there is a block in the free list, take it */
if (UT_LIST_GET_LEN(buf_pool->free) > 0) { if (UT_LIST_GET_LEN(buf_pool->free) > 0) {
...@@ -319,6 +326,20 @@ buf_LRU_get_free_block(void) ...@@ -319,6 +326,20 @@ buf_LRU_get_free_block(void)
os_aio_simulated_wake_handler_threads(); os_aio_simulated_wake_handler_threads();
mutex_enter(&(buf_pool->mutex));
if (buf_pool->LRU_flush_ended > 0) {
/* We have written pages in an LRU flush. To make the insert
buffer more efficient, we try to move these pages to the free
list. */
mutex_exit(&(buf_pool->mutex));
buf_LRU_try_free_flushed_blocks();
} else {
mutex_exit(&(buf_pool->mutex));
}
if (n_iterations > 10) { if (n_iterations > 10) {
os_thread_sleep(500000); os_thread_sleep(500000);
......
...@@ -46,6 +46,20 @@ buf_LRU_get_recent_limit(void); ...@@ -46,6 +46,20 @@ buf_LRU_get_recent_limit(void);
/*==========================*/ /*==========================*/
/* out: the limit; zero if could not determine it */ /* out: the limit; zero if could not determine it */
/********************************************************************** /**********************************************************************
Look for a replaceable block from the end of the LRU list and put it to
the free list if found. */
ibool
buf_LRU_search_and_free_block(
/*==========================*/
/* out: TRUE if freed */
ulint n_iterations); /* in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; if value is
k < 10, then we only search k/10 * number
of pages in the buffer pool from the end
of the LRU list */
/**********************************************************************
Returns a free block from the buf_pool. The block is taken off the Returns a free block from the buf_pool. The block is taken off the
free list. If it is empty, blocks are moved from the end of the free list. If it is empty, blocks are moved from the end of the
LRU list to the free list. */ LRU list to the free list. */
...@@ -86,17 +100,6 @@ void ...@@ -86,17 +100,6 @@ void
buf_LRU_make_block_old( buf_LRU_make_block_old(
/*===================*/ /*===================*/
buf_block_t* block); /* in: control block */ buf_block_t* block); /* in: control block */
/**********************************************************************
Look for a replaceable block from the end of the LRU list and put it to
the free list if found. */
ibool
buf_LRU_search_and_free_block(
/*==========================*/
/* out: TRUE if freed */
ulint n_iterations); /* in: how many times this has been called
repeatedly without result: a high value
means that we should search farther */
/************************************************************************** /**************************************************************************
Validates the LRU list. */ Validates the LRU list. */
......
...@@ -68,9 +68,10 @@ os_event_create( ...@@ -68,9 +68,10 @@ os_event_create(
os_fast_mutex_init(&(event->os_mutex)); os_fast_mutex_init(&(event->os_mutex));
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10) #if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
pthread_cond_init(&(event->cond_var), pthread_condattr_default); ut_a(0 == pthread_cond_init(&(event->cond_var),
pthread_condattr_default));
#else #else
pthread_cond_init(&(event->cond_var), NULL); ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
#endif #endif
event->is_set = FALSE; event->is_set = FALSE;
...@@ -130,7 +131,7 @@ os_event_set( ...@@ -130,7 +131,7 @@ os_event_set(
/* Do nothing */ /* Do nothing */
} else { } else {
event->is_set = TRUE; event->is_set = TRUE;
pthread_cond_broadcast(&(event->cond_var)); ut_a(0 == pthread_cond_broadcast(&(event->cond_var)));
} }
os_fast_mutex_unlock(&(event->os_mutex)); os_fast_mutex_unlock(&(event->os_mutex));
...@@ -182,7 +183,7 @@ os_event_free( ...@@ -182,7 +183,7 @@ os_event_free(
ut_a(event); ut_a(event);
os_fast_mutex_free(&(event->os_mutex)); os_fast_mutex_free(&(event->os_mutex));
pthread_cond_destroy(&(event->cond_var)); ut_a(0 == pthread_cond_destroy(&(event->cond_var)));
ut_free(event); ut_free(event);
#endif #endif
...@@ -446,9 +447,9 @@ os_fast_mutex_init( ...@@ -446,9 +447,9 @@ os_fast_mutex_init(
InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex); InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#else #else
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10) #if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
pthread_mutex_init(fast_mutex, pthread_mutexattr_default); ut_a(0 == pthread_mutex_init(fast_mutex, pthread_mutexattr_default));
#else #else
pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST); ut_a(0 == pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST));
#endif #endif
#endif #endif
} }
...@@ -495,10 +496,7 @@ os_fast_mutex_free( ...@@ -495,10 +496,7 @@ os_fast_mutex_free(
ut_a(fast_mutex); ut_a(fast_mutex);
DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex); DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#elif defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
pthread_mutex_destroy(fast_mutex);
#else #else
UT_NOT_USED(fast_mutex); ut_a(0 == pthread_mutex_destroy(fast_mutex));
#endif #endif
} }
...@@ -1275,6 +1275,10 @@ row_ins_unique_report_err( ...@@ -1275,6 +1275,10 @@ row_ins_unique_report_err(
dtuple_t* entry, /* in: index entry to insert in the index */ dtuple_t* entry, /* in: index entry to insert in the index */
dict_index_t* index) /* in: index */ dict_index_t* index) /* in: index */
{ {
#ifdef notdefined
/* Disable reporting to test if the slowdown of REPLACE in 4.0.13 was
caused by this! */
char* buf = dict_unique_err_buf; char* buf = dict_unique_err_buf;
/* The foreign err mutex protects also dict_unique_err_buf */ /* The foreign err mutex protects also dict_unique_err_buf */
...@@ -1303,6 +1307,7 @@ row_ins_unique_report_err( ...@@ -1303,6 +1307,7 @@ row_ins_unique_report_err(
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN); ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
#endif
} }
/******************************************************************* /*******************************************************************
......
...@@ -161,13 +161,13 @@ srv_parse_data_file_paths_and_sizes( ...@@ -161,13 +161,13 @@ srv_parse_data_file_paths_and_sizes(
} }
if (strlen(str) >= ut_strlen(":autoextend") if (strlen(str) >= ut_strlen(":autoextend")
&& 0 == ut_memcmp(str, ":autoextend", && 0 == ut_memcmp(str, (char*)":autoextend",
ut_strlen(":autoextend"))) { ut_strlen(":autoextend"))) {
str += ut_strlen(":autoextend"); str += ut_strlen(":autoextend");
if (strlen(str) >= ut_strlen(":max:") if (strlen(str) >= ut_strlen(":max:")
&& 0 == ut_memcmp(str, ":max:", && 0 == ut_memcmp(str, (char*)":max:",
ut_strlen(":max:"))) { ut_strlen(":max:"))) {
str += ut_strlen(":max:"); str += ut_strlen(":max:");
...@@ -265,7 +265,7 @@ srv_parse_data_file_paths_and_sizes( ...@@ -265,7 +265,7 @@ srv_parse_data_file_paths_and_sizes(
(*data_file_sizes)[i] = size; (*data_file_sizes)[i] = size;
if (strlen(str) >= ut_strlen(":autoextend") if (strlen(str) >= ut_strlen(":autoextend")
&& 0 == ut_memcmp(str, ":autoextend", && 0 == ut_memcmp(str, (char*)":autoextend",
ut_strlen(":autoextend"))) { ut_strlen(":autoextend"))) {
*is_auto_extending = TRUE; *is_auto_extending = TRUE;
...@@ -273,7 +273,7 @@ srv_parse_data_file_paths_and_sizes( ...@@ -273,7 +273,7 @@ srv_parse_data_file_paths_and_sizes(
str += ut_strlen(":autoextend"); str += ut_strlen(":autoextend");
if (strlen(str) >= ut_strlen(":max:") if (strlen(str) >= ut_strlen(":max:")
&& 0 == ut_memcmp(str, ":max:", && 0 == ut_memcmp(str, (char*)":max:",
ut_strlen(":max:"))) { ut_strlen(":max:"))) {
str += ut_strlen(":max:"); str += ut_strlen(":max:");
...@@ -864,6 +864,7 @@ open_or_create_data_files( ...@@ -864,6 +864,7 @@ open_or_create_data_files(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#ifdef notdefined
/********************************************************************* /*********************************************************************
This thread is used to measure contention of latches. */ This thread is used to measure contention of latches. */
static static
...@@ -935,6 +936,7 @@ test_measure_cont( ...@@ -935,6 +936,7 @@ test_measure_cont(
return(0); return(0);
} }
#endif
/******************************************************************** /********************************************************************
Starts InnoDB and creates a new database if database files Starts InnoDB and creates a new database if database files
...@@ -1036,20 +1038,24 @@ innobase_start_or_create_for_mysql(void) ...@@ -1036,20 +1038,24 @@ innobase_start_or_create_for_mysql(void)
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
#ifndef __WIN__ #ifndef __WIN__
} else if (0 == ut_strcmp(srv_file_flush_method_str, "fdatasync")) { } else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"fdatasync")) {
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC; srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DSYNC")) { } else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"O_DSYNC")) {
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC; srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, } else if (0 == ut_strcmp(srv_file_flush_method_str,
"littlesync")) { (char*)"littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC; srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) { } else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"nosync")) {
srv_unix_file_flush_method = SRV_UNIX_NOSYNC; srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
#else #else
} else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) { } else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"normal")) {
srv_win_file_flush_method = SRV_WIN_IO_NORMAL; srv_win_file_flush_method = SRV_WIN_IO_NORMAL;
os_aio_use_native_aio = FALSE; os_aio_use_native_aio = FALSE;
...@@ -1157,7 +1163,14 @@ innobase_start_or_create_for_mysql(void) ...@@ -1157,7 +1163,14 @@ innobase_start_or_create_for_mysql(void)
&max_flushed_lsn, &max_arch_log_no, &max_flushed_lsn, &max_arch_log_no,
&sum_of_new_sizes); &sum_of_new_sizes);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, "InnoDB: Could not open data files\n"); fprintf(stderr,
"InnoDB: Could not open or create data files.\n"
"InnoDB: If you tried to add new data files, and it failed here,\n"
"InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
"InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
"InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
"InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
"InnoDB: remove old data files which contain your precious data!\n");
return((int) err); return((int) err);
} }
......
...@@ -1505,6 +1505,8 @@ trx_commit_complete_for_mysql( ...@@ -1505,6 +1505,8 @@ trx_commit_complete_for_mysql(
trx->op_info = (char *) ""; trx->op_info = (char *) "";
} }
return(0);
} }
/************************************************************************** /**************************************************************************
......
...@@ -45,6 +45,7 @@ static const char *set_charset_name; ...@@ -45,6 +45,7 @@ static const char *set_charset_name;
static CHARSET_INFO *set_charset; static CHARSET_INFO *set_charset;
static long opt_myisam_block_size; static long opt_myisam_block_size;
static const char *my_progname_short; static const char *my_progname_short;
static int stopwords_inited= 0;
static const char *type_names[]= static const char *type_names[]=
{ "?","char","binary", "short", "long", "float", { "?","char","binary", "short", "long", "float",
...@@ -861,7 +862,7 @@ static int myisamchk(MI_CHECK *param, my_string filename) ...@@ -861,7 +862,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
} }
else else
{ {
if (share->fulltext_index) if (share->fulltext_index && !stopwords_inited++)
ft_init_stopwords(); ft_init_stopwords();
if (!(param->testflag & T_READONLY)) if (!(param->testflag & T_READONLY))
......
...@@ -19,6 +19,8 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work ...@@ -19,6 +19,8 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# Program Definitions # Program Definitions
#-- #--
LC_COLLATE=C
export LC_COLLATE
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master" MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
...@@ -114,6 +116,7 @@ if test $? != 0; then exit 1; fi ...@@ -114,6 +116,7 @@ if test $? != 0; then exit 1; fi
TR=tr TR=tr
XARGS=`which xargs` XARGS=`which xargs`
if test $? != 0; then exit 1; fi if test $? != 0; then exit 1; fi
SORT=sort
# Are we using a source or a binary distribution? # Are we using a source or a binary distribution?
...@@ -1363,7 +1366,7 @@ then ...@@ -1363,7 +1366,7 @@ then
if [ x$RECORD = x1 ]; then if [ x$RECORD = x1 ]; then
$ECHO "Will not run in record mode without a specific test case." $ECHO "Will not run in record mode without a specific test case."
else else
for tf in $TESTDIR/*.$TESTSUFFIX for tf in `ls -1 $TESTDIR/*.$TESTSUFFIX | $SORT`
do do
run_testcase $tf run_testcase $tf
done done
......
...@@ -8,4 +8,11 @@ a b c d ...@@ -8,4 +8,11 @@ a b c d
0000-00-00 0000-00-00 0000-00-00 0000-00-00 0000-00-00 0000-00-00 0000-00-00 0000-00-00
2003-03-03 2003-03-03 2003-03-03 NULL 2003-03-03 2003-03-03 2003-03-03 NULL
2003-03-03 2003-03-03 2003-03-03 NULL 2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
SELECT * from t1;
a b c d
NULL NULL 0000-00-00 0000-00-00
NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1; drop table t1;
...@@ -23,10 +23,12 @@ drop table t1; ...@@ -23,10 +23,12 @@ drop table t1;
drop table t2; drop table t2;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b)); create table t2(b int auto_increment, c int, key(b));
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10); insert into t1 values (10);
insert into t1 values (null),(null),(null); insert into t1 values (null),(null),(null);
insert into t2 values (5,0); insert into t2 values (5,0);
insert into t2 values (null,last_insert_id()); insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
select * from t1; select * from t1;
a a
10 10
......
...@@ -7,7 +7,7 @@ slave start; ...@@ -7,7 +7,7 @@ slave start;
create table t1(a int not null auto_increment, b int, primary key(a) ); create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1; load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines; load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2; insert into t3 select * from t2;
select * from t1; select * from t1;
......
...@@ -357,3 +357,9 @@ select * from t1; ...@@ -357,3 +357,9 @@ select * from t1;
a a
99999999999 99999999999
drop table t1; drop table t1;
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
...@@ -115,7 +115,7 @@ myisam_max_sort_file_size 1048576 ...@@ -115,7 +115,7 @@ myisam_max_sort_file_size 1048576
set GLOBAL myisam_max_sort_file_size=default; set GLOBAL myisam_max_sort_file_size=default;
show variables like 'myisam_max_sort_file_size'; show variables like 'myisam_max_sort_file_size';
Variable_name Value Variable_name Value
myisam_max_sort_file_size 2147483647 myisam_max_sort_file_size FILE_SIZE
set global net_retry_count=10, session net_retry_count=10; set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
......
2003-01-21,6328,%a%,%aaaaa% >2003-01-21,6328,%a%,%aaaaa%
## ##
2003-02-22,2461,b,%a a a @@ @% @b ' " a% >2003-02-22,2461,b,%a a a @@ @% @b ' " a%
## ##
2003-03-22,2161,%c%,%asdf% >2003-03-22,2161,%c%,%asdf%
## ##
2003-04-22,2416,%a%,%bbbbb% >2003-04-22,2416,%a%,%bbbbb%
## ##
...@@ -8,4 +8,12 @@ create table t1 (a date, b date, c date not null, d date); ...@@ -8,4 +8,12 @@ create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
SELECT * from t1; SELECT * from t1;
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
SELECT * from t1;
drop table t1; drop table t1;
#see if queries that use both # See if queries that use both auto_increment and LAST_INSERT_ID()
#auto_increment and LAST_INSERT_ID() # are replicated well
#are replicated well
# We also check how the foreign_key_check variable is replicated
source include/master-slave.inc; source include/master-slave.inc;
connection master; connection master;
drop table if exists t1; drop table if exists t1;
...@@ -22,10 +24,12 @@ drop table t1; ...@@ -22,10 +24,12 @@ drop table t1;
drop table t2; drop table t2;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b)); create table t2(b int auto_increment, c int, key(b));
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10); insert into t1 values (10);
insert into t1 values (null),(null),(null); insert into t1 values (null),(null),(null);
insert into t2 values (5,0); insert into t2 values (5,0);
insert into t2 values (null,last_insert_id()); insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
......
...@@ -10,8 +10,7 @@ create table t1(a int not null auto_increment, b int, primary key(a) ); ...@@ -10,8 +10,7 @@ create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1; load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
#load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionaly enclosed by '%' escaped by '@' lines terminated by '\n%%\n' ignore 1 lines; load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2; insert into t3 select * from t2;
......
...@@ -230,3 +230,13 @@ insert into t1 values("1e4294967297"); ...@@ -230,3 +230,13 @@ insert into t1 values("1e4294967297");
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Test of wrong decimal type
#
--error 1074
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
--error 1074
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
--error 1074
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
...@@ -72,6 +72,7 @@ set GLOBAL query_cache_size=100000; ...@@ -72,6 +72,7 @@ set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=default; set GLOBAL myisam_max_sort_file_size=default;
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
show variables like 'myisam_max_sort_file_size'; show variables like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10; set global net_retry_count=10, session net_retry_count=10;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <m_string.h> #include <m_string.h>
#include <queues.h> #include <queues.h>
#include "thr_alarm.h" #include "thr_alarm.h"
#include <assert.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* AIX needs this for fd_set */ #include <sys/select.h> /* AIX needs this for fd_set */
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
#define ETIME ETIMEDOUT #define ETIME ETIMEDOUT
#endif #endif
static my_bool alarm_aborted=1; static int alarm_aborted=1; /* No alarm thread */
my_bool thr_alarm_inited=0; my_bool thr_alarm_inited=0;
static sig_handler process_alarm_part2(int sig); static sig_handler process_alarm_part2(int sig);
...@@ -136,19 +137,24 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) ...@@ -136,19 +137,24 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
now=(ulong) time((time_t*) 0); now=(ulong) time((time_t*) 0);
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask); pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */ pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
if (alarm_aborted) if (alarm_aborted > 0)
{ /* No signal thread */ { /* No signal thread */
DBUG_PRINT("info", ("alarm aborted")); DBUG_PRINT("info", ("alarm aborted"));
*alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm); pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL); pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (alarm_aborted < 0)
sec= 1; /* Abort mode */
if (alarm_queue.elements >= max_used_alarms) if (alarm_queue.elements >= max_used_alarms)
{ {
if (alarm_queue.elements == alarm_queue.max_elements) if (alarm_queue.elements == alarm_queue.max_elements)
{ {
DBUG_PRINT("info", ("alarm queue full")); DBUG_PRINT("info", ("alarm queue full"));
fprintf(stderr,"Warning: thr_alarm queue is full\n"); fprintf(stderr,"Warning: thr_alarm queue is full\n");
*alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm); pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL); pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -219,6 +225,7 @@ void thr_end_alarm(thr_alarm_t *alarmed) ...@@ -219,6 +225,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
break; break;
} }
} }
DBUG_ASSERT(!*alarmed || found);
if (!found) if (!found)
{ {
#ifdef MAIN #ifdef MAIN
...@@ -228,14 +235,7 @@ void thr_end_alarm(thr_alarm_t *alarmed) ...@@ -228,14 +235,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n", DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
(long) *alarmed)); (long) *alarmed));
} }
if (alarm_aborted && !alarm_queue.elements) pthread_mutex_unlock(&LOCK_alarm);
{
delete_queue(&alarm_queue);
pthread_mutex_unlock(&LOCK_alarm);
pthread_mutex_destroy(&LOCK_alarm);
}
else
pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL); pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -365,31 +365,49 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) ...@@ -365,31 +365,49 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
/* /*
Shedule all alarms now. Schedule all alarms now and optionally free all structures
When all alarms are given, Free alarm memory and don't allow more alarms.
SYNPOSIS
end_thr_alarm()
free_structures Set to 1 if we should free memory used for
the alarm queue.
When we call this we should KNOW that there
is no active alarms
IMPLEMENTATION
Set alarm_abort to -1 which will change the behavior of alarms as follows:
- All old alarms will be rescheduled at once
- All new alarms will be rescheduled to one second
*/ */
void end_thr_alarm(void) void end_thr_alarm(my_bool free_structures)
{ {
DBUG_ENTER("end_thr_alarm"); DBUG_ENTER("end_thr_alarm");
if (!alarm_aborted) if (alarm_aborted != 1)
{ {
my_bool deleted=0;
pthread_mutex_lock(&LOCK_alarm); pthread_mutex_lock(&LOCK_alarm);
DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements)); DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements));
alarm_aborted=1; /* mark aborted */ alarm_aborted= -1; /* mark aborted */
if (!alarm_queue.elements)
{
deleted= 1;
delete_queue(&alarm_queue);
}
if (pthread_equal(pthread_self(),alarm_thread)) if (pthread_equal(pthread_self(),alarm_thread))
alarm(1); /* Shut down everything soon */ alarm(1); /* Shut down everything soon */
else else
reschedule_alarms(); reschedule_alarms();
pthread_mutex_unlock(&LOCK_alarm); if (free_structures)
if (deleted) {
pthread_mutex_destroy(&LOCK_alarm); /*
The following test is just for safety, the caller should not
depend on this
*/
DBUG_ASSERT(!alarm_queue.elements);
if (!alarm_queue.elements)
{
delete_queue(&alarm_queue);
alarm_aborted= 1;
pthread_mutex_unlock(&LOCK_alarm);
pthread_mutex_destroy(&LOCK_alarm);
}
}
else
pthread_mutex_unlock(&LOCK_alarm);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -629,7 +647,7 @@ void thr_end_alarm(thr_alarm_t *alrm_ptr) ...@@ -629,7 +647,7 @@ void thr_end_alarm(thr_alarm_t *alrm_ptr)
} }
} }
void end_thr_alarm(void) void end_thr_alarm(my_bool free_structures)
{ {
DBUG_ENTER("end_thr_alarm"); DBUG_ENTER("end_thr_alarm");
alarm_aborted=1; /* No more alarms */ alarm_aborted=1; /* No more alarms */
...@@ -708,7 +726,7 @@ void thr_end_alarm(thr_alarm_t *alrm_ptr) ...@@ -708,7 +726,7 @@ void thr_end_alarm(thr_alarm_t *alrm_ptr)
} }
} }
void end_thr_alarm(void) void end_thr_alarm(my_bool free_structures)
{ {
DBUG_ENTER("end_thr_alarm"); DBUG_ENTER("end_thr_alarm");
alarm_aborted=1; /* No more alarms */ alarm_aborted=1; /* No more alarms */
...@@ -907,7 +925,7 @@ static void *signal_hand(void *arg __attribute__((unused))) ...@@ -907,7 +925,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
case SIGHUP: case SIGHUP:
#endif #endif
printf("Aborting nicely\n"); printf("Aborting nicely\n");
end_thr_alarm(); end_thr_alarm(0);
break; break;
#ifdef SIGTSTP #ifdef SIGTSTP
case SIGTSTP: case SIGTSTP:
...@@ -1004,10 +1022,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) ...@@ -1004,10 +1022,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
if (thread_count == 1) if (thread_count == 1)
{ {
printf("Calling end_thr_alarm. This should cancel the last thread\n"); printf("Calling end_thr_alarm. This should cancel the last thread\n");
end_thr_alarm(); end_thr_alarm(0);
} }
} }
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
end_thr_alarm(1);
thr_alarm_info(&alarm_info); thr_alarm_info(&alarm_info);
printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n", printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n",
alarm_info.active_alarms, alarm_info.max_used_alarms, alarm_info.active_alarms, alarm_info.max_used_alarms,
......
...@@ -197,6 +197,9 @@ extern char *innobase_unix_file_flush_method; ...@@ -197,6 +197,9 @@ extern char *innobase_unix_file_flush_method;
/* The following variables have to be my_bool for SHOW VARIABLES to work */ /* The following variables have to be my_bool for SHOW VARIABLES to work */
extern my_bool innobase_log_archive, extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_fast_shutdown; innobase_use_native_aio, innobase_fast_shutdown;
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
}
extern TYPELIB innobase_lock_typelib; extern TYPELIB innobase_lock_typelib;
......
...@@ -38,13 +38,11 @@ void unireg_init(ulong options) ...@@ -38,13 +38,11 @@ void unireg_init(ulong options)
init_my_atof(); /* use our atof */ init_my_atof(); /* use our atof */
#endif #endif
my_abort_hook=unireg_abort; /* Abort with close of databases */ my_abort_hook=unireg_abort; /* Abort with close of databases */
f_fyllchar=' '; /* Input fill char */
VOID(strmov(reg_ext,".frm")); VOID(strmov(reg_ext,".frm"));
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS
dayord.pos[i]=i; dayord.pos[i]=i;
specialflag=SPECIAL_SAME_DB_NAME; specialflag=SPECIAL_SAME_DB_NAME;
blob_newline='^'; /* Convert newline in blobs to this */
/* Make a tab of powers of 10 */ /* Make a tab of powers of 10 */
for (i=0,nr=1.0; i < array_elements(log_10) ; i++) for (i=0,nr=1.0; i < array_elements(log_10) ; i++)
{ /* It's used by filesort... */ { /* It's used by filesort... */
......
...@@ -1071,6 +1071,12 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1071,6 +1071,12 @@ bool MYSQL_LOG::write(Log_event* event_info)
No check for auto events flag here - this write method should No check for auto events flag here - this write method should
never be called if auto-events are enabled never be called if auto-events are enabled
*/ */
/*
1. Write first log events which describe the 'run environment'
of the SQL command
*/
if (thd) if (thd)
{ {
if (thd->last_insert_id_used) if (thd->last_insert_id_used)
...@@ -1109,12 +1115,39 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1109,12 +1115,39 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
/*
If the user has set FOREIGN_KEY_CHECKS=0 we wrap every SQL
command in the binlog inside:
SET FOREIGN_KEY_CHECKS=0;
<command>;
SET FOREIGN_KEY_CHECKS=1;
*/
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS)
{
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=0", 24, 0);
e.set_log_pos(this);
if (e.write(file))
goto err;
}
} }
/* Write the SQL command */
event_info->set_log_pos(this); event_info->set_log_pos(this);
if (event_info->write(file) || if (event_info->write(file))
file == &log_file && flush_io_cache(file))
goto err; goto err;
error=0;
/* Write log events to reset the 'run environment' of the SQL command */
if (thd && thd->options & OPTION_NO_FOREIGN_KEY_CHECKS)
{
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0);
e.set_log_pos(this);
if (e.write(file))
goto err;
}
/* /*
Tell for transactional table handlers up to which position in the Tell for transactional table handlers up to which position in the
...@@ -1135,6 +1168,9 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1135,6 +1168,9 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (file == &log_file) // we are writing to the real log (disk) if (file == &log_file) // we are writing to the real log (disk)
{ {
if (flush_io_cache(file))
goto err;
if (opt_using_transactions && !my_b_tell(&thd->transaction.trans_log)) if (opt_using_transactions && !my_b_tell(&thd->transaction.trans_log))
{ {
/* /*
...@@ -1144,8 +1180,8 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1144,8 +1180,8 @@ bool MYSQL_LOG::write(Log_event* event_info)
handler if the log event type is appropriate. handler if the log event type is appropriate.
*/ */
if (event_info->get_type_code() == QUERY_EVENT if (event_info->get_type_code() == QUERY_EVENT ||
|| event_info->get_type_code() == EXEC_LOAD_EVENT) event_info->get_type_code() == EXEC_LOAD_EVENT)
{ {
error = ha_report_binlog_offset_and_commit(thd, log_file_name, error = ha_report_binlog_offset_and_commit(thd, log_file_name,
file->pos_in_file); file->pos_in_file);
...@@ -1155,6 +1191,7 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1155,6 +1191,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
/* we wrote to the real log, check automatic rotation */ /* we wrote to the real log, check automatic rotation */
should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size); should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size);
} }
error=0;
err: err:
if (error) if (error)
...@@ -1177,13 +1214,14 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1177,13 +1214,14 @@ bool MYSQL_LOG::write(Log_event* event_info)
pthread_mutex_unlock(&LOCK_log); pthread_mutex_unlock(&LOCK_log);
/* Flush the transactional handler log file now that we have released /*
LOCK_log; the flush is placed here to eliminate the bottleneck on the Flush the transactional handler log file now that we have released
group commit */ LOCK_log; the flush is placed here to eliminate the bottleneck on the
group commit
*/
if (called_handler_commit) { if (called_handler_commit)
ha_commit_complete(thd); ha_commit_complete(thd);
}
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -309,15 +309,19 @@ void Load_log_event::pack_info(String* packet) ...@@ -309,15 +309,19 @@ void Load_log_event::pack_info(String* packet)
pretty_print_str(&tmp, sql_ex.escaped, sql_ex.escaped_len); pretty_print_str(&tmp, sql_ex.escaped, sql_ex.escaped_len);
} }
bool line_lexem_added= false;
if (sql_ex.line_term_len) if (sql_ex.line_term_len)
{ {
tmp.append(" LINES TERMINATED BY "); tmp.append(" LINES TERMINATED BY ");
pretty_print_str(&tmp, sql_ex.line_term, sql_ex.line_term_len); pretty_print_str(&tmp, sql_ex.line_term, sql_ex.line_term_len);
line_lexem_added= true;
} }
if (sql_ex.line_start_len) if (sql_ex.line_start_len)
{ {
tmp.append(" LINES STARTING BY "); if (!line_lexem_added)
tmp.append(" LINES");
tmp.append(" STARTING BY ");
pretty_print_str(&tmp, sql_ex.line_start, sql_ex.line_start_len); pretty_print_str(&tmp, sql_ex.line_start, sql_ex.line_start_len);
} }
...@@ -1308,15 +1312,19 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -1308,15 +1312,19 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
pretty_print_str(file, sql_ex.escaped, sql_ex.escaped_len); pretty_print_str(file, sql_ex.escaped, sql_ex.escaped_len);
} }
bool line_lexem_added= false;
if (sql_ex.line_term) if (sql_ex.line_term)
{ {
fprintf(file," LINES TERMINATED BY "); fprintf(file," LINES TERMINATED BY ");
pretty_print_str(file, sql_ex.line_term, sql_ex.line_term_len); pretty_print_str(file, sql_ex.line_term, sql_ex.line_term_len);
line_lexem_added= true;
} }
if (sql_ex.line_start) if (sql_ex.line_start)
{ {
fprintf(file," LINES STARTING BY "); if (!line_lexem_added)
fprintf(file," LINES");
fprintf(file," STARTING BY ");
pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len); pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len);
} }
...@@ -1946,8 +1954,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1946,8 +1954,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
sql_error= ER_UNKNOWN_ERROR; sql_error= ER_UNKNOWN_ERROR;
slave_print_error(rli,sql_error, slave_print_error(rli,sql_error,
"Error '%s' running load data infile", "Error '%s' running load data infile",
sql_error ? thd->net.last_error : ER_SAFE(sql_error));
ER_SAFE(ER_UNKNOWN_ERROR));
free_root(&thd->mem_root,0); free_root(&thd->mem_root,0);
return 1; return 1;
} }
......
...@@ -627,7 +627,6 @@ extern char language[LIBLEN],reg_ext[FN_EXTLEN]; ...@@ -627,7 +627,6 @@ extern char language[LIBLEN],reg_ext[FN_EXTLEN];
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN]; extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], time_zone[30], *opt_init_file; extern char pidfile_name[FN_REFLEN], time_zone[30], *opt_init_file;
extern char log_error_file[FN_REFLEN]; extern char log_error_file[FN_REFLEN];
extern char blob_newline;
extern double log_10[32]; extern double log_10[32];
extern ulonglong keybuff_size; extern ulonglong keybuff_size;
extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables; extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables;
...@@ -658,10 +657,6 @@ extern ulong max_binlog_size, rpl_recovery_rank, thread_cache_size; ...@@ -658,10 +657,6 @@ extern ulong max_binlog_size, rpl_recovery_rank, thread_cache_size;
extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log; extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log;
extern ulong specialflag, current_pid; extern ulong specialflag, current_pid;
#ifdef HAVE_INNOBASE_DB
extern ulong srv_max_buf_pool_modified_pct;
#endif
extern uint test_flags,select_errors,ha_open_options; extern uint test_flags,select_errors,ha_open_options;
extern uint protocol_version,dropping_tables; extern uint protocol_version,dropping_tables;
extern uint delay_key_write_options; extern uint delay_key_write_options;
...@@ -675,8 +670,8 @@ extern uint volatile thread_count, thread_running, global_read_lock; ...@@ -675,8 +670,8 @@ extern uint volatile thread_count, thread_running, global_read_lock;
extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names; extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names;
extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_readonly;
extern my_bool opt_enable_named_pipe; extern my_bool opt_enable_named_pipe;
extern char f_fyllchar;
extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern FILE *bootstrap_file; extern FILE *bootstrap_file;
......
...@@ -289,7 +289,7 @@ my_bool opt_enable_named_pipe= 0; ...@@ -289,7 +289,7 @@ my_bool opt_enable_named_pipe= 0;
my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol; my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol;
uint delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; uint delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
static bool opt_do_pstack = 0; static my_bool opt_do_pstack = 0;
static ulong opt_specialflag=SPECIAL_ENGLISH; static ulong opt_specialflag=SPECIAL_ENGLISH;
static ulong opt_myisam_block_size; static ulong opt_myisam_block_size;
...@@ -306,6 +306,7 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; ...@@ -306,6 +306,7 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool lower_case_table_names, opt_old_rpl_compat; my_bool lower_case_table_names, opt_old_rpl_compat;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0, opt_console= 0; my_bool opt_log_slave_updates= 0, opt_console= 0;
my_bool opt_readonly = 0;
volatile bool mqh_used = 0; volatile bool mqh_used = 0;
FILE *bootstrap_file=0; FILE *bootstrap_file=0;
...@@ -376,7 +377,7 @@ const char *localhost=LOCAL_HOST; ...@@ -376,7 +377,7 @@ const char *localhost=LOCAL_HOST;
const char *delayed_user="DELAYED"; const char *delayed_user="DELAYED";
uint master_port = MYSQL_PORT, master_connect_retry = 60; uint master_port = MYSQL_PORT, master_connect_retry = 60;
uint report_port = MYSQL_PORT; uint report_port = MYSQL_PORT;
bool master_ssl = 0; my_bool master_ssl = 0;
ulong master_retry_count=0; ulong master_retry_count=0;
ulong bytes_sent = 0L, bytes_received = 0L; ulong bytes_sent = 0L, bytes_received = 0L;
...@@ -404,8 +405,7 @@ ulong slow_launch_threads = 0; ...@@ -404,8 +405,7 @@ ulong slow_launch_threads = 0;
char mysql_real_data_home[FN_REFLEN], char mysql_real_data_home[FN_REFLEN],
language[LIBLEN],reg_ext[FN_EXTLEN], language[LIBLEN],reg_ext[FN_EXTLEN],
mysql_charsets_dir[FN_REFLEN], *charsets_list, mysql_charsets_dir[FN_REFLEN], *charsets_list,
blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot, max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file;
*opt_init_file;
char *language_ptr= language; char *language_ptr= language;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
...@@ -596,7 +596,7 @@ static void close_connections(void) ...@@ -596,7 +596,7 @@ static void close_connections(void)
unix_sock= INVALID_SOCKET; unix_sock= INVALID_SOCKET;
} }
#endif #endif
end_thr_alarm(); // Don't allow alarms end_thr_alarm(0); // Abort old alarms.
end_slave(); end_slave();
/* First signal all threads that it's time to die */ /* First signal all threads that it's time to die */
...@@ -905,6 +905,7 @@ void clean_up(bool print_message) ...@@ -905,6 +905,7 @@ void clean_up(bool print_message)
#endif #endif
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */ (void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */
end_key_cache(); end_key_cache();
end_thr_alarm(1); /* Free allocated memory */
#ifdef USE_RAID #ifdef USE_RAID
end_raid(); end_raid();
#endif #endif
...@@ -2313,14 +2314,14 @@ The server will not act as a slave."); ...@@ -2313,14 +2314,14 @@ The server will not act as a slave.");
if (opt_bootstrap) if (opt_bootstrap)
{ {
int error=bootstrap(stdin); int error=bootstrap(stdin);
end_thr_alarm(); // Don't allow alarms end_thr_alarm(1); // Don't allow alarms
unireg_abort(error ? 1 : 0); unireg_abort(error ? 1 : 0);
} }
if (opt_init_file) if (opt_init_file)
{ {
if (read_init_file(opt_init_file)) if (read_init_file(opt_init_file))
{ {
end_thr_alarm(); // Don't allow alarms end_thr_alarm(1); // Don't allow alarms
unireg_abort(1); unireg_abort(1);
} }
} }
...@@ -3143,6 +3144,7 @@ enum options { ...@@ -3143,6 +3144,7 @@ enum options {
OPT_QUERY_CACHE_TYPE, OPT_RECORD_BUFFER, OPT_QUERY_CACHE_TYPE, OPT_RECORD_BUFFER,
OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT, OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT,
OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME, OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
OPT_READONLY,
OPT_SORT_BUFFER, OPT_TABLE_CACHE, OPT_SORT_BUFFER, OPT_TABLE_CACHE,
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
...@@ -3927,6 +3929,11 @@ replicating a LOAD DATA INFILE command", ...@@ -3927,6 +3929,11 @@ replicating a LOAD DATA INFILE command",
"Number of seconds to wait for more data from a master/slave connection before aborting the read.", "Number of seconds to wait for more data from a master/slave connection before aborting the read.",
(gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0, (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"read-only", OPT_READONLY,
"Make all tables readonly, with the expections for replications (slave) threads and users with the SUPER privilege",
(gptr*) &opt_readonly,
(gptr*) &opt_readonly,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME, {"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.", "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
(gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG, (gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
......
...@@ -185,6 +185,7 @@ sys_var_thd_ulong sys_net_retry_count("net_retry_count", ...@@ -185,6 +185,7 @@ sys_var_thd_ulong sys_net_retry_count("net_retry_count",
sys_var_thd_bool sys_new_mode("new", &SV::new_mode); sys_var_thd_bool sys_new_mode("new", &SV::new_mode);
sys_var_thd_ulong sys_read_buff_size("read_buffer_size", sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
&SV::read_buff_size); &SV::read_buff_size);
sys_var_bool_ptr sys_readonly("read_only", &opt_readonly);
sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size", sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size",
&SV::read_rnd_buff_size); &SV::read_rnd_buff_size);
sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank", sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank",
...@@ -375,6 +376,7 @@ sys_var *sys_variables[]= ...@@ -375,6 +376,7 @@ sys_var *sys_variables[]=
&sys_slave_compressed_protocol, &sys_slave_compressed_protocol,
&sys_slave_net_timeout, &sys_slave_net_timeout,
&sys_slave_skip_counter, &sys_slave_skip_counter,
&sys_readonly,
&sys_slow_launch_time, &sys_slow_launch_time,
&sys_sort_buffer, &sys_sort_buffer,
&sys_sql_big_tables, &sys_sql_big_tables,
...@@ -513,6 +515,7 @@ struct show_var_st init_vars[]= { ...@@ -513,6 +515,7 @@ struct show_var_st init_vars[]= {
{"port", (char*) &mysql_port, SHOW_INT}, {"port", (char*) &mysql_port, SHOW_INT},
{"protocol_version", (char*) &protocol_version, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT},
{sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
{sys_readonly.name, (char*) &sys_readonly, SHOW_SYS},
{sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
{sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
......
...@@ -1329,6 +1329,18 @@ mysql_execute_command(void) ...@@ -1329,6 +1329,18 @@ mysql_execute_command(void)
(table_rules_on && tables && thd->slave_thread && (table_rules_on && tables && thd->slave_thread &&
!tables_ok(thd,tables))) !tables_ok(thd,tables)))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
/*
When option readonly is set deny operations which change tables.
Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
!(thd->slave_thread || (thd->master_access & SUPER_ACL)) &&
(uc_update_queries[lex->sql_command] > 0))
{
send_error(&thd->net,ER_CANT_UPDATE_WITH_READLOCK);
DBUG_VOID_RETURN;
}
statistic_increment(com_stat[lex->sql_command],&LOCK_status); statistic_increment(com_stat[lex->sql_command],&LOCK_status);
switch (lex->sql_command) { switch (lex->sql_command) {
...@@ -2977,9 +2989,8 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -2977,9 +2989,8 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->change=change; new_field->change=change;
new_field->interval=0; new_field->interval=0;
new_field->pack_length=0; new_field->pack_length=0;
if (length) if (length && !(new_field->length= (uint) atoi(length)))
if (!(new_field->length= (uint) atoi(length))) length=0; /* purecov: inspected */
length=0; /* purecov: inspected */
uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1; uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1;
if (new_field->length && new_field->decimals && if (new_field->length && new_field->decimals &&
...@@ -3015,10 +3026,13 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -3015,10 +3026,13 @@ bool add_field_to_list(char *field_name, enum_field_types type,
break; break;
case FIELD_TYPE_DECIMAL: case FIELD_TYPE_DECIMAL:
if (!length) if (!length)
new_field->length = 10; // Default length for DECIMAL new_field->length= 10; // Default length for DECIMAL
new_field->length+=sign_len; if (new_field->length < MAX_FIELD_WIDTH) // Skip wrong argument
if (new_field->decimals) {
new_field->length++; new_field->length+=sign_len;
if (new_field->decimals)
new_field->length++;
}
break; break;
case FIELD_TYPE_BLOB: case FIELD_TYPE_BLOB:
case FIELD_TYPE_TINY_BLOB: case FIELD_TYPE_TINY_BLOB:
......
...@@ -182,7 +182,6 @@ int mysql_update(THD *thd, ...@@ -182,7 +182,6 @@ int mysql_update(THD *thd,
*/ */
uint length; uint length;
SORT_FIELD *sortorder; SORT_FIELD *sortorder;
List<Item> fields;
ha_rows examined_rows; ha_rows examined_rows;
table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
......
...@@ -146,7 +146,7 @@ languages and applications need to dynamically load and use MySQL. ...@@ -146,7 +146,7 @@ languages and applications need to dynamically load and use MySQL.
%package Max %package Max
Release: %{release} Release: %{release}
Summary: MySQL - server with Berkeley BD and UDF support Summary: MySQL - server with Berkeley BD, RAID and UDF support
Group: Applications/Databases Group: Applications/Databases
Provides: mysql-Max Provides: mysql-Max
Obsoletes: mysql-Max Obsoletes: mysql-Max
...@@ -154,7 +154,7 @@ Requires: MySQL >= 4.0 ...@@ -154,7 +154,7 @@ Requires: MySQL >= 4.0
%description Max %description Max
Optional MySQL server binary that supports additional features like Optional MySQL server binary that supports additional features like
Berkeley DB and User Defined Functions (UDFs). Berkeley DB, RAID and User Defined Functions (UDFs).
To activate this binary, just install this package in addition to To activate this binary, just install this package in addition to
the standard MySQL package. the standard MySQL package.
...@@ -257,6 +257,7 @@ export PATH ...@@ -257,6 +257,7 @@ export PATH
BuildMySQL "--enable-shared \ BuildMySQL "--enable-shared \
--with-berkeley-db \ --with-berkeley-db \
--with-innodb \ --with-innodb \
--with-raid \
--with-server-suffix='-Max'" --with-server-suffix='-Max'"
# Save everything for debug # Save everything for debug
...@@ -534,6 +535,9 @@ fi ...@@ -534,6 +535,9 @@ fi
%attr(644, root, root) /usr/lib/mysql/libmysqld.a %attr(644, root, root) /usr/lib/mysql/libmysqld.a
%changelog %changelog
* Fri May 16 2003 Lenz Grimmer <lenz@mysql.com>
- re-enabled RAID again
* Wed Apr 30 2003 Lenz Grimmer <lenz@mysql.com> * Wed Apr 30 2003 Lenz Grimmer <lenz@mysql.com>
......
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