summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jani@ua126d19.elisa.omakaista.fi>2003-05-26 15:50:05 +0300
committerunknown <jani@ua126d19.elisa.omakaista.fi>2003-05-26 15:50:05 +0300
commit5dfc7130a8fd1d1976bb4eb125e2bf331d61ef53 (patch)
tree62c32e823dc1e3e082be629987bc943e4dfacad6
parent8b87a1aa0e6328a67c2c72f11612134ed5eb7597 (diff)
parentecdd47a72fe49738549e3e0b2cccec776a6fba26 (diff)
downloadmariadb-git-5dfc7130a8fd1d1976bb4eb125e2bf331d61ef53.tar.gz
Merge jani@192.168.0.2:/my/mysql-4.0
into ua126d19.elisa.omakaista.fi:/home/my/bk/mysql-4.0 BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
-rw-r--r--BUILD/SETUP.sh18
-rw-r--r--BitKeeper/etc/logging_ok2
-rw-r--r--configure.in24
-rw-r--r--include/my_global.h3
-rw-r--r--include/thr_alarm.h2
-rw-r--r--innobase/buf/buf0buf.c11
-rw-r--r--innobase/buf/buf0flu.c36
-rw-r--r--innobase/buf/buf0lru.c49
-rw-r--r--innobase/include/buf0lru.h25
-rw-r--r--innobase/os/os0sync.c18
-rw-r--r--innobase/row/row0ins.c5
-rw-r--r--innobase/srv/srv0start.c33
-rw-r--r--innobase/trx/trx0trx.c2
-rw-r--r--myisam/myisamchk.c3
-rw-r--r--mysql-test/mysql-test-run.sh5
-rw-r--r--mysql-test/r/loaddata.result7
-rw-r--r--mysql-test/r/rpl_insert_id.result2
-rw-r--r--mysql-test/r/rpl_loaddata.result2
-rw-r--r--mysql-test/r/type_decimal.result6
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--mysql-test/std_data/rpl_loaddata2.dat8
-rw-r--r--mysql-test/t/loaddata.test8
-rw-r--r--mysql-test/t/rpl_insert_id.test10
-rw-r--r--mysql-test/t/rpl_loaddata.test3
-rw-r--r--mysql-test/t/type_decimal.test10
-rw-r--r--mysql-test/t/variables.test1
-rw-r--r--mysys/thr_alarm.c75
-rw-r--r--sql/ha_innodb.h3
-rw-r--r--sql/init.cc2
-rw-r--r--sql/log.cc58
-rw-r--r--sql/log_event.cc15
-rw-r--r--sql/mysql_priv.h7
-rw-r--r--sql/mysqld.cc21
-rw-r--r--sql/set_var.cc3
-rw-r--r--sql/sql_parse.cc28
-rw-r--r--sql/sql_update.cc1
-rw-r--r--support-files/mysql.spec.sh8
37 files changed, 358 insertions, 158 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 55b82e38d63..150f9e28b41 100644
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -71,6 +71,22 @@ else
make=make
fi
-if test -z $CXX ; then
+if test -z "$CXX" ; then
CXX=gcc
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
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 8074f38541a..4617e9d697b 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -33,6 +33,7 @@ jani@hynda.mysql.fi
jani@janikt.pp.saunalahti.fi
jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi
+jani@ua126d19.elisa.omakaista.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@mugatu.spaceapes.com
@@ -62,6 +63,7 @@ monty@work.mysql.com
mwagner@cash.mwagner.org
mwagner@evoq.mwagner.org
mwagner@work.mysql.com
+mysqldev@build.mysql2.com
nick@mysql.com
nick@nick.leippe.com
paul@central.snake.net
diff --git a/configure.in b/configure.in
index 3b00f5343ce..9b6a174b0fb 100644
--- a/configure.in
+++ b/configure.in
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# 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)
PROTOCOL_VERSION=10
@@ -361,7 +361,7 @@ then
# we will gets some problems when linking static programs.
# The following code is used to fix this problem.
- if test "$CXX" = "gcc"
+ if test "$CXX" = "gcc" -o "$CXX" = "ccache gcc"
then
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
then
@@ -1025,8 +1025,16 @@ case $SYSTEM_TYPE in
;;
*freebsd*)
echo "Adding fix for interrupted reads"
- CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
- CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
+ OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
+ 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*)
echo "Adding flag -Dunix"
@@ -1369,10 +1377,8 @@ then
with_named_thread="-Kthread -lsocket -lnsl"
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
then
-# AC_DEFINE(HAVE_OpenUNIX8_THREADS)
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
else
-# AC_DEFINE(HAVE_OpenUNIX8_POSIX)
AC_DEFINE(HAVE_UNIXWARE7_POSIX)
fi
# We must have cc
@@ -1381,10 +1387,8 @@ 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; };
else
-# CC="$CC -Kthread -DOpenUNIX8";
-# CXX="$CXX -Kthread -DOpenUNIX8";
- CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
- 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
AC_MSG_RESULT("yes")
else
diff --git a/include/my_global.h b/include/my_global.h
index 31375de30da..15495c60dd7 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -291,7 +291,6 @@ C_MODE_END
#define HAVE_ERRNO_AS_DEFINE
#define HAVE_FCNTL_LOCK
#undef HAVE_FINITE
-#undef HAVE_RINT
#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */
#undef LONGLONG_MAX /* standard system library 'limits.h' */
#endif
@@ -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 array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#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
/* Define some general constants */
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index 30825d49158..439f046252f 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -103,7 +103,7 @@ void init_thr_alarm(uint max_alarm);
bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id);
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);
#ifndef thr_got_alarm
bool thr_got_alarm(thr_alarm_t *alrm);
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 944a5ef60d0..e000d862403 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1613,7 +1613,7 @@ buf_pool_invalidate(void)
freed = TRUE;
while (freed) {
- freed = buf_LRU_search_and_free_block(0);
+ freed = buf_LRU_search_and_free_block(100);
}
mutex_enter(&(buf_pool->mutex));
@@ -1845,7 +1845,8 @@ buf_get_modified_ratio_pct(void)
mutex_enter(&(buf_pool->mutex));
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 */
@@ -1898,8 +1899,10 @@ buf_print_io(
buf += sprintf(buf,
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
- buf_pool->n_flush[BUF_FLUSH_LRU],
- buf_pool->n_flush[BUF_FLUSH_LIST],
+ buf_pool->n_flush[BUF_FLUSH_LRU]
+ + 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]);
current_time = time(NULL);
diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
index d732bf40b57..735966c28c5 100644
--- a/innobase/buf/buf0flu.c
+++ b/innobase/buf/buf0flu.c
@@ -573,15 +573,7 @@ buf_flush_try_neighbors(
low = offset;
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); */
@@ -598,13 +590,20 @@ buf_flush_try_neighbors(
if (block && flush_type == BUF_FLUSH_LRU && i != offset
&& !block->old) {
- /* We avoid flushing 'non-old' blocks in an LRU flush,
- because the flushed blocks are soon freed */
+ /* We avoid flushing 'non-old' blocks in an LRU flush,
+ 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));
@@ -723,7 +722,6 @@ buf_flush_batch(
page_count +=
buf_flush_try_neighbors(space, offset,
flush_type);
-
/* printf(
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
@@ -849,11 +847,19 @@ buf_flush_free_margin(void)
/*=======================*/
{
ulint n_to_flush;
+ ulint n_flushed;
n_to_flush = buf_flush_LRU_recommendation();
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);
+ }
}
}
diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c
index 735a32cf067..eeccbf7728a 100644
--- a/innobase/buf/buf0lru.c
+++ b/innobase/buf/buf0lru.c
@@ -104,12 +104,15 @@ ibool
buf_LRU_search_and_free_block(
/*==========================*/
/* out: TRUE if freed */
- ulint n_iterations __attribute__((unused))) /* in: how many times
- this has been called repeatedly without
- result: a high value means that we should
- search farther */
+ 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 */
{
buf_block_t* block;
+ ulint distance = 0;
ibool freed;
mutex_enter(&(buf_pool->mutex));
@@ -146,6 +149,18 @@ buf_LRU_search_and_free_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) {
@@ -180,7 +195,7 @@ buf_LRU_try_free_flushed_blocks(void)
mutex_exit(&(buf_pool->mutex));
- buf_LRU_search_and_free_block(0);
+ buf_LRU_search_and_free_block(1);
mutex_enter(&(buf_pool->mutex));
}
@@ -200,7 +215,7 @@ buf_LRU_get_free_block(void)
{
buf_block_t* block = NULL;
ibool freed;
- ulint n_iterations = 0;
+ ulint n_iterations = 1;
ibool mon_value_was = 0; /* remove bug */
ibool started_monitor = FALSE;
loop:
@@ -246,14 +261,6 @@ loop:
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 (UT_LIST_GET_LEN(buf_pool->free) > 0) {
@@ -319,6 +326,20 @@ loop:
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) {
os_thread_sleep(500000);
diff --git a/innobase/include/buf0lru.h b/innobase/include/buf0lru.h
index 946b6c4e31d..eb9d43d3b93 100644
--- a/innobase/include/buf0lru.h
+++ b/innobase/include/buf0lru.h
@@ -46,6 +46,20 @@ buf_LRU_get_recent_limit(void);
/*==========================*/
/* 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
free list. If it is empty, blocks are moved from the end of the
LRU list to the free list. */
@@ -86,17 +100,6 @@ void
buf_LRU_make_block_old(
/*===================*/
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. */
diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c
index a9127e6310a..407b280f805 100644
--- a/innobase/os/os0sync.c
+++ b/innobase/os/os0sync.c
@@ -68,9 +68,10 @@ os_event_create(
os_fast_mutex_init(&(event->os_mutex));
#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
- pthread_cond_init(&(event->cond_var), NULL);
+ ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
#endif
event->is_set = FALSE;
@@ -130,7 +131,7 @@ os_event_set(
/* Do nothing */
} else {
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));
@@ -182,7 +183,7 @@ os_event_free(
ut_a(event);
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);
#endif
@@ -446,9 +447,9 @@ os_fast_mutex_init(
InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#else
#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
- pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST);
+ ut_a(0 == pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST));
#endif
#endif
}
@@ -495,10 +496,7 @@ os_fast_mutex_free(
ut_a(fast_mutex);
DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex);
-#elif defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
- pthread_mutex_destroy(fast_mutex);
#else
- UT_NOT_USED(fast_mutex);
-
+ ut_a(0 == pthread_mutex_destroy(fast_mutex));
#endif
}
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index 3af9e1b752b..e96c08a715b 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -1275,6 +1275,10 @@ row_ins_unique_report_err(
dtuple_t* entry, /* in: index entry to insert in the 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;
/* The foreign err mutex protects also dict_unique_err_buf */
@@ -1303,6 +1307,7 @@ row_ins_unique_report_err(
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex);
+#endif
}
/*******************************************************************
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index 552355e5d45..d47af68d663 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -161,13 +161,13 @@ srv_parse_data_file_paths_and_sizes(
}
if (strlen(str) >= ut_strlen(":autoextend")
- && 0 == ut_memcmp(str, ":autoextend",
+ && 0 == ut_memcmp(str, (char*)":autoextend",
ut_strlen(":autoextend"))) {
str += ut_strlen(":autoextend");
if (strlen(str) >= ut_strlen(":max:")
- && 0 == ut_memcmp(str, ":max:",
+ && 0 == ut_memcmp(str, (char*)":max:",
ut_strlen(":max:"))) {
str += ut_strlen(":max:");
@@ -265,7 +265,7 @@ srv_parse_data_file_paths_and_sizes(
(*data_file_sizes)[i] = size;
if (strlen(str) >= ut_strlen(":autoextend")
- && 0 == ut_memcmp(str, ":autoextend",
+ && 0 == ut_memcmp(str, (char*)":autoextend",
ut_strlen(":autoextend"))) {
*is_auto_extending = TRUE;
@@ -273,7 +273,7 @@ srv_parse_data_file_paths_and_sizes(
str += ut_strlen(":autoextend");
if (strlen(str) >= ut_strlen(":max:")
- && 0 == ut_memcmp(str, ":max:",
+ && 0 == ut_memcmp(str, (char*)":max:",
ut_strlen(":max:"))) {
str += ut_strlen(":max:");
@@ -864,6 +864,7 @@ open_or_create_data_files(
return(DB_SUCCESS);
}
+#ifdef notdefined
/*********************************************************************
This thread is used to measure contention of latches. */
static
@@ -935,6 +936,7 @@ test_measure_cont(
return(0);
}
+#endif
/********************************************************************
Starts InnoDB and creates a new database if database files
@@ -1036,20 +1038,24 @@ innobase_start_or_create_for_mysql(void)
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
#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;
- } 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;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
- "littlesync")) {
+ (char*)"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;
#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;
os_aio_use_native_aio = FALSE;
@@ -1157,7 +1163,14 @@ innobase_start_or_create_for_mysql(void)
&max_flushed_lsn, &max_arch_log_no,
&sum_of_new_sizes);
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);
}
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index e6ef400bb40..d73d6327d76 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -1505,6 +1505,8 @@ trx_commit_complete_for_mysql(
trx->op_info = (char *) "";
}
+
+ return(0);
}
/**************************************************************************
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index a3970d65fdf..a7df01e0169 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -45,6 +45,7 @@ static const char *set_charset_name;
static CHARSET_INFO *set_charset;
static long opt_myisam_block_size;
static const char *my_progname_short;
+static int stopwords_inited= 0;
static const char *type_names[]=
{ "?","char","binary", "short", "long", "float",
@@ -861,7 +862,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
else
{
- if (share->fulltext_index)
+ if (share->fulltext_index && !stopwords_inited++)
ft_init_stopwords();
if (!(param->testflag & T_READONLY))
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 40726b776e8..65f40c5dc73 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -19,6 +19,8 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# 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
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
@@ -114,6 +116,7 @@ if test $? != 0; then exit 1; fi
TR=tr
XARGS=`which xargs`
if test $? != 0; then exit 1; fi
+SORT=sort
# Are we using a source or a binary distribution?
@@ -1363,7 +1366,7 @@ then
if [ x$RECORD = x1 ]; then
$ECHO "Will not run in record mode without a specific test case."
else
- for tf in $TESTDIR/*.$TESTSUFFIX
+ for tf in `ls -1 $TESTDIR/*.$TESTSUFFIX | $SORT`
do
run_testcase $tf
done
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index d121a4e6c40..59153f3353a 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -8,4 +8,11 @@ a b c d
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
+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;
diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result
index d524818985e..70f9ff0de0f 100644
--- a/mysql-test/r/rpl_insert_id.result
+++ b/mysql-test/r/rpl_insert_id.result
@@ -23,10 +23,12 @@ drop table t1;
drop table t2;
create table t1(a int auto_increment, key(a));
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 (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
select * from t1;
a
10
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index c1518e8e29a..62071a07d0c 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -7,7 +7,7 @@ slave start;
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;
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));
insert into t3 select * from t2;
select * from t1;
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 4c326957c03..b74765696a2 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -357,3 +357,9 @@ select * from t1;
a
99999999999
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
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 8a6791004ee..7c054f55acd 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -115,7 +115,7 @@ myisam_max_sort_file_size 1048576
set GLOBAL myisam_max_sort_file_size=default;
show variables like 'myisam_max_sort_file_size';
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_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;
diff --git a/mysql-test/std_data/rpl_loaddata2.dat b/mysql-test/std_data/rpl_loaddata2.dat
index 7a3d4ea7695..b883d9dcd58 100644
--- a/mysql-test/std_data/rpl_loaddata2.dat
+++ b/mysql-test/std_data/rpl_loaddata2.dat
@@ -1,8 +1,8 @@
-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%
##
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index ceb5c47af11..e63f0780e3e 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -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 ',' IGNORE 2 LINES;
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;
+
+
+
+
diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test
index 3f3636d3082..a9e4de21e5c 100644
--- a/mysql-test/t/rpl_insert_id.test
+++ b/mysql-test/t/rpl_insert_id.test
@@ -1,6 +1,8 @@
-#see if queries that use both
-#auto_increment and LAST_INSERT_ID()
-#are replicated well
+# See if queries that use both auto_increment and LAST_INSERT_ID()
+# are replicated well
+
+# We also check how the foreign_key_check variable is replicated
+
source include/master-slave.inc;
connection master;
drop table if exists t1;
@@ -22,10 +24,12 @@ drop table t1;
drop table t2;
create table t1(a int auto_increment, key(a));
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 (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 2acb67dfce2..1f34aa9d3f9 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -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;
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' 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));
insert into t3 select * from t2;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 7d5d719592c..7aedc051905 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -230,3 +230,13 @@ insert into t1 values("1e4294967297");
select * from 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));
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index c730f317fcb..fa39906fd6a 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -72,6 +72,7 @@ set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=default;
+--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
show variables like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10;
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index add5335a7af..1b58a0274ff 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -27,6 +27,7 @@
#include <m_string.h>
#include <queues.h>
#include "thr_alarm.h"
+#include <assert.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* AIX needs this for fd_set */
@@ -36,7 +37,7 @@
#define ETIME ETIMEDOUT
#endif
-static my_bool alarm_aborted=1;
+static int alarm_aborted=1; /* No alarm thread */
my_bool thr_alarm_inited=0;
static sig_handler process_alarm_part2(int sig);
@@ -136,19 +137,24 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
now=(ulong) time((time_t*) 0);
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
- if (alarm_aborted)
+ if (alarm_aborted > 0)
{ /* No signal thread */
DBUG_PRINT("info", ("alarm aborted"));
+ *alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1);
}
+ if (alarm_aborted < 0)
+ sec= 1; /* Abort mode */
+
if (alarm_queue.elements >= max_used_alarms)
{
if (alarm_queue.elements == alarm_queue.max_elements)
{
DBUG_PRINT("info", ("alarm queue full"));
fprintf(stderr,"Warning: thr_alarm queue is full\n");
+ *alrm= 0; /* No alarm */
pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1);
@@ -219,6 +225,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
break;
}
}
+ DBUG_ASSERT(!*alarmed || found);
if (!found)
{
#ifdef MAIN
@@ -228,14 +235,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
(long) *alarmed));
}
- if (alarm_aborted && !alarm_queue.elements)
- {
- delete_queue(&alarm_queue);
- pthread_mutex_unlock(&LOCK_alarm);
- pthread_mutex_destroy(&LOCK_alarm);
- }
- else
- pthread_mutex_unlock(&LOCK_alarm);
+ pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_VOID_RETURN;
}
@@ -365,31 +365,49 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
/*
- Shedule all alarms now.
- When all alarms are given, Free alarm memory and don't allow more alarms.
+ Schedule all alarms now and optionally free all structures
+
+ 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");
- if (!alarm_aborted)
+ if (alarm_aborted != 1)
{
- my_bool deleted=0;
pthread_mutex_lock(&LOCK_alarm);
DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements));
- alarm_aborted=1; /* mark aborted */
- if (!alarm_queue.elements)
- {
- deleted= 1;
- delete_queue(&alarm_queue);
- }
+ alarm_aborted= -1; /* mark aborted */
if (pthread_equal(pthread_self(),alarm_thread))
alarm(1); /* Shut down everything soon */
else
reschedule_alarms();
- pthread_mutex_unlock(&LOCK_alarm);
- if (deleted)
- pthread_mutex_destroy(&LOCK_alarm);
+ if (free_structures)
+ {
+ /*
+ 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;
}
@@ -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");
alarm_aborted=1; /* No more alarms */
@@ -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");
alarm_aborted=1; /* No more alarms */
@@ -907,7 +925,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
case SIGHUP:
#endif
printf("Aborting nicely\n");
- end_thr_alarm();
+ end_thr_alarm(0);
break;
#ifdef SIGTSTP
case SIGTSTP:
@@ -1004,10 +1022,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
if (thread_count == 1)
{
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);
+ end_thr_alarm(1);
thr_alarm_info(&alarm_info);
printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n",
alarm_info.active_alarms, alarm_info.max_used_alarms,
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 8309c5eb440..1a9b1b16c64 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -197,6 +197,9 @@ extern char *innobase_unix_file_flush_method;
/* The following variables have to be my_bool for SHOW VARIABLES to work */
extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_fast_shutdown;
+extern "C" {
+extern ulong srv_max_buf_pool_modified_pct;
+}
extern TYPELIB innobase_lock_typelib;
diff --git a/sql/init.cc b/sql/init.cc
index df06ddd41ef..7d90cc564a1 100644
--- a/sql/init.cc
+++ b/sql/init.cc
@@ -38,13 +38,11 @@ void unireg_init(ulong options)
init_my_atof(); /* use our atof */
#endif
my_abort_hook=unireg_abort; /* Abort with close of databases */
- f_fyllchar=' '; /* Input fill char */
VOID(strmov(reg_ext,".frm"));
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS
dayord.pos[i]=i;
specialflag=SPECIAL_SAME_DB_NAME;
- blob_newline='^'; /* Convert newline in blobs to this */
/* Make a tab of powers of 10 */
for (i=0,nr=1.0; i < array_elements(log_10) ; i++)
{ /* It's used by filesort... */
diff --git a/sql/log.cc b/sql/log.cc
index 79ee59eedf8..99bc6ee32b4 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1071,6 +1071,12 @@ bool MYSQL_LOG::write(Log_event* event_info)
No check for auto events flag here - this write method should
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->last_insert_id_used)
@@ -1109,12 +1115,39 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (e.write(file))
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);
- if (event_info->write(file) ||
- file == &log_file && flush_io_cache(file))
+ if (event_info->write(file))
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
@@ -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 (flush_io_cache(file))
+ goto err;
+
if (opt_using_transactions && !my_b_tell(&thd->transaction.trans_log))
{
/*
@@ -1144,8 +1180,8 @@ bool MYSQL_LOG::write(Log_event* event_info)
handler if the log event type is appropriate.
*/
- if (event_info->get_type_code() == QUERY_EVENT
- || event_info->get_type_code() == EXEC_LOAD_EVENT)
+ if (event_info->get_type_code() == QUERY_EVENT ||
+ event_info->get_type_code() == EXEC_LOAD_EVENT)
{
error = ha_report_binlog_offset_and_commit(thd, log_file_name,
file->pos_in_file);
@@ -1155,6 +1191,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
/* we wrote to the real log, check automatic rotation */
should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size);
}
+ error=0;
err:
if (error)
@@ -1177,13 +1214,14 @@ err:
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
- group commit */
+ /*
+ Flush the transactional handler log file now that we have released
+ 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);
- }
DBUG_RETURN(error);
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index bbea89bfd3f..cda2e50c53d 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -309,15 +309,19 @@ void Load_log_event::pack_info(String* packet)
pretty_print_str(&tmp, sql_ex.escaped, sql_ex.escaped_len);
}
+ bool line_lexem_added= false;
if (sql_ex.line_term_len)
{
tmp.append(" LINES TERMINATED BY ");
pretty_print_str(&tmp, sql_ex.line_term, sql_ex.line_term_len);
+ line_lexem_added= true;
}
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);
}
@@ -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);
}
+ bool line_lexem_added= false;
if (sql_ex.line_term)
{
fprintf(file," LINES TERMINATED BY ");
pretty_print_str(file, sql_ex.line_term, sql_ex.line_term_len);
+ line_lexem_added= true;
}
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);
}
@@ -1946,8 +1954,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
sql_error= ER_UNKNOWN_ERROR;
slave_print_error(rli,sql_error,
"Error '%s' running load data infile",
- sql_error ? thd->net.last_error :
- ER_SAFE(ER_UNKNOWN_ERROR));
+ ER_SAFE(sql_error));
free_root(&thd->mem_root,0);
return 1;
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d02202cd7c6..2c28fcf03bb 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -627,7 +627,6 @@ extern char language[LIBLEN],reg_ext[FN_EXTLEN];
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], time_zone[30], *opt_init_file;
extern char log_error_file[FN_REFLEN];
-extern char blob_newline;
extern double log_10[32];
extern ulonglong keybuff_size;
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;
extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log;
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 protocol_version,dropping_tables;
extern uint delay_key_write_options;
@@ -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_safe_show_db, opt_local_infile, lower_case_table_names;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
+extern my_bool opt_readonly;
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 FILE *bootstrap_file;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0211c471ed7..2992fcfd908 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -289,7 +289,7 @@ my_bool opt_enable_named_pipe= 0;
my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol;
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_myisam_block_size;
@@ -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 opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0, opt_console= 0;
+my_bool opt_readonly = 0;
volatile bool mqh_used = 0;
FILE *bootstrap_file=0;
@@ -376,7 +377,7 @@ const char *localhost=LOCAL_HOST;
const char *delayed_user="DELAYED";
uint master_port = MYSQL_PORT, master_connect_retry = 60;
uint report_port = MYSQL_PORT;
-bool master_ssl = 0;
+my_bool master_ssl = 0;
ulong master_retry_count=0;
ulong bytes_sent = 0L, bytes_received = 0L;
@@ -404,8 +405,7 @@ ulong slow_launch_threads = 0;
char mysql_real_data_home[FN_REFLEN],
language[LIBLEN],reg_ext[FN_EXTLEN],
mysql_charsets_dir[FN_REFLEN], *charsets_list,
- blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
- *opt_init_file;
+ max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file;
char *language_ptr= language;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
#ifndef EMBEDDED_LIBRARY
@@ -596,7 +596,7 @@ static void close_connections(void)
unix_sock= INVALID_SOCKET;
}
#endif
- end_thr_alarm(); // Don't allow alarms
+ end_thr_alarm(0); // Abort old alarms.
end_slave();
/* First signal all threads that it's time to die */
@@ -905,6 +905,7 @@ void clean_up(bool print_message)
#endif
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */
end_key_cache();
+ end_thr_alarm(1); /* Free allocated memory */
#ifdef USE_RAID
end_raid();
#endif
@@ -2313,14 +2314,14 @@ The server will not act as a slave.");
if (opt_bootstrap)
{
int error=bootstrap(stdin);
- end_thr_alarm(); // Don't allow alarms
+ end_thr_alarm(1); // Don't allow alarms
unireg_abort(error ? 1 : 0);
}
if (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);
}
}
@@ -3143,6 +3144,7 @@ enum options {
OPT_QUERY_CACHE_TYPE, OPT_RECORD_BUFFER,
OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT,
OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
+ OPT_READONLY,
OPT_SORT_BUFFER, OPT_TABLE_CACHE,
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
@@ -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.",
(gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 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,
"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,
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a45a923ef90..1da187598c4 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -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_ulong sys_read_buff_size("read_buffer_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",
&SV::read_rnd_buff_size);
sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank",
@@ -375,6 +376,7 @@ sys_var *sys_variables[]=
&sys_slave_compressed_protocol,
&sys_slave_net_timeout,
&sys_slave_skip_counter,
+ &sys_readonly,
&sys_slow_launch_time,
&sys_sort_buffer,
&sys_sql_big_tables,
@@ -513,6 +515,7 @@ struct show_var_st init_vars[]= {
{"port", (char*) &mysql_port, SHOW_INT},
{"protocol_version", (char*) &protocol_version, SHOW_INT},
{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_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_QUERY_CACHE
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ad2f7f9a8bd..d9060b4b26e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1329,6 +1329,18 @@ mysql_execute_command(void)
(table_rules_on && tables && thd->slave_thread &&
!tables_ok(thd,tables)))
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);
switch (lex->sql_command) {
@@ -2977,9 +2989,8 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->change=change;
new_field->interval=0;
new_field->pack_length=0;
- if (length)
- if (!(new_field->length= (uint) atoi(length)))
- length=0; /* purecov: inspected */
+ if (length && !(new_field->length= (uint) atoi(length)))
+ length=0; /* purecov: inspected */
uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1;
if (new_field->length && new_field->decimals &&
@@ -3015,10 +3026,13 @@ bool add_field_to_list(char *field_name, enum_field_types type,
break;
case FIELD_TYPE_DECIMAL:
if (!length)
- new_field->length = 10; // Default length for DECIMAL
- new_field->length+=sign_len;
- if (new_field->decimals)
- new_field->length++;
+ new_field->length= 10; // Default length for DECIMAL
+ if (new_field->length < MAX_FIELD_WIDTH) // Skip wrong argument
+ {
+ new_field->length+=sign_len;
+ if (new_field->decimals)
+ new_field->length++;
+ }
break;
case FIELD_TYPE_BLOB:
case FIELD_TYPE_TINY_BLOB:
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index ed4d6fd9b81..b4e7750addf 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -182,7 +182,6 @@ int mysql_update(THD *thd,
*/
uint length;
SORT_FIELD *sortorder;
- List<Item> fields;
ha_rows examined_rows;
table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 9f8b29ab697..aab3e298e14 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -146,7 +146,7 @@ languages and applications need to dynamically load and use MySQL.
%package Max
Release: %{release}
-Summary: MySQL - server with Berkeley BD and UDF support
+Summary: MySQL - server with Berkeley BD, RAID and UDF support
Group: Applications/Databases
Provides: mysql-Max
Obsoletes: mysql-Max
@@ -154,7 +154,7 @@ Requires: MySQL >= 4.0
%description Max
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
the standard MySQL package.
@@ -257,6 +257,7 @@ export PATH
BuildMySQL "--enable-shared \
--with-berkeley-db \
--with-innodb \
+ --with-raid \
--with-server-suffix='-Max'"
# Save everything for debug
@@ -534,6 +535,9 @@ fi
%attr(644, root, root) /usr/lib/mysql/libmysqld.a
%changelog
+* Fri May 16 2003 Lenz Grimmer <lenz@mysql.com>
+
+- re-enabled RAID again
* Wed Apr 30 2003 Lenz Grimmer <lenz@mysql.com>