summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSinisa@sinisa.nasamreza.org <>2003-07-18 14:14:20 +0300
committerSinisa@sinisa.nasamreza.org <>2003-07-18 14:14:20 +0300
commit40756106a9333b56d10cebbf3413a09acc6e3622 (patch)
tree32f5d77d450770578673557993006106e75d3f5e
parent9e876442854d48115b8a2010edc04f8439f649f7 (diff)
parent1054633f74e001397b97c988772da40535f44f96 (diff)
downloadmariadb-git-40756106a9333b56d10cebbf3413a09acc6e3622.tar.gz
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/work/mysql-4.0
-rw-r--r--BitKeeper/etc/logging_ok2
-rwxr-xr-xBuild-tools/Bootstrap5
-rw-r--r--Docs/Makefile.am2
-rwxr-xr-xDocs/Support/generate-text-files.pl9
-rw-r--r--acinclude.m428
-rw-r--r--client/get_password.c2
-rw-r--r--extra/perror.c2
-rw-r--r--innobase/include/os0file.h6
-rw-r--r--innobase/include/srv0srv.h1
-rw-r--r--innobase/os/os0file.c117
-rw-r--r--innobase/srv/srv0srv.c54
-rw-r--r--innobase/srv/srv0start.c4
-rw-r--r--myisam/mi_check.c22
-rw-r--r--myisam/mi_key.c2
-rw-r--r--myisammrg/myrg_open.c9
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/ctype_latin1_de.result3
-rw-r--r--mysql-test/r/func_set.result3
-rw-r--r--mysql-test/r/insert_select.result5
-rw-r--r--mysql-test/r/rpl_error_ignored_table.result2
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result2
-rw-r--r--mysql-test/r/rpl_max_relay_size.result12
-rw-r--r--mysql-test/t/create.test7
-rw-r--r--mysql-test/t/ctype_latin1_de.test4
-rw-r--r--mysql-test/t/func_set.test1
-rw-r--r--mysql-test/t/insert_select.test10
-rw-r--r--mysql-test/t/rpl_error_ignored_table-slave.opt2
-rw-r--r--mysql-test/t/rpl_error_ignored_table.test3
-rw-r--r--mysql-test/t/rpl_flush_log_loop.test1
-rw-r--r--mysql-test/t/rpl_max_relay_size.test6
-rw-r--r--mysys/safemalloc.c6
-rw-r--r--mysys/thr_lock.c21
-rw-r--r--scripts/mysqld_safe.sh12
-rw-r--r--scripts/mysqlhotcopy.sh70
-rw-r--r--sql/ha_innodb.h1
-rw-r--r--sql/handler.cc3
-rw-r--r--sql/item_cmpfunc.cc17
-rw-r--r--sql/item_strfunc.cc4
-rw-r--r--sql/log.cc389
-rw-r--r--sql/mysqld.cc24
-rw-r--r--sql/share/english/errmsg.txt2
-rw-r--r--sql/slave.cc20
-rw-r--r--sql/sql_acl.cc6
-rw-r--r--sql/sql_class.h22
-rw-r--r--sql/sql_repl.cc4
-rw-r--r--sql/sql_select.cc1
-rw-r--r--strings/ctype-latin1_de.c157
-rw-r--r--support-files/my-innodb-heavy-4G.cnf.sh570
-rw-r--r--vio/viosocket.c2
49 files changed, 933 insertions, 726 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index be9d7b77650..e6124b4111e 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -56,6 +56,7 @@ monty@bitch.mysql.fi
monty@butch.
monty@donna.mysql.fi
monty@hundin.mysql.fi
+monty@mashka.(none)
monty@mashka.mysql.fi
monty@narttu.
monty@narttu.mysql.fi
@@ -71,6 +72,7 @@ mysqldev@build.mysql2.com
nick@mysql.com
nick@nick.leippe.com
paul@central.snake.net
+paul@ice.local
paul@teton.kitebird.com
pem@mysql.com
peter@linux.local
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index 9f5fc37736d..20cd5a089bd 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -38,11 +38,13 @@ $opt_export_only= undef;
$opt_help= $opt_verbose= 0;
$opt_log= undef;
$opt_mail= "";
+$opt_revision= undef;
$opt_suffix= "";
$opt_test= undef;
$opt_skip_check= undef;
$opt_skip_manual= undef;
$version= "unknown";
+$major=$minor=$release=0;
GetOptions(
"build-command|b=s",
@@ -149,6 +151,7 @@ if (!$opt_dry_run)
{
m/^AM_INIT_AUTOMAKE\(mysql, ([1-9]\.[0-9]{1,2}\.[0-9]{1,2}.*)\)/;
$version= $1;
+ ($major, $minor, $release) = split(/\./,$version);
}
&logger("Found version string: $version");
@@ -218,7 +221,7 @@ if (defined $opt_changelog)
{
if (!$opt_revision)
{
- $revision= `bk changes -t -d':REV:' -n $REPO | head -1`;
+ $revision= `bk changes -t -d':REV:::TAG:' -n $REPO | grep mysql-$major.$minor | head -1 | cut -f1 -d ":"`;
}
else
{
diff --git a/Docs/Makefile.am b/Docs/Makefile.am
index f3df055a7dd..0beaa44c7eb 100644
--- a/Docs/Makefile.am
+++ b/Docs/Makefile.am
@@ -208,7 +208,7 @@ INSTALL-BINARY: mysql.info $(GT)
perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@
../support-files/MacOSX/ReadMe.txt: mysql.info $(GT)
- perl -w $(GT) mysql.info "Mac OS X installation" "Netware installation" > $@
+ perl -w $(GT) mysql.info "Mac OS X installation" "NetWare installation" > $@
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/Docs/Support/generate-text-files.pl b/Docs/Support/generate-text-files.pl
index 570e579d926..6470baaa6e9 100755
--- a/Docs/Support/generate-text-files.pl
+++ b/Docs/Support/generate-text-files.pl
@@ -1,11 +1,11 @@
-#!/my/gnu/bin/perl -w -*- perl -*-
+#!/usr/bin/perl -w -*- perl -*-
# Generate text files from top directory from the manual.
$from = shift(@ARGV);
$fnode = shift(@ARGV);
$tnode = shift(@ARGV);
-open(IN, "$from") || die;
+open(IN, "$from") || die "Cannot open $from: $!";
$in = 0;
@@ -19,7 +19,7 @@ while (<IN>)
}
elsif (/^File: mysql.info/ || (/^/))
{
- # Just Skip node begginigs
+ # Just Skip node beginnings
}
else
{
@@ -38,3 +38,6 @@ while (<IN>)
}
close(IN);
+
+die "Could not find node \"$tnode\"" if ($in == 1);
+exit 0;
diff --git a/acinclude.m4 b/acinclude.m4
index abeb2024f4a..3bee4e7a874 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -126,12 +126,19 @@ AC_DEFUN(MYSQL_CHECK_ZLIB_WITH_COMPRESS, [
save_LIBS="$LIBS"
LIBS="-l$1 $LIBS"
AC_CACHE_CHECK([if libz with compress], mysql_cv_compress,
-[AC_TRY_LINK([#include <zlib.h>
+[AC_TRY_RUN([#include <zlib.h>
#ifdef __cplusplus
extern "C"
#endif
-],
-[ return compress(0, (unsigned long*) 0, "", 0);
+int main(int argv, char **argc)
+{
+ return 0;
+}
+
+int link_test()
+{
+ return compress(0, (unsigned long*) 0, "", 0);
+}
], mysql_cv_compress=yes, mysql_cv_compress=no)])
if test "$mysql_cv_compress" = "yes"
then
@@ -706,7 +713,7 @@ AC_DEFUN(MYSQL_FIND_OPENSSL, [
/usr/include/ssl /opt/ssl/include /opt/openssl/include \
/usr/local/ssl/include /usr/local/include ; do
if test -f $d/openssl/ssl.h ; then
- OPENSSL_INCLUDE=$d
+ OPENSSL_INCLUDE=-I$d
fi
done
@@ -717,6 +724,15 @@ AC_DEFUN(MYSQL_FIND_OPENSSL, [
fi
done
+ # On RedHat 9 we need kerberos to compile openssl
+ for d in /usr/kerberos/include
+ do
+ if test -f $d/krb5.h ; then
+ OPENSSL_INCLUDE="$OPENSSL_INCLUDE -I$d"
+ fi
+ done
+
+
if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INCLUDE" ; then
echo "Could not find an installation of OpenSSL"
if test -n "$OPENSSL_LIB" ; then
@@ -749,9 +765,9 @@ AC_MSG_CHECKING(for OpenSSL)
openssl_libs="-L$OPENSSL_LIB -lssl -lcrypto"
# Don't set openssl_includes to /usr/include as this gives us a lot of
# compiler warnings when using gcc 3.x
- if test "$OPENSSL_INCLUDE" != "/usr/include"
+ if test "$OPENSSL_INCLUDE" != "-I/usr/include"
then
- openssl_includes="-I$OPENSSL_INCLUDE"
+ openssl_includes="$OPENSSL_INCLUDE"
fi
AC_DEFINE(HAVE_OPENSSL)
diff --git a/client/get_password.c b/client/get_password.c
index 9928d24de32..5d78656ab0a 100644
--- a/client/get_password.c
+++ b/client/get_password.c
@@ -71,7 +71,7 @@ char *get_tty_password(char *opt_message)
char *pos=to,*end=to+sizeof(to)-1;
int i=0;
DBUG_ENTER("get_tty_password");
- fprintf(stderr,opt_message ? opt_message : "Enter password: ");
+ _cputs(opt_message ? opt_message : "Enter password: ");
for (;;)
{
char tmp;
diff --git a/extra/perror.c b/extra/perror.c
index a2951bff66a..ca6bbfb54f9 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -111,7 +111,7 @@ static void usage(void)
{
print_version();
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
- printf("Print a description for a system error code or a error code from\na MyISAM/ISAM/BDB table handler.\n");
+ printf("Print a description for a system error code or an error code from\na MyISAM/ISAM/BDB table handler.\n");
printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
my_print_help(my_long_options);
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 1ec8b71d069..5c52f0e92bf 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -175,7 +175,11 @@ os_file_create(
file is created (if exists, error), OS_FILE_OVERWRITE
if a new file is created or an old overwritten */
ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
- is desired, OS_FILE_NORMAL, if any normal file */
+ is desired, OS_FILE_NORMAL, if any normal file;
+ NOTE that it also depends on type, os_aio_.. and srv_..
+ variables whether we really use async i/o or
+ unbuffered i/o: look in the function source code for
+ the exact rules */
ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
ibool* success);/* out: TRUE if succeed, FALSE if error */
/***************************************************************************
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index 1e54d7bfc35..f4255fc9a98 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -168,6 +168,7 @@ what these mean */
#define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4
+#define SRV_UNIX_O_DIRECT 5
/* Alternatives for file i/o in Windows */
#define SRV_WIN_IO_NORMAL 1
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 612bd534fd1..a9a64ae7864 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -211,9 +211,9 @@ os_file_get_last_error(void)
if (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Operating system error number %li in a file operation.\n"
+ " InnoDB: Operating system error number %lu in a file operation.\n"
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
- (long) err);
+ err);
if (err == ERROR_PATH_NOT_FOUND) {
fprintf(stderr,
@@ -255,9 +255,9 @@ os_file_get_last_error(void)
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Operating system error number %li in a file operation.\n"
+ " InnoDB: Operating system error number %lu in a file operation.\n"
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
- (long) err);
+ err);
if (err == ENOENT) {
fprintf(stderr,
@@ -351,7 +351,8 @@ os_file_handle_error(
fprintf(stderr, "InnoDB: File name %s\n", name);
}
- fprintf(stderr, "InnoDB: System call %s.\n", operation);
+ fprintf(stderr, "InnoDB: File operation call: '%s'.\n",
+ operation);
fprintf(stderr, "InnoDB: Cannot continue operation.\n");
fflush(stderr);
@@ -599,7 +600,11 @@ os_file_create(
file is created (if exists, error), OS_FILE_OVERWRITE
if a new is created or an old overwritten */
ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
- is desired, OS_FILE_NORMAL, if any normal file */
+ is desired, OS_FILE_NORMAL, if any normal file;
+ NOTE that it also depends on type, os_aio_.. and srv_..
+ variables whether we really use async i/o or
+ unbuffered i/o: look in the function source code for
+ the exact rules */
ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
ibool* success)/* out: TRUE if succeed, FALSE if error */
{
@@ -624,8 +629,8 @@ try_again:
}
if (purpose == OS_FILE_AIO) {
- /* use asynchronous (overlapped) io and no buffering
- of writes in the OS */
+ /* If specified, use asynchronous (overlapped) io and no
+ buffering of writes in the OS */
attributes = 0;
#ifdef WIN_ASYNC_IO
if (os_aio_use_native_aio) {
@@ -633,17 +638,13 @@ try_again:
}
#endif
#ifdef UNIV_NON_BUFFERED_IO
- if (type == OS_LOG_FILE) {
+ if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
/* Do not use unbuffered i/o to log files because
- to allow group commit to work when MySQL binlogging
- is used we must separate log file write and log
- file flush to disk. */
- } else {
- if (srv_win_file_flush_method ==
- SRV_WIN_IO_UNBUFFERED) {
- attributes = attributes
- | FILE_FLAG_NO_BUFFERING;
- }
+ value 2 denotes that we do not flush the log at every
+ commit, but only once per second */
+ } else if (srv_win_file_flush_method ==
+ SRV_WIN_IO_UNBUFFERED) {
+ attributes = attributes | FILE_FLAG_NO_BUFFERING;
}
#endif
} else if (purpose == OS_FILE_NORMAL) {
@@ -653,12 +654,9 @@ try_again:
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
- } else {
- if (srv_win_file_flush_method ==
- SRV_WIN_IO_UNBUFFERED) {
- attributes = attributes
- | FILE_FLAG_NO_BUFFERING;
- }
+ } else if (srv_win_file_flush_method ==
+ SRV_WIN_IO_UNBUFFERED) {
+ attributes = attributes | FILE_FLAG_NO_BUFFERING;
}
#endif
} else {
@@ -700,30 +698,70 @@ try_again:
os_file_t file;
int create_flag;
ibool retry;
+ const char* mode_str = NULL;
+ const char* type_str = NULL;
+ const char* purpose_str = NULL;
try_again:
ut_a(name);
if (create_mode == OS_FILE_OPEN) {
+ mode_str = "OPEN";
+
create_flag = O_RDWR;
} else if (create_mode == OS_FILE_CREATE) {
+ mode_str = "CREATE";
+
create_flag = O_RDWR | O_CREAT | O_EXCL;
} else if (create_mode == OS_FILE_OVERWRITE) {
+ mode_str = "OVERWRITE";
+
create_flag = O_RDWR | O_CREAT | O_TRUNC;
} else {
create_flag = 0;
ut_error;
}
- UT_NOT_USED(purpose);
+ if (type == OS_LOG_FILE) {
+ type_str = "LOG";
+ } else if (type == OS_DATA_FILE) {
+ type_str = "DATA";
+ } else {
+ ut_a(0);
+ }
+
+ if (purpose == OS_FILE_AIO) {
+ purpose_str = "AIO";
+ } else if (purpose == OS_FILE_NORMAL) {
+ purpose_str = "NORMAL";
+ } else {
+ ut_a(0);
+ }
+/* printf("Opening file %s, mode %s, type %s, purpose %s\n",
+ name, mode_str, type_str, purpose_str); */
#ifdef O_SYNC
- if ((!srv_use_doublewrite_buf || type != OS_DATA_FILE)
+ /* We let O_SYNC only affect log files; note that we map O_DSYNC to
+ O_SYNC because the datasync options seemed to corrupt files in 2001
+ in both Linux and Solaris */
+ if (type == OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
+/* printf("Using O_SYNC for file %s\n", name); */
+
create_flag = create_flag | O_SYNC;
}
#endif
+#ifdef O_DIRECT
+ /* We let O_DIRECT only affect data files */
+ if (type != OS_LOG_FILE
+ && srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
+
+/* printf("Using O_DIRECT for file %s\n", name); */
+
+ create_flag = create_flag | O_DIRECT;
+ }
+#endif
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, os_innodb_umask);
} else {
@@ -1319,6 +1357,7 @@ os_file_write(
DWORD high;
ulint i;
ulint n_retries = 0;
+ ulint err;
ut_a((offset & 0xFFFFFFFF) == offset);
@@ -1386,18 +1425,27 @@ retry:
if (!os_has_said_disk_full) {
+ err = (ulint)GetLastError();
+
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
"InnoDB: %lu bytes should have been written, only %lu were written.\n"
"InnoDB: Operating system error number %lu.\n"
-"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
-"InnoDB: what the error number means.\n"
"InnoDB: Check that your OS and file system support files of this size.\n"
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
name, offset_high, offset, n, (ulint)len,
- (ulint)GetLastError());
+ err);
+
+ if (strerror((int)err) != NULL) {
+ fprintf(stderr,
+"InnoDB: Error number %lu means '%s'.\n", err, strerror((int)err));
+ }
+
+ fprintf(stderr,
+"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
+"InnoDB: about operating system error numbers.\n");
os_has_said_disk_full = TRUE;
}
@@ -1421,12 +1469,19 @@ retry:
" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
"InnoDB: %lu bytes should have been written, only %ld were written.\n"
"InnoDB: Operating system error number %lu.\n"
-"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
-"InnoDB: what the error number means or use the perror program of MySQL.\n"
"InnoDB: Check that your OS and file system support files of this size.\n"
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
name, offset_high, offset, n, (long int)ret,
(ulint)errno);
+ if (strerror(errno) != NULL) {
+ fprintf(stderr,
+"InnoDB: Error number %lu means '%s'.\n", (ulint)errno, strerror(errno));
+ }
+
+ fprintf(stderr,
+"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
+"InnoDB: about operating system error numbers.\n");
+
os_has_said_disk_full = TRUE;
}
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index a2314cde2dd..f81b2d0a60e 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -1739,7 +1739,7 @@ srv_conc_enter_innodb(
trx_t* trx) /* in: transaction object associated with the
thread */
{
- ibool has_slept = FALSE;
+ ibool has_slept = FALSE;
srv_conc_slot_t* slot;
ulint i;
char err_buf[1000];
@@ -1758,9 +1758,9 @@ srv_conc_enter_innodb(
return;
}
-retry:
- os_fast_mutex_lock(&srv_conc_mutex);
+ os_fast_mutex_lock(&srv_conc_mutex);
+retry:
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
@@ -1769,6 +1769,9 @@ retry:
fprintf(stderr,
" InnoDB: Error: trying to declare trx to enter InnoDB, but\n"
"InnoDB: it already is declared.\n%s\n", err_buf);
+ os_fast_mutex_unlock(&srv_conc_mutex);
+
+ return;
}
if (srv_conc_n_threads < (lint)srv_thread_concurrency) {
@@ -1782,21 +1785,27 @@ retry:
return;
}
- /* If the transaction is not holding resources, let it sleep
- for 100 milliseconds, and try again then */
-
+ /* If the transaction is not holding resources, let it sleep for 50
+ milliseconds, and try again then */
+
if (!has_slept && !trx->has_search_latch
&& NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
- has_slept = TRUE; /* We let is sleep only once to avoid
- starvation */
+ has_slept = TRUE; /* We let is sleep only once to avoid
+ starvation */
- os_fast_mutex_unlock(&srv_conc_mutex);
+ srv_conc_n_waiting_threads++;
- os_thread_sleep(100000);
+ os_fast_mutex_unlock(&srv_conc_mutex);
+
+ os_thread_sleep(50000);
+
+ os_fast_mutex_lock(&srv_conc_mutex);
+
+ srv_conc_n_waiting_threads--;
goto retry;
- }
+ }
/* Too many threads inside: put the current thread to a queue */
@@ -2110,7 +2119,8 @@ srv_suspend_mysql_thread(
os_event_t event;
double wait_time;
trx_t* trx;
- ibool had_dict_lock = FALSE;
+ ibool had_dict_lock = FALSE;
+ ibool was_declared_inside_innodb = FALSE;
ut_ad(!mutex_own(&kernel_mutex));
@@ -2158,11 +2168,16 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
- /* We must declare this OS thread to exit InnoDB, since a possible
- other thread holding a lock which this thread waits for must be
- allowed to enter, sooner or later */
+ if (trx->declared_to_be_inside_innodb) {
+
+ was_declared_inside_innodb = TRUE;
- srv_conc_force_exit_innodb(thr_get_trx(thr));
+ /* We must declare this OS thread to exit InnoDB, since a
+ possible other thread holding a lock which this thread waits
+ for must be allowed to enter, sooner or later */
+
+ srv_conc_force_exit_innodb(trx);
+ }
/* Release possible foreign key check latch */
if (trx->dict_operation_lock_mode == RW_S_LATCH) {
@@ -2183,9 +2198,12 @@ srv_suspend_mysql_thread(
row_mysql_freeze_data_dictionary(trx);
}
- /* Return back inside InnoDB */
+ if (was_declared_inside_innodb) {
+
+ /* Return back inside InnoDB */
- srv_conc_force_enter_innodb(thr_get_trx(thr));
+ srv_conc_force_enter_innodb(trx);
+ }
mutex_enter(&kernel_mutex);
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index 964e728b23c..a85c3615c1b 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -1056,6 +1056,10 @@ innobase_start_or_create_for_mysql(void)
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
+ (char*)"O_DIRECT")) {
+ srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
+
+ } else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 92641cce13a..6caacd95386 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -896,7 +896,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if (_mi_rec_unpack(info,record,info->rec_buff,block_info.rec_len) ==
MY_FILE_ERROR)
{
- mi_check_print_error(param,"Found wrong record at %s", llstr(start_recpos,llbuff));
+ mi_check_print_error(param,"Found wrong record at %s",
+ llstr(start_recpos,llbuff));
got_error=1;
}
else
@@ -3611,6 +3612,7 @@ err:
void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
my_bool repair_only)
{
+ byte *record;
if (!info->s->base.auto_key ||
!(((ulonglong) 1 << (info->s->base.auto_key-1)
& info->s->state.key_map)))
@@ -3624,13 +3626,24 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
if (!(param->testflag & T_SILENT) &&
!(param->testflag & T_REP))
printf("Updating MyISAM file: %s\n", param->isam_file_name);
- /* We have to use keyread here as a normal read uses info->rec_buff */
+ /*
+ We have to use an allocated buffer instead of info->rec_buff as
+ _mi_put_key_in_record() may use info->rec_buff
+ */
+ if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength,
+ MYF(0))))
+ {
+ mi_check_print_error(param,"Not enough memory for extra record");
+ return;
+ }
+
mi_extra(info,HA_EXTRA_KEYREAD,0);
- if (mi_rlast(info,info->rec_buff, info->s->base.auto_key-1))
+ if (mi_rlast(info, record, info->s->base.auto_key-1))
{
if (my_errno != HA_ERR_END_OF_FILE)
{
mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
+ my_free((char*) record, MYF(0));
mi_check_print_error(param,"%d when reading last record",my_errno);
return;
}
@@ -3642,10 +3655,11 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
ulonglong auto_increment= (repair_only ? info->s->state.auto_increment :
param->auto_increment_value);
info->s->state.auto_increment=0;
- update_auto_increment(info,info->rec_buff);
+ update_auto_increment(info, record);
set_if_bigger(info->s->state.auto_increment,auto_increment);
}
mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
+ my_free((char*) record, MYF(0));
update_state_info(param, info, UPDATE_AUTO_INC);
return;
}
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index 5b167cc9ab0..89f6bc490fa 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -264,7 +264,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
byte *blob_ptr;
DBUG_ENTER("_mi_put_key_in_record");
- if (info->blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
+ if (info->s->base.blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
{
if (!(blob_ptr=
mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength,
diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c
index 7ff00270c68..5188669cad1 100644
--- a/myisammrg/myrg_open.c
+++ b/myisammrg/myrg_open.c
@@ -33,7 +33,7 @@
MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
int save_errno,i,errpos;
- uint files,dir_length,length,options, key_parts;
+ uint files,dir_length,length,key_parts;
ulonglong file_offset;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO info,*m_info;
@@ -110,13 +110,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
}
errpos=2;
- options= (uint) ~0;
for (i=files ; i-- > 0 ; )
{
uint j;
m_info->open_tables[i].table=isam;
m_info->options|=isam->s->options;
- options&=isam->s->options;
m_info->records+=isam->state->records;
m_info->del+=isam->state->del;
m_info->data_file_length+=isam->state->data_file_length;
@@ -125,9 +123,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if (i)
isam=(MI_INFO*) (isam->open_list.next->data);
}
- /* Don't force readonly if not all tables are readonly */
- if (! (options & (HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA)))
- m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA);
+ /* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */
+ m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA);
/* Fix fileinfo for easyer debugging (actually set by rrnd) */
file_offset=0;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 2e2aa41c671..e6192eb6ccb 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -176,3 +176,5 @@ Column 'k1' cannot be null
insert into t1 values (NULL, NULL);
Column 'k1' cannot be null
drop table t1;
+create table t1 select x'4132';
+drop table t1;
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index 630fef9b679..28394d9533a 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -196,6 +196,9 @@ strcmp('ßa','ss') strcmp('ssa','ß') strcmp('sssb','sßa') strcmp('ß','s')
select strcmp('u','öa'),strcmp('u','ö');
strcmp('u','öa') strcmp('u','ö')
1 1
+select strcmp('sä', 'ßa'), strcmp('aä', 'äx');
+strcmp('sä', 'ßa') strcmp('aä', 'äx')
+-1 -1
create table t1 (a varchar(10), key(a), fulltext (a));
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
select * from t1 where a like "abc%";
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 5305c16c5d9..eeeb216d142 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -25,3 +25,6 @@ find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c")
select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc")
1 0 0
+select interval(null, 1, 10, 100);
+interval(null, 1, 10, 100)
+-1
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index c007191b562..0142ef68993 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -587,3 +587,8 @@ a b
3 t2:3
2 t2:2
drop table t1,t2;
+CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
+CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
+INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
+INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
+drop table t1,t2;
diff --git a/mysql-test/r/rpl_error_ignored_table.result b/mysql-test/r/rpl_error_ignored_table.result
index 826e97a8004..e1486220542 100644
--- a/mysql-test/r/rpl_error_ignored_table.result
+++ b/mysql-test/r/rpl_error_ignored_table.result
@@ -9,7 +9,7 @@ insert into t1 values (1),(1);
Duplicate entry '1' for key 1
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254
+127.0.0.1 root MASTER_PORT 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254
show tables like 't1';
Tables_in_test (t1)
drop table t1;
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index 3273ce43a17..18786b1931b 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -14,4 +14,4 @@ slave start;
flush logs;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.002 119 slave-bin.001 Yes Yes 0 0 79 119
+127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.002 4 slave-bin.001 Yes Yes 0 0 79 4
diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_max_relay_size.result
index 5c5a9d622e5..1fa3fcd1adb 100644
--- a/mysql-test/r/rpl_max_relay_size.result
+++ b/mysql-test/r/rpl_max_relay_size.result
@@ -16,7 +16,7 @@ select @@global.max_relay_log_size;
start slave;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 master-bin.001 50477 slave-relay-bin.014 1221 master-bin.001 Yes Yes 0 0 50477 1221
+127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.014 1221 master-bin.001 Yes Yes 0 0 50477 1221
stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
@@ -26,7 +26,7 @@ select @@global.max_relay_log_size;
start slave;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 master-bin.001 50477 slave-relay-bin.004 9457 master-bin.001 Yes Yes 0 0 50477 9457
+127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.004 9457 master-bin.001 Yes Yes 0 0 50477 9457
stop slave;
reset slave;
set global max_relay_log_size=0;
@@ -36,25 +36,25 @@ select @@global.max_relay_log_size;
start slave;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 master-bin.001 50477 slave-relay-bin.008 1283 master-bin.001 Yes Yes 0 0 50477 1283
+127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.008 1283 master-bin.001 Yes Yes 0 0 50477 1283
stop slave;
reset slave;
flush logs;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 4 slave-relay-bin.001 4 No No 0 0 0 4
+127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
reset slave;
start slave;
flush logs;
create table t1 (a int);
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 master-bin.001 50535 slave-relay-bin.009 62 master-bin.001 Yes Yes 0 0 50535 62
+127.0.0.1 root MASTER_PORT 1 master-bin.001 50535 slave-relay-bin.009 62 master-bin.001 Yes Yes 0 0 50535 62
flush logs;
drop table t1;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root 9306 1 master-bin.001 50583 slave-relay-bin.010 52 master-bin.001 Yes Yes 0 0 50583 52
+127.0.0.1 root MASTER_PORT 1 master-bin.001 50583 slave-relay-bin.010 52 master-bin.001 Yes Yes 0 0 50583 52
flush logs;
show master status;
File Position Binlog_do_db Binlog_ignore_db
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 86c3f6be0f5..d46807f1dca 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -127,3 +127,10 @@ insert into t1 values ("a", 1), ("b", 2);
!$1048 insert into t1 values (NULL, 3);
!$1048 insert into t1 values (NULL, NULL);
drop table t1;
+
+#
+# Bug # 801
+#
+
+create table t1 select x'4132';
+drop table t1;
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
index 6353650f420..3a0f2658969 100644
--- a/mysql-test/t/ctype_latin1_de.test
+++ b/mysql-test/t/ctype_latin1_de.test
@@ -35,6 +35,10 @@ select strcmp('ßa','ss'),strcmp('ssa','ß'),strcmp('sssb','sßa'),strcmp('ß','s');
select strcmp('u','öa'),strcmp('u','ö');
#
+# overlapping combo's
+#
+select strcmp('sä', 'ßa'), strcmp('aä', 'äx');
+#
# Some other simple tests with the current character set
#
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index cb1aa543d43..81f561989d5 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -15,3 +15,4 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N",""
select elt(2,1),field(NULL,"a","b","c");
select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c");
select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
+select interval(null, 1, 10, 100);
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index d115e9c1af6..5c63f3b3bb7 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -122,3 +122,13 @@ select * from t1;
replace into t1 select * from t2;
select * from t1;
drop table t1,t2;
+
+#
+# Test that caused uninitialized memory access in auto_increment_key update
+#
+
+CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
+CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
+INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
+INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
+drop table t1,t2;
diff --git a/mysql-test/t/rpl_error_ignored_table-slave.opt b/mysql-test/t/rpl_error_ignored_table-slave.opt
index 544ecb2959b..0d3485f9e25 100644
--- a/mysql-test/t/rpl_error_ignored_table-slave.opt
+++ b/mysql-test/t/rpl_error_ignored_table-slave.opt
@@ -1 +1 @@
---replicate-ignore-table=test.t1 \ No newline at end of file
+--replicate-ignore-table=test.t1
diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_error_ignored_table.test
index caa289a184d..686472433eb 100644
--- a/mysql-test/t/rpl_error_ignored_table.test
+++ b/mysql-test/t/rpl_error_ignored_table.test
@@ -12,6 +12,9 @@ save_master_pos;
connection slave;
# as the t1 table is ignored on the slave, the slave should be able to sync
sync_with_master;
+# The port number is different when doing the release build with
+# Do-compile, hence we have to replace the port number here accordingly
+--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
# check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1';
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test
index c68fbb7111a..8a3da1a2b02 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flush_log_loop.test
@@ -14,6 +14,7 @@ slave stop;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
slave start;
+sleep 5;
flush logs;
sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT
diff --git a/mysql-test/t/rpl_max_relay_size.test b/mysql-test/t/rpl_max_relay_size.test
index 4befe4024fc..a2167b1ef36 100644
--- a/mysql-test/t/rpl_max_relay_size.test
+++ b/mysql-test/t/rpl_max_relay_size.test
@@ -28,6 +28,7 @@ set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
start slave;
sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
show slave status;
stop slave;
reset slave;
@@ -35,6 +36,7 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
start slave;
sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
show slave status;
stop slave;
reset slave;
@@ -42,6 +44,7 @@ set global max_relay_log_size=0;
select @@global.max_relay_log_size;
start slave;
sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions
@@ -51,6 +54,7 @@ reset slave;
# test of relay log rotation when the slave is stopped
# (to make sure it does not crash).
flush logs;
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
show slave status;
reset slave;
@@ -65,6 +69,7 @@ create table t1 (a int);
save_master_pos;
connection slave;
sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
show slave status;
# one more rotation, to be sure Relay_log_space is correctly updated
flush logs;
@@ -73,6 +78,7 @@ drop table t1;
save_master_pos;
connection slave;
sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT 3334 MASTER_PORT
show slave status;
connection master;
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index bd77b4821ff..07c40fd91b6 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -374,11 +374,11 @@ void TERMINATE(FILE *file)
{
if (file)
{
- fprintf(file, "Warning: Not freed memory segments: %d\n",
+ fprintf(file, "Warning: Not freed memory segments: %u\n",
sf_malloc_count);
(void) fflush(file);
}
- DBUG_PRINT("safe",("sf_malloc_count: %d", sf_malloc_count));
+ DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
}
/*
@@ -482,7 +482,7 @@ int _sanity(const char *filename, uint lineno)
pthread_mutex_lock(&THR_LOCK_malloc);
#ifndef PEDANTIC_SAFEMALLOC
- if (sf_malloc_tampered && sf_malloc_count < 0)
+ if (sf_malloc_tampered && (int) sf_malloc_count < 0)
sf_malloc_count=0;
#endif
count=sf_malloc_count;
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 61616a4cf2b..d5236cb1ef9 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -172,10 +172,13 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
return 0;
}
+
static void check_locks(THR_LOCK *lock, const char *where,
my_bool allow_no_locks)
{
uint old_found_errors=found_errors;
+ DBUG_ENTER("check_locks");
+
if (found_errors < MAX_FOUND_ERRORS)
{
if (check_lock(&lock->write,"write",where,1,1) |
@@ -252,18 +255,21 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
if (lock->read.data)
{
- if ((!pthread_equal(lock->write.data->thread,
- lock->read.data->thread) &&
- lock->write.data->type > TL_WRITE_DELAYED &&
- lock->write.data->type != TL_WRITE_ONLY) ||
- ((lock->write.data->type == TL_WRITE_CONCURRENT_INSERT ||
- lock->write.data->type == TL_WRITE_ALLOW_WRITE) &&
- lock->read_no_write_count))
+ if (!pthread_equal(lock->write.data->thread,
+ lock->read.data->thread) &&
+ ((lock->write.data->type > TL_WRITE_DELAYED &&
+ lock->write.data->type != TL_WRITE_ONLY) ||
+ ((lock->write.data->type == TL_WRITE_CONCURRENT_INSERT ||
+ lock->write.data->type == TL_WRITE_ALLOW_WRITE) &&
+ lock->read_no_write_count)))
{
found_errors++;
fprintf(stderr,
"Warning at '%s': Found lock of type %d that is write and read locked\n",
where, lock->write.data->type);
+ DBUG_PRINT("warning",("At '%s': Found lock of type %d that is write and read locked\n",
+ where, lock->write.data->type));
+
}
}
if (lock->read_wait.data)
@@ -286,6 +292,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
DBUG_PRINT("error",("Found wrong lock"));
}
}
+ DBUG_VOID_RETURN;
}
#else /* EXTRA_DEBUG */
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index fcd8e26c901..d7e3eedb84e 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -274,12 +274,16 @@ then
fi
#
-# Uncomment the following lines if you want all tables to be automaticly
-# checked and repaired at start
+# Uncomment the following lines if you want all tables to be automatically
+# checked and repaired during startup. You should add sensible key_buffer
+# and sort_buffer values to my.cnf to improve check performance or require
+# less disk space.
+# Alternatively, you can start mysqld with the "myisam-recover" option. See
+# the manual for details.
#
# echo "Checking tables in $DATADIR"
-# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI
-# $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM
+# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI
+# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM
echo "Starting $MYSQLD daemon with databases from $DATADIR"
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 98a5c5b9f85..f23955da06a 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -569,22 +569,22 @@ sub copy_files {
print "Copying ".@$files." files...\n" unless $opt{quiet};
if ($method =~ /^s?cp\b/) { # cp or scp with optional flags
- my @cp = ($method);
+ my $cp = $method;
# add option to preserve mod time etc of copied files
# not critical, but nice to have
- push @cp, "-p" if $^O =~ m/^(solaris|linux|freebsd|darwin)$/;
+ $cp.= " -p" if $^O =~ m/^(solaris|linux|freebsd|darwin)$/;
# add recursive option for scp
- push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd|darwin)$/ && $method =~ /^scp\b/;
+ $cp.= " -r" if $^O =~ /m^(solaris|linux|freebsd|darwin)$/ && $method =~ /^scp\b/;
my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files;
# add files to copy and the destination directory
- safe_system( @cp, @non_raid, "'$target'" ) if (@non_raid);
+ safe_system( $cp, @non_raid, "'$target'" ) if (@non_raid);
foreach my $rd ( @$raid_dirs ) {
my @raid = map { "'$_'" } grep { m:$rd/: } @$files;
- safe_system( @cp, @raid, "'$target'/$rd" ) if ( @raid );
+ safe_system( $cp, @raid, "'$target'/$rd" ) if ( @raid );
}
}
else
@@ -646,26 +646,54 @@ sub copy_index
}
-sub safe_system
-{
- my @cmd= @_;
-
- if ( $opt{dryrun} )
- {
- print "@cmd\n";
- return;
+sub safe_system {
+ my @sources= @_;
+ my $method= shift @sources;
+ my $target= pop @sources;
+ ## @sources = list of source file names
+
+ ## We have to deal with very long command lines, otherwise they may generate
+ ## "Argument list too long".
+ ## With 10000 tables the command line can be around 1MB, much more than 128kB
+ ## which is the common limit on Linux (can be read from
+ ## /usr/src/linux/include/linux/binfmts.h
+ ## see http://www.linuxjournal.com/article.php?sid=6060).
+
+ my $chunk_limit= 100 * 1024; # 100 kB
+ my @chunk= ();
+ my $chunk_length= 0;
+ foreach (@sources) {
+ push @chunk, $_;
+ $chunk_length+= length($_);
+ if ($chunk_length > $chunk_limit) {
+ safe_simple_system($method, @chunk, $target);
+ @chunk=();
+ $chunk_length= 0;
+ }
}
-
- ## for some reason system fails but backticks works ok for scp...
- print "Executing '@cmd'\n" if $opt{debug};
- my $cp_status = system "@cmd > /dev/null";
- if ($cp_status != 0) {
- warn "Executing command failed ($cp_status). Trying backtick execution...\n";
- ## try something else
- `@cmd` || die "Error: @cmd failed ($?) while copying files.\n";
+ if ($chunk_length > 0) { # do not forget last small chunk
+ safe_simple_system($method, @chunk, $target);
}
}
+sub safe_simple_system {
+ my @cmd= @_;
+
+ if ( $opt{dryrun} ) {
+ print "@cmd\n";
+ }
+ else {
+ ## for some reason system fails but backticks works ok for scp...
+ print "Executing '@cmd'\n" if $opt{debug};
+ my $cp_status = system "@cmd > /dev/null";
+ if ($cp_status != 0) {
+ warn "Executing command failed ($cp_status). Trying backtick execution...\n";
+ ## try something else
+ `@cmd` || die "Error: @cmd failed ($?) while copying files.\n";
+ }
+ }
+}
+
sub retire_directory {
my ( @dir ) = @_;
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 86f409aff67..8a51019b18e 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -32,7 +32,6 @@ typedef struct st_innobase_share {
uint table_name_length,use_count;
} INNOBASE_SHARE;
-
/* The class defining a handle to an Innodb table */
class ha_innobase: public handler
{
diff --git a/sql/handler.cc b/sql/handler.cc
index 4ea5bc0e9f5..505f64dff43 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -801,6 +801,9 @@ void handler::print_error(int error, myf errflag)
int textno=ER_GET_ERRNO;
switch (error) {
+ case EACCES:
+ textno=ER_OPEN_AS_READONLY;
+ break;
case EAGAIN:
textno=ER_FILE_USED;
break;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b7b97dc80f9..d987be84af2 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -320,26 +320,25 @@ void Item_func_interval::split_sum_func(List<Item> &fields)
longlong Item_func_interval::val_int()
{
- double value=item->val();
+ double value= item->val();
if (item->null_value)
- return -1; // -1 if null /* purecov: inspected */
+ return -1; // -1 if NULL
if (intervals)
{ // Use binary search to find interval
- uint start,end;
- start=0; end=arg_count-1;
+ uint start= 0, end= arg_count - 1;
while (start != end)
{
- uint mid=(start+end+1)/2;
+ uint mid= (start + end + 1) / 2;
if (intervals[mid] <= value)
- start=mid;
+ start= mid;
else
- end=mid-1;
+ end= mid - 1;
}
- return (value < intervals[start]) ? 0 : start+1;
+ return (value < intervals[start]) ? 0 : start + 1;
}
if (args[0]->val() > value)
return 0;
- for (uint i=1 ; i < arg_count ; i++)
+ for (uint i= 1; i < arg_count; i++)
{
if (args[i]->val() > value)
return i;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 801b77ffcce..8cc3d24f7d9 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1471,6 +1471,10 @@ String *Item_func_format::val_str(String *str)
return 0; /* purecov: inspected */
dec= decimals ? decimals+1 : 0;
str->set(nr,decimals);
+#ifdef HAVE_ISNAN
+ if (isnan(nr))
+ return str;
+#endif
str_length=str->length();
if (nr < 0)
str_length--; // Don't count sign
diff --git a/sql/log.cc b/sql/log.cc
index c24c2f2e39b..17715620950 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -83,11 +83,13 @@ static int find_uniq_filename(char *name)
MYSQL_LOG::MYSQL_LOG()
:bytes_written(0), last_time(0), query_start(0), name(0),
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
- no_rotate(0), need_start_event(1)
+ need_start_event(1)
{
/*
- We don't want to intialize LOCK_Log here as the thread system may
- not have been initailized yet. We do it instead at 'open'.
+ We don't want to initialize LOCK_Log here as such initialization depends on
+ safe_mutex (when using safe_mutex) which depends on MY_INIT(), which is
+ called only in main(). Doing initialization here would make it happen
+ before main().
*/
index_file_name[0] = 0;
bzero((char*) &log_file,sizeof(log_file));
@@ -100,12 +102,14 @@ MYSQL_LOG::~MYSQL_LOG()
cleanup();
}
+/* this is called only once */
+
void MYSQL_LOG::cleanup()
{
if (inited)
{
- close(1);
inited= 0;
+ close(LOG_CLOSE_INDEX);
(void) pthread_mutex_destroy(&LOCK_log);
(void) pthread_mutex_destroy(&LOCK_index);
(void) pthread_cond_destroy(&update_cond);
@@ -142,17 +146,20 @@ void MYSQL_LOG::init(enum_log_type log_type_arg,
no_auto_events = no_auto_events_arg;
max_size=max_size_arg;
DBUG_PRINT("info",("log_type: %d max_size: %lu", log_type, max_size));
- if (!inited)
- {
- inited= 1;
- (void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
- (void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
- (void) pthread_cond_init(&update_cond, 0);
- }
DBUG_VOID_RETURN;
}
+void MYSQL_LOG::init_pthread_objects()
+{
+ DBUG_ASSERT(inited == 0);
+ inited= 1;
+ (void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
+ (void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
+ (void) pthread_cond_init(&update_cond, 0);
+}
+
+
/*
Open a (new) log file.
@@ -182,8 +189,6 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
last_time=query_start=0;
write_error=0;
- if (!inited && log_type_arg == LOG_BIN && *fn_ext(log_name))
- no_rotate = 1;
init(log_type_arg,io_cache_type_arg,no_auto_events_arg,max_size);
if (!(name=my_strdup(log_name,MYF(MY_WME))))
@@ -310,6 +315,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
break;
}
case LOG_CLOSED: // Impossible
+ case LOG_TO_BE_OPENED:
DBUG_ASSERT(1);
break;
}
@@ -327,7 +333,7 @@ shutdown the MySQL server and restart it.", log_name, errno);
end_io_cache(&log_file);
end_io_cache(&index_file);
safeFree(name);
- log_type=LOG_CLOSED;
+ log_type= LOG_CLOSED;
DBUG_RETURN(1);
}
@@ -560,7 +566,7 @@ bool MYSQL_LOG::reset_logs(THD* thd)
save_name=name;
name=0; // Protect against free
save_log_type=log_type;
- close(0); // Don't close the index file
+ close(LOG_CLOSE_TO_BE_OPENED);
/* First delete all old log files */
@@ -578,7 +584,7 @@ bool MYSQL_LOG::reset_logs(THD* thd)
}
/* Start logging with a new file */
- close(1); // Close index file
+ close(LOG_CLOSE_INDEX);
my_delete(index_file_name, MYF(MY_WME)); // Reset (open will update)
if (!thd->slave_thread)
need_start_event=1;
@@ -705,7 +711,6 @@ err:
RETURN VALUES
0 ok
- LOG_INFO_PURGE_NO_ROTATE Binary file that can't be rotated
LOG_INFO_EOF to_log not found
*/
@@ -715,9 +720,6 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
LOG_INFO log_info;
DBUG_ENTER("purge_logs");
- if (no_rotate)
- DBUG_RETURN(LOG_INFO_PURGE_NO_ROTATE);
-
pthread_mutex_lock(&LOCK_index);
if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/)))
goto err;
@@ -770,14 +772,11 @@ err:
void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
{
- if (inited) // QQ When is this not true ?
- {
- uint dir_len = dirname_length(log_file_name);
- if (dir_len > FN_REFLEN)
- dir_len=FN_REFLEN-1;
- strnmov(buf, log_file_name, dir_len);
- strmake(buf+dir_len, log_ident, FN_REFLEN - dir_len);
- }
+ uint dir_len = dirname_length(log_file_name);
+ if (dir_len > FN_REFLEN)
+ dir_len=FN_REFLEN-1;
+ strnmov(buf, log_file_name, dir_len);
+ strmake(buf+dir_len, log_ident, FN_REFLEN - dir_len);
}
@@ -787,7 +786,7 @@ void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
bool MYSQL_LOG::is_active(const char *log_file_name_arg)
{
- return inited && !strcmp(log_file_name, log_file_name_arg);
+ return !strcmp(log_file_name, log_file_name_arg);
}
@@ -823,60 +822,55 @@ void MYSQL_LOG::new_file(bool need_lock)
safe_mutex_assert_owner(&LOCK_log);
safe_mutex_assert_owner(&LOCK_index);
- // Reuse old name if not binlog and not update log
+ /* Reuse old name if not binlog and not update log */
new_name_ptr= name;
/*
- Only rotate open logs that are marked non-rotatable
- (binlog with constant name are non-rotatable)
+ If user hasn't specified an extension, generate a new log name
+ We have to do this here and not in open as we want to store the
+ new file name in the current binary log file.
*/
- if (!no_rotate)
+ if (generate_new_name(new_name, name))
+ goto end;
+ new_name_ptr=new_name;
+
+ if (log_type == LOG_BIN)
{
- /*
- If user hasn't specified an extension, generate a new log name
- We have to do this here and not in open as we want to store the
- new file name in the current binary log file.
- */
- if (generate_new_name(new_name, name))
- goto end;
- new_name_ptr=new_name;
-
- if (log_type == LOG_BIN)
+ if (!no_auto_events)
{
- if (!no_auto_events)
- {
- /*
- We log the whole file name for log file as the user may decide
- to change base names at some point.
- */
- THD* thd = current_thd;
- Rotate_log_event r(thd,new_name+dirname_length(new_name));
- r.set_log_pos(this);
-
- /*
- Because this log rotation could have been initiated by a master of
- the slave running with log-bin, we set the flag on rotate
- event to prevent infinite log rotation loop
- */
- if (thd->slave_thread)
- r.flags|= LOG_EVENT_FORCED_ROTATE_F;
- r.write(&log_file);
- bytes_written += r.get_event_len();
- }
/*
- Update needs to be signalled even if there is no rotate event
- log rotation should give the waiting thread a signal to
- discover EOF and move on to the next log.
+ We log the whole file name for log file as the user may decide
+ to change base names at some point.
*/
- signal_update();
+ THD* thd = current_thd;
+ Rotate_log_event r(thd,new_name+dirname_length(new_name));
+ r.set_log_pos(this);
+
+ /*
+ Because this log rotation could have been initiated by a master of
+ the slave running with log-bin, we set the flag on rotate
+ event to prevent infinite log rotation loop
+ */
+ if (thd->slave_thread)
+ r.flags|= LOG_EVENT_FORCED_ROTATE_F;
+ r.write(&log_file);
+ bytes_written += r.get_event_len();
}
+ /*
+ Update needs to be signalled even if there is no rotate event
+ log rotation should give the waiting thread a signal to
+ discover EOF and move on to the next log.
+ */
+ signal_update();
}
old_name=name;
save_log_type=log_type;
name=0; // Don't free name
- close();
+ close(LOG_CLOSE_TO_BE_OPENED);
- // TODO: at this place is_open() will see the log closed, which is BUG#791.
+ /*
+ Note that at this point, log_type == LOG_CLOSED (important for is_open()).
+ */
open(old_name, save_log_type, new_name_ptr, index_file_name, io_cache_type,
no_auto_events, max_size);
@@ -1055,14 +1049,13 @@ bool MYSQL_LOG::write(Log_event* event_info)
bool error=0;
DBUG_ENTER("MYSQL_LOG::write(event)");
- if (!inited) // Can't use mutex if not init
- {
- DBUG_PRINT("error",("not initied"));
- DBUG_RETURN(0);
- }
pthread_mutex_lock(&LOCK_log);
- /* In most cases this is only called if 'is_open()' is true */
+ /*
+ In most cases this is only called if 'is_open()' is true; in fact this is
+ mostly called if is_open() *was* true a few instructions before, but it
+ could have changed since.
+ */
if (is_open())
{
bool should_rotate = 0;
@@ -1074,6 +1067,11 @@ bool MYSQL_LOG::write(Log_event* event_info)
#else
IO_CACHE *file = &log_file;
#endif
+ /*
+ In the future we need to add to the following if tests like
+ "do the involved tables match (to be implemented)
+ binlog_[wild_]{do|ignore}_table?" (WL#1049)"
+ */
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
(thd->master_access & SUPER_ACL)) ||
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
@@ -1380,123 +1378,123 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
time_t query_start_arg)
{
bool error=0;
+ time_t current_time;
+ if (!is_open())
+ return 0;
+ VOID(pthread_mutex_lock(&LOCK_log));
if (is_open())
- {
- time_t current_time;
- VOID(pthread_mutex_lock(&LOCK_log));
- if (is_open())
- { // Safety agains reopen
- int tmp_errno=0;
- char buff[80],*end;
- end=buff;
- if (!(thd->options & OPTION_UPDATE_LOG) &&
- (thd->master_access & SUPER_ACL))
- {
- VOID(pthread_mutex_unlock(&LOCK_log));
- return 0;
- }
- if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start_arg)
- {
- current_time=time(NULL);
- if (current_time != last_time)
- {
- last_time=current_time;
- struct tm tm_tmp;
- struct tm *start;
- localtime_r(&current_time,&tm_tmp);
- start=&tm_tmp;
- /* Note that my_b_write() assumes it knows the length for this */
- sprintf(buff,"# Time: %02d%02d%02d %2d:%02d:%02d\n",
- start->tm_year % 100,
- start->tm_mon+1,
- start->tm_mday,
- start->tm_hour,
- start->tm_min,
- start->tm_sec);
- if (my_b_write(&log_file, (byte*) buff,24))
- tmp_errno=errno;
- }
- if (my_b_printf(&log_file, "# User@Host: %s[%s] @ %s [%s]\n",
- thd->priv_user,
- thd->user,
- thd->host ? thd->host : "",
- thd->ip ? thd->ip : "") == (uint) -1)
- tmp_errno=errno;
- }
- if (query_start_arg)
- {
- /* For slow query log */
- if (my_b_printf(&log_file,
- "# Query_time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n",
- (ulong) (current_time - query_start_arg),
- (ulong) (thd->time_after_lock - query_start_arg),
- (ulong) thd->sent_row_count,
- (ulong) thd->examined_row_count) == (uint) -1)
- tmp_errno=errno;
- }
- if (thd->db && strcmp(thd->db,db))
- { // Database changed
- if (my_b_printf(&log_file,"use %s;\n",thd->db) == (uint) -1)
- tmp_errno=errno;
- strmov(db,thd->db);
- }
- if (thd->last_insert_id_used)
- {
- end=strmov(end,",last_insert_id=");
- end=longlong10_to_str((longlong) thd->current_insert_id,end,-10);
- }
- // Save value if we do an insert.
- if (thd->insert_id_used)
- {
- if (specialflag & SPECIAL_LONG_LOG_FORMAT)
- {
- end=strmov(end,",insert_id=");
- end=longlong10_to_str((longlong) thd->last_insert_id,end,-10);
- }
- }
- if (thd->query_start_used)
+ { // Safety agains reopen
+ int tmp_errno=0;
+ char buff[80],*end;
+ end=buff;
+ if (!(thd->options & OPTION_UPDATE_LOG) &&
+ (thd->master_access & SUPER_ACL))
+ {
+ VOID(pthread_mutex_unlock(&LOCK_log));
+ return 0;
+ }
+ if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start_arg)
+ {
+ current_time=time(NULL);
+ if (current_time != last_time)
{
- if (query_start_arg != thd->query_start())
- {
- query_start_arg=thd->query_start();
- end=strmov(end,",timestamp=");
- end=int10_to_str((long) query_start_arg,end,10);
- }
+ last_time=current_time;
+ struct tm tm_tmp;
+ struct tm *start;
+ localtime_r(&current_time,&tm_tmp);
+ start=&tm_tmp;
+ /* Note that my_b_write() assumes it knows the length for this */
+ sprintf(buff,"# Time: %02d%02d%02d %2d:%02d:%02d\n",
+ start->tm_year % 100,
+ start->tm_mon+1,
+ start->tm_mday,
+ start->tm_hour,
+ start->tm_min,
+ start->tm_sec);
+ if (my_b_write(&log_file, (byte*) buff,24))
+ tmp_errno=errno;
}
- if (end != buff)
+ if (my_b_printf(&log_file, "# User@Host: %s[%s] @ %s [%s]\n",
+ thd->priv_user,
+ thd->user,
+ thd->host ? thd->host : "",
+ thd->ip ? thd->ip : "") == (uint) -1)
+ tmp_errno=errno;
+ }
+ if (query_start_arg)
+ {
+ /* For slow query log */
+ if (my_b_printf(&log_file,
+ "# Query_time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n",
+ (ulong) (current_time - query_start_arg),
+ (ulong) (thd->time_after_lock - query_start_arg),
+ (ulong) thd->sent_row_count,
+ (ulong) thd->examined_row_count) == (uint) -1)
+ tmp_errno=errno;
+ }
+ if (thd->db && strcmp(thd->db,db))
+ { // Database changed
+ if (my_b_printf(&log_file,"use %s;\n",thd->db) == (uint) -1)
+ tmp_errno=errno;
+ strmov(db,thd->db);
+ }
+ if (thd->last_insert_id_used)
+ {
+ end=strmov(end,",last_insert_id=");
+ end=longlong10_to_str((longlong) thd->current_insert_id,end,-10);
+ }
+ // Save value if we do an insert.
+ if (thd->insert_id_used)
+ {
+ if (specialflag & SPECIAL_LONG_LOG_FORMAT)
{
- *end++=';';
- *end='\n';
- if (my_b_write(&log_file, (byte*) "SET ",4) ||
- my_b_write(&log_file, (byte*) buff+1,(uint) (end-buff)))
- tmp_errno=errno;
+ end=strmov(end,",insert_id=");
+ end=longlong10_to_str((longlong) thd->last_insert_id,end,-10);
}
- if (!query)
+ }
+ if (thd->query_start_used)
+ {
+ if (query_start_arg != thd->query_start())
{
- end=strxmov(buff, "# administrator command: ",
- command_name[thd->command], NullS);
- query_length=(ulong) (end-buff);
- query=buff;
+ query_start_arg=thd->query_start();
+ end=strmov(end,",timestamp=");
+ end=int10_to_str((long) query_start_arg,end,10);
}
- if (my_b_write(&log_file, (byte*) query,query_length) ||
- my_b_write(&log_file, (byte*) ";\n",2) ||
- flush_io_cache(&log_file))
- tmp_errno=errno;
- if (tmp_errno)
+ }
+ if (end != buff)
+ {
+ *end++=';';
+ *end='\n';
+ if (my_b_write(&log_file, (byte*) "SET ",4) ||
+ my_b_write(&log_file, (byte*) buff+1,(uint) (end-buff)))
+ tmp_errno=errno;
+ }
+ if (!query)
+ {
+ end=strxmov(buff, "# administrator command: ",
+ command_name[thd->command], NullS);
+ query_length=(ulong) (end-buff);
+ query=buff;
+ }
+ if (my_b_write(&log_file, (byte*) query,query_length) ||
+ my_b_write(&log_file, (byte*) ";\n",2) ||
+ flush_io_cache(&log_file))
+ tmp_errno=errno;
+ if (tmp_errno)
+ {
+ error=1;
+ if (! write_error)
{
- error=1;
- if (! write_error)
- {
- write_error=1;
- sql_print_error(ER(ER_ERROR_ON_WRITE),name,error);
- }
+ write_error=1;
+ sql_print_error(ER(ER_ERROR_ON_WRITE),name,error);
}
}
- VOID(pthread_mutex_unlock(&LOCK_log));
}
+ VOID(pthread_mutex_unlock(&LOCK_log));
return error;
}
+
/*
Wait until we get a signal that the binary log has been updated
@@ -1531,24 +1529,25 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
SYNOPSIS
close()
- exiting Set to 1 if we should also close the index file
- This can be set to 0 if we are going to do call open
- at once after close, in which case we don't want to
- close the index file.
- We only write a 'stop' event to the log if exiting is set
+ exiting Bitmask for one or more of the following bits:
+ LOG_CLOSE_INDEX if we should close the index file
+ LOG_CLOSE_TO_BE_OPENED if we intend to call open
+ at once after close.
+ LOG_CLOSE_STOP_EVENT write a 'stop' event to the log
NOTES
One can do an open on the object at once after doing a close.
The internal structures are not freed until cleanup() is called
*/
-void MYSQL_LOG::close(bool exiting)
+void MYSQL_LOG::close(uint exiting)
{ // One can't set log_type here!
DBUG_ENTER("MYSQL_LOG::close");
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
- if (is_open())
+ if (log_type != LOG_CLOSED && log_type != LOG_TO_BE_OPENED)
{
- if (log_type == LOG_BIN && !no_auto_events && exiting)
+ if (log_type == LOG_BIN && !no_auto_events &&
+ (exiting & LOG_CLOSE_STOP_EVENT))
{
Stop_log_event s;
s.set_log_pos(this);
@@ -1568,7 +1567,7 @@ void MYSQL_LOG::close(bool exiting)
called a not complete close earlier and the index file is still open.
*/
- if (exiting && my_b_inited(&index_file))
+ if ((exiting & LOG_CLOSE_INDEX) && my_b_inited(&index_file))
{
end_io_cache(&index_file);
if (my_close(index_file.file, MYF(0)) < 0 && ! write_error)
@@ -1577,11 +1576,12 @@ void MYSQL_LOG::close(bool exiting)
sql_print_error(ER(ER_ERROR_ON_WRITE), index_file_name, errno);
}
}
- log_type= LOG_CLOSED;
+ log_type= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
safeFree(name);
DBUG_VOID_RETURN;
}
+
void MYSQL_LOG::set_max_size(ulong max_size_arg)
{
/*
@@ -1591,16 +1591,15 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
uses the old_max_size argument, so max_size_arg has been overwritten and
it's like if the SET command was never run.
*/
+ DBUG_ENTER("MYSQL_LOG::set_max_size");
+ pthread_mutex_lock(&LOCK_log);
if (is_open())
- {
- pthread_mutex_lock(&LOCK_log);
- pthread_mutex_lock(&LOCK_index);
max_size= max_size_arg;
- pthread_mutex_unlock(&LOCK_index);
- pthread_mutex_unlock(&LOCK_log);
- }
+ pthread_mutex_unlock(&LOCK_log);
+ DBUG_VOID_RETURN;
}
+
/*
Check if a string is a valid number
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 1ede1a87153..9b8d12e845d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1966,12 +1966,9 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
if (type == LOG_BIN)
{
char *p = fn_ext(opt_name);
- if (p)
- {
- uint length=(uint) (p-opt_name);
- strmake(tmp,opt_name,min(length,FN_REFLEN));
- opt_name=tmp;
- }
+ uint length=(uint) (p-opt_name);
+ strmake(tmp,opt_name,min(length,FN_REFLEN));
+ opt_name=tmp;
}
return log->open(opt_name, type, 0, index_file_name,
(read_append) ? SEQ_READ_APPEND : WRITE_CACHE,
@@ -2019,6 +2016,17 @@ int main(int argc, char **argv)
}
#endif
+ /*
+ Init mutexes for the global MYSQL_LOG objects.
+ As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
+ global MYSQL_LOGs in their constructors, because then they would be inited
+ before MY_INIT(). So we do it here.
+ */
+ mysql_log.init_pthread_objects();
+ mysql_update_log.init_pthread_objects();
+ mysql_slow_log.init_pthread_objects();
+ mysql_bin_log.init_pthread_objects();
+
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
strmov(glob_hostname,"mysql");
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
@@ -4202,8 +4210,8 @@ static void usage(void)
puts("\
Copyright (C) 2000 MySQL AB, by Monty and others\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
-and you are welcome to modify and redistribute it under the GPL license\n\
-Starts the MySQL server\n");
+and you are welcome to modify and redistribute it under the GPL license\n\n\
+Starts the MySQL database server\n");
printf("Usage: %s [OPTIONS]\n", my_progname);
#ifdef __WIN__
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 3d7ca3b28df..0ce90ac0dab 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -119,7 +119,7 @@
"Unknown character set: '%-.64s'",
"Too many tables. MySQL can only use %d tables in a join",
"Too many columns",
-"Too big row size. The maximum row size, not counting BLOBs, is %d. You have to change some fields to BLOBs",
+"Too big row size. The maximum row size, not counting BLOBs, is %d (can be lower for some table types). You have to change some fields to BLOBs",
"Thread stack overrun: Used: %ld of a %ld stack. Use 'mysqld -O thread_stack=#' to specify a bigger stack if needed",
"Cross dependency found in OUTER JOIN. Examine your ON conditions",
"Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL",
diff --git a/sql/slave.cc b/sql/slave.cc
index e0ca4f1ad7a..6ace446a341 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1314,7 +1314,7 @@ file '%s')", fname);
if (info_fd >= 0)
my_close(info_fd, MYF(0));
rli->info_fd= -1;
- rli->relay_log.close(1);
+ rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
@@ -1374,7 +1374,7 @@ err:
if (info_fd >= 0)
my_close(info_fd, MYF(0));
rli->info_fd= -1;
- rli->relay_log.close(1);
+ rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
@@ -1736,6 +1736,7 @@ st_relay_log_info::st_relay_log_info()
pthread_cond_init(&start_cond, NULL);
pthread_cond_init(&stop_cond, NULL);
pthread_cond_init(&log_space_cond, NULL);
+ relay_log.init_pthread_objects();
}
@@ -2988,7 +2989,7 @@ void end_relay_log_info(RELAY_LOG_INFO* rli)
rli->cur_log_fd = -1;
}
rli->inited = 0;
- rli->relay_log.close(1);
+ rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
DBUG_VOID_RETURN;
}
@@ -3443,14 +3444,18 @@ void rotate_relay_log(MASTER_INFO* mi)
{
DBUG_ENTER("rotate_relay_log");
RELAY_LOG_INFO* rli= &mi->rli;
- /* If this server is not a slave (or RESET SLAVE has just been run) */
+
+ lock_slave_threads(mi);
+ pthread_mutex_lock(&rli->data_lock);
+ /*
+ We need to test inited because otherwise, new_file() will attempt to lock
+ LOCK_log, which may not be inited (if we're not a slave).
+ */
if (!rli->inited)
{
DBUG_PRINT("info", ("rli->inited == 0"));
- DBUG_VOID_RETURN;
+ goto end;
}
- lock_slave_threads(mi);
- pthread_mutex_lock(&rli->data_lock);
/* If the relay log is closed, new_file() will do nothing. */
rli->relay_log.new_file(1);
@@ -3469,6 +3474,7 @@ void rotate_relay_log(MASTER_INFO* mi)
0 as they probably have been harvested.
*/
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
+end:
pthread_mutex_unlock(&rli->data_lock);
unlock_slave_threads(mi);
DBUG_VOID_RETURN;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 697b5d8ffd6..d773aa5bc71 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1136,7 +1136,11 @@ find_acl_user(const char *host, const char *user)
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
DBUG_PRINT("info",("strcmp('%s','%s'), compare_hostname('%s','%s'),",
- user,acl_user->user,(host),(acl_user->host)));
+ user,
+ acl_user->user ? acl_user->user : "",
+ host,
+ acl_user->host.hostname ? acl_user->host.hostname :
+ ""));
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
{
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 71b943b5d26..dcc839e13b1 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -30,20 +30,24 @@ class Slave_log_event;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY };
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE };
-enum enum_log_type { LOG_CLOSED, LOG_NORMAL, LOG_NEW, LOG_BIN };
+enum enum_log_type { LOG_CLOSED, LOG_TO_BE_OPENED, LOG_NORMAL, LOG_NEW, LOG_BIN};
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
DELAY_KEY_WRITE_ALL };
-// log info errors
+/* log info errors */
#define LOG_INFO_EOF -1
#define LOG_INFO_IO -2
#define LOG_INFO_INVALID -3
#define LOG_INFO_SEEK -4
-#define LOG_INFO_PURGE_NO_ROTATE -5
#define LOG_INFO_MEM -6
#define LOG_INFO_FATAL -7
#define LOG_INFO_IN_USE -8
+/* bitmap to SQL_LOG::close() */
+#define LOG_CLOSE_INDEX 1
+#define LOG_CLOSE_TO_BE_OPENED 2
+#define LOG_CLOSE_STOP_EVENT 4
+
struct st_relay_log_info;
typedef struct st_log_info
@@ -59,8 +63,10 @@ typedef struct st_log_info
class Log_event;
-class MYSQL_LOG {
+class MYSQL_LOG
+ {
private:
+ /* LOCK_log and LOCK_index are inited by init_pthread_objects() */
pthread_mutex_t LOCK_log, LOCK_index;
pthread_cond_t update_cond;
ulonglong bytes_written;
@@ -80,8 +86,7 @@ class MYSQL_LOG {
*/
volatile enum_log_type log_type;
enum cache_type io_cache_type;
- bool write_error,inited;
- bool no_rotate;
+ bool write_error, inited;
bool need_start_event;
bool no_auto_events; // for relay binlog
/*
@@ -123,6 +128,7 @@ public:
void init(enum_log_type log_type_arg,
enum cache_type io_cache_type_arg,
bool no_auto_events_arg, ulong max_size);
+ void init_pthread_objects();
void cleanup();
bool open(const char *log_name,enum_log_type log_type,
const char *new_name, const char *index_file_name_arg,
@@ -149,8 +155,7 @@ public:
int purge_logs(THD* thd, const char* to_log);
int purge_first_log(struct st_relay_log_info* rli);
bool reset_logs(THD* thd);
- // if we are exiting, we also want to close the index file
- void close(bool exiting = 0);
+ void close(uint exiting);
// iterating through the log index file
int find_log_pos(LOG_INFO* linfo, const char* log_name,
@@ -158,7 +163,6 @@ public:
int find_next_log(LOG_INFO* linfo, bool need_mutex);
int get_current_log(LOG_INFO* linfo);
uint next_file_id();
-
inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;}
inline char* get_log_fname() { return log_file_name; }
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index e775a5d712e..13b22d6a221 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -282,8 +282,6 @@ int purge_master_logs(THD* thd, const char* to_log)
case LOG_INFO_INVALID: errmsg = "Server configuration does not permit \
binlog purge"; break;
case LOG_INFO_SEEK: errmsg = "Failed on fseek()"; break;
- case LOG_INFO_PURGE_NO_ROTATE: errmsg = "Cannot purge unrotatable log";
- break;
case LOG_INFO_MEM: errmsg = "Out of memory"; break;
case LOG_INFO_FATAL: errmsg = "Fatal error during purge"; break;
case LOG_INFO_IN_USE: errmsg = "A purgeable log is in use, will not purge";
@@ -1128,7 +1126,7 @@ int show_binlog_info(THD* thd)
/*
- Send a lost of all binary logs to client
+ Send a list of all binary logs to client
SYNOPSIS
show_binlogs()
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 80e329a7f03..4008bf75f01 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3664,6 +3664,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item::STRING_ITEM:
case Item::REF_ITEM:
case Item::NULL_ITEM:
+ case Item::VARBIN_ITEM:
{
bool maybe_null=item->maybe_null;
Field *new_field;
diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c
index 01d377f91c3..5b7a68fb967 100644
--- a/strings/ctype-latin1_de.c
+++ b/strings/ctype-latin1_de.c
@@ -102,6 +102,7 @@ uchar to_upper_latin1_de[] = {
* Ü, ü, Ö, ö, Ä, ä
*/
+/* QQ: why it is necessary ? */
uchar sort_order_latin1_de[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
@@ -121,6 +122,41 @@ uchar sort_order_latin1_de[] = {
68, 78, 79, 79, 79, 79,214,247,216, 85, 85, 85,220, 89,222, 89
};
+
+/* same as sort_order_latin_de, but maps ALL accented chars to unacented ones */
+uchar combo1map[]={
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
+ 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
+ 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
+ 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
+ 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
+ 65, 65, 65, 65, 65, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
+ 68, 78, 79, 79, 79, 79, 79,215,216, 85, 85, 85, 85, 89,222, 83,
+ 65, 65, 65, 65, 65, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
+ 68, 78, 79, 79, 79, 79, 79,247,216, 85, 85, 85, 85, 89,222, 89
+};
+
+uchar combo2map[]={
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,69, 0, 0,83, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,69, 0, 0, 0, 0
+};
+
+/* no longer needed
#define L1_AE 196
#define L1_ae 228
#define L1_OE 214
@@ -128,7 +164,7 @@ uchar sort_order_latin1_de[] = {
#define L1_UE 220
#define L1_ue 252
#define L1_ss 223
-
+*/
/*
Some notes about the following comparison rules:
@@ -143,95 +179,23 @@ uchar sort_order_latin1_de[] = {
sort_order_latin_de[] at all
*/
-
-#define CHECK_S1_COMBO(ch1, ch2, str1, str1_end, res_if_str1_smaller, str2, fst, snd, accent) \
- /* Invariant: ch1 == fst == sort_order_latin1_de[accent] && ch1 != ch2 */ \
- if (ch2 != accent) \
- { \
- ch1= fst; \
- goto normal; \
- } \
- if (str1 == str1_end) \
- return res_if_str1_smaller; \
- { \
- int diff = (int) sort_order_latin1_de[*str1] - snd; \
- if (diff) \
- return diff*(-(res_if_str1_smaller)); \
- /* They are equal (e.g., "Ae" == 'ä') */ \
- str1++; \
- }
-
-
int my_strnncoll_latin1_de(const uchar * s1, int len1,
const uchar * s2, int len2)
{
const uchar *e1 = s1 + len1;
const uchar *e2 = s2 + len2;
+ uchar c1, c12=0, c2, c22=0;
- while (s1 < e1 && s2 < e2)
+ while ((s1 < e1 || c12) && (s2 < e2 || c22))
{
- /*
- Because sort_order_latin1_de doesn't convert 'Ä', Ü or ß we
- can use it here.
- */
- uchar c1 = sort_order_latin1_de[*s1++];
- uchar c2 = sort_order_latin1_de[*s2++];
- if (c1 != c2)
- {
- switch (c1) {
- case 'A':
- CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'A', 'E', L1_AE);
- break;
- case 'O':
- CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'O', 'E', L1_OE);
- break;
- case 'U':
- CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'U', 'E', L1_UE);
- break;
- case 'S':
- CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'S', 'S', L1_ss);
- break;
- case L1_AE:
- CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'A', 'E', 'A');
- break;
- case L1_OE:
- CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'O', 'E', 'O');
- break;
- case L1_UE:
- CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'U', 'E', 'U');
- break;
- case L1_ss:
- CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'S', 'S', 'S');
- break;
- default:
- /*
- Handle the case where 'c2' is a special character
- If this is true, we know that c1 can't match this character.
- */
- normal:
- switch (c2) {
- case L1_AE:
- return (int) c1 - (int) 'A';
- case L1_OE:
- return (int) c1 - (int) 'O';
- case L1_UE:
- return (int) c1 - (int) 'U';
- case L1_ss:
- return (int) c1 - (int) 'S';
- default:
- {
- int diff= (int) c1 - (int) c2;
- if (diff)
- return diff;
- }
- break;
- }
- }
- }
+ if (c12) { c1=c12; c12=0; } else { c12=combo2map[*s1]; c1=combo1map[*s1++]; }
+ if (c22) { c2=c22; c22=0; } else { c22=combo2map[*s2]; c2=combo1map[*s2++]; }
+ if (c1 != c2) return (int)c1 - (int)c2;
}
+
/* A simple test of string lengths won't work -- we test to see
* which string ran out first */
- return s1 < e1 ? 1 : s2 < e2 ? -1 : 0;
+ return (s1 < e1 || c12)? 1 : (s2 < e2 || c22)? -1 : 0;
}
@@ -240,35 +204,12 @@ int my_strnxfrm_latin1_de(uchar * dest, const uchar * src, int len, int srclen)
const uchar *dest_orig = dest;
const uchar *de = dest + len;
const uchar *se = src + srclen;
- while (src < se && dest < de)
+ for ( ; src < se && dest < de ; src++)
{
- uchar chr=sort_order_latin1_de[*src];
- switch (chr) {
- case L1_AE:
- *dest++ = 'A';
- if (dest < de)
- *dest++ = 'E';
- break;
- case L1_OE:
- *dest++ = 'O';
- if (dest < de)
- *dest++ = 'E';
- break;
- case L1_UE:
- *dest++ = 'U';
- if (dest < de)
- *dest++ = 'E';
- break;
- case L1_ss:
- *dest++ = 'S';
- if (dest < de)
- *dest++ = 'S';
- break;
- default:
- *dest++= chr;
- break;
- }
- ++src;
+ uchar chr=combo1map[*src];
+ *dest++=chr;
+ if ((chr=combo2map[*src]) && dest < de)
+ *dest++=chr;
}
return dest - dest_orig;
}
diff --git a/support-files/my-innodb-heavy-4G.cnf.sh b/support-files/my-innodb-heavy-4G.cnf.sh
index b8c49bbf0bc..ed2c2ce9dfd 100644
--- a/support-files/my-innodb-heavy-4G.cnf.sh
+++ b/support-files/my-innodb-heavy-4G.cnf.sh
@@ -1,244 +1,254 @@
#BEGIN CONFIG INFO
-#DESCR: 4G,Innodb only,ACID, Few Connections heavy queries
+#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO
-# This is example config file for systems with 4G of memory running mostly MySQL
-# using MyISAM only tables and running complex queries with few connections
-#
-
-
-
-
#
-# You can copy this file to
-# /etc/my.cnf to set global options,
-# mysql-data-dir/my.cnf to set server-specific options (in this
-# installation this directory is @localstatedir@) or
+# This is a MySQL example config file for systems with 4GB of memory
+# running mostly MySQL using InnoDB only tables and performing complex
+# queries with few connections.
+#
+# You can copy this file to /etc/my.cnf to set global options,
+# mysql-data-dir/my.cnf to set server-specific options
+# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
-# One can in this file use all long options that the program supports.
-# If you want to know which options a program support, run the program
-# with --help option.
-
-
+# In this file, you can use all long options that the program supports.
+# If you want to know the options a program supports, run the program
+# with the "--help" option.
+#
+# More detailed information about the individual options can also be
+# found in the manual.
+#
-# The following options will be passed to all MySQL clients
-# But note, only client programs shipped by MySQL are guarantied to read it
-# If you wish your software to read this section you would need to specify
-# it as an option during MySQL client library initialization
+#
+# The following options will be read by MySQL client applications.
+# Note that only client applications shipped by MySQL are guaranteed
+# to read this section. If you want your own MySQL client program to
+# honor these values, you need to specify it as an option during the
+# MySQL client library initialization.
+#
[client]
-#password = your_password
+#password = [your_password]
port = @MYSQL_TCP_PORT@
socket = @MYSQL_UNIX_ADDR@
-# ********** Here follows entries for some specific programs
+# *** Application-specific options follow here ***
+#
# The MySQL server
+#
[mysqld]
-# generic configuration options
+# generic configuration options
port = @MYSQL_TCP_PORT@
socket = @MYSQL_UNIX_ADDR@
-
-# Back Log is a number of connection OS can keep in queue, before MySQL
-# connection manager thread has processed them. If you have very intensive
-# connection rate and experience "connection refused" errors you might need
-# to increase this value
+# back_log is the number of connections the operating system can keep in
+# the listen queue, before the MySQL connection manager thread has
+# processed them. If you have a very high connection rate and experience
+# "connection refused" errors, you might need to increase this value.
+# Check your OS documentation for the maximum value of this parameter.
+# Attempting to set back_log higher than your operating system limit
+# will have no effect.
back_log = 50
-
-# Don't listen on a TCP/IP port at all. This can be a security enhancement,
-# if all processes that need to connect to mysqld run on the same host.
-# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Don't listen on a TCP/IP port at all. This can be a security
+# enhancement, if all processes that need to connect to mysqld run
+# on the same host. All interaction with mysqld must be made via Unix
+# sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#skip-networking
-# Maximum amount of concurrent sessions MySQL server will allow
-# One of these connections will be reserved for user with SUPER privelege
-# to allow administrator to login even if server is overloaded.
+# The maximum amount of concurrent sessions the MySQL server will
+# allow. One of these connections will be reserved for a user with
+# SUPER privileges to allow the administrator to login even if the
+# connection limit has been reached.
max_connections = 100
-
-# Maximum amount of errors allowed per host. If this limit is reached
-# host will be blocked from connection MySQL server until "flush hosts"
-# is run or server restart. Invalid passwords as any other errors at
-# connect phase results in increasing this value. See
-# Aborted_Connects status variable for global counter.
+# Maximum amount of errors allowed per host. If this limit is reached,
+# the host will be blocked from connecting to the MySQL server until
+# "FLUSH HOSTS" has been run or the server was restarted. Invalid
+# passwords and other errors during the connect phase result in
+# increasing this value. See the "Aborted_Connects" status variable for
+# global counter.
max_connect_errors = 10
-
-# Amount of tables server can keep open at the time. Each table
-# may require up to 2 file handlers (for MERGE tables even more)
-# so make sure to have amount of open files allowed at least 4096
-# see open-files-limit in [mysqld_safe]
+# The number of open tables for all threads. Increasing this value
+# increases the number of file descriptors that mysqld requires.
+# Therefore you have to make sure to set the amount of open files
+# allowed to at least 4096 in the variable "open-files-limit" in
+# section [mysqld_safe]
table_cache = 2048
-# Do not use file level locking. Enabled file locking give performance
-# hit, so use it only in case you have serveral database instances
-# running on the same files (note some restrictions still apply!)
-# or if you use other software relaying on locking MyISAM tables
-# on file level
-#enable-locking
+# Enable external file level locking. Enabled file locking will have a
+# negative impact on performance, so only use it in case you have
+# multiple database instances running on the same files (note some
+# restrictions still apply!) or if you use other software relying on
+# locking MyISAM tables on file level.
+#external-locking
-# This packets limits maximum size of BLOB server can handle
-# as well as maximum query size server can process
-# enlarged dynamically, for each connection
+# The maximum size of a query packet the server can handle as well as
+# maximum query size server can process (Important when working with
+# large BLOBs). enlarged dynamically, for each connection.
max_allowed_packet = 16M
-# Binary log cache is used for logging transactions to binary log
-# all statements from transactions are buffered in binary log cache
-# and wrote to the binary log at once on commit
-# if transaction is large than this value disk temporary file is used.
-# This buffer is allocated per connection on first update statement
-# in transaction
+# The size of the cache to hold the SQL statements for the binary log
+# during a transaction. If you often use big, multi-statement
+# transactions you can increase this value to get more performance. All
+# statements from transactions are buffered in the binary log cache and
+# are being written to the binary log at once after the COMMIT. If the
+# transaction is larger than this value, temporary file on disk is used
+# instead. This buffer is allocated per connection on first update
+# statement in transaction
binlog_cache_size = 1M
+# Maximum allowed size for a single HEAP (in memory) table. This option
+# is a protection against the accidential creation of a very large HEAP
+# table which could otherwise use up all memory resources.
+max_heap_table_size = 64M
-# Maximum allowed size for single HEAP (in memory) table
-# This option is protection from accidential creation of the HEAP
-# table which would take all the memory resources
-max_heap_table_size=64M
-
-
-# Sort buffer used to perform sorts for some of ORDER BY and
-# GROUP BY queries. If sorted data does not fit into sort buffer
-# Disk based merge sort is used - See sort_merge_passes.
-# Allocated per thread if sort is needed
+# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
+# queries. If sorted data does not fit into the sort buffer, a disk
+# based merge sort is used instead - See "sort_merge_passes". Allocated
+# per thread if sort is needed.
sort_buffer_size = 8M
-# This buffer is used for optimization of full joins (joins without indexes)
-# Such joins are very bad for performance in most cases anyway, but having
-# this variable large reduces performance impact.
-# see select_full_join status variable for full joins count
-# Allocated per thread if full join is found
-join_buffer_size=8M
-
-
-# Cache threads on disconnect instead of destroying them
-# thread cache allows to greatly reduce amount of thread
-# creations needed if you have a lot of connections
+# This buffer is used for the optimization of full JOINs (JOINs without
+# indexes). Such JOINs are very bad for performance in most cases
+# anyway, but setting this variable to a large value reduces the
+# performance impact. See the "select_full_join" status variable for a
+# count of full JOINs. Allocated per thread if full join is found
+join_buffer_size = 8M
+
+# How many threads we should keep in a cache for reuse. When a client
+# disconnects, the client's threads are put in the cache if there aren't
+# more than thread_cache_size threads from before. This greatly reduces
+# the amount of thread creations needed if you have a lot of new
+# connections. (Normally this doesn't give a notable performance
+# improvement if you have a good thread implementation.)
thread_cache = 8
-
-# Try number of CPU's*(2..4) for thread_concurrency
-# This value makes sense only on few systems (as Solaris)
-# which support thread_concurrency() setting
+# This permits the application to give the threads system a hint for the
+# desired number of threads that should be run at the same time. This
+# value only makes sense on systems that support the thread_concurrency()
+# function call (Sun Solaris, for example).
+# You should try [number of CPUs]*(2..4) for thread_concurrency
thread_concurrency = 8
-
-# Query cache is used to cache SELECT results and later return
-# them without actual query execution for exactly the same query
-# Having query cache enabled may give great benefit if your have
-# typical queries and rarely changed tabled
-# see Qcache_lowmem_prunes status variable to check if current
-# value is enough for your load
-# Note: In case your table change all the time or you never have
-# textually same queries query cache maay bring slowdown
-# instead of performance improvement
+# Query cache is used to cache SELECT results and later return them
+# without actual executing the same query once again. Having the query
+# cache enabled may result in significant speed improvements, if your
+# have a lot of identical queries and rarely changing tables. See the
+# "Qcache_lowmem_prunes" status variable to check if the current value
+# is high enough for your load.
+# Note: In case your tables change very often or if your queries are
+# textually different every time, the query cache may result in a
+# slowdown instead of a performance improvement.
query_cache_size = 64M
-# Cache only result sets which are smaller than this limit
-# This setting is protection of very large result set overwriting
-# all queries in query cache
+# Only cache result sets that are smaller than this limit. This is to
+# protect the query cache of a very large result set overwriting all
+# other query results.
query_cache_limit = 2M
-# Minimum word length to be indexed by full text search index
-# you might wish to decrease it if you need to search on shorter words
+# Minimum word length to be indexed by the full text search index.
+# You might wish to decrease it if you need to search for shorter words.
+# Note that you need to rebuild your FULLTEXT index, after you have
+# modified this value.
ft_min_word_len = 4
-# If your system supports memlock() function you might use this option
-# while running MySQL to keep it locking in memory, avoid potential
-# swapping out in case of high memory pressure. Good for performance.
+# If your system supports the memlock() function call, you might want to
+# enable this option while running MySQL to keep it locked in memory and
+# to avoid potential swapping out in case of high memory pressure. Good
+# for performance.
#memlock
-# Table type which is used by default, if not specified by CREATE TABLE
-# it affects only tables explicitly created by user.
+# Table type which is used by default when creating new tables, if not
+# specified differently during the CREATE TABLE statement.
default_table_type = MYISAM
-# Thread stack size to use. This amount of memory is always reserved at
-# connection time. MySQL itself usually needs no more than 64K of memory,
-# while if you use your own stack hungry UDF functions or OS requires more
-# stack for some operations, you might need to set it higher
+# Thread stack size to use. This amount of memory is always reserved at
+# connection time. MySQL itself usually needs no more than 64K of
+# memory, while if you use your own stack hungry UDF functions or your
+# OS requires more stack for some operations, you might need to set this
+# to a higher value.
thread_stack = 192K
-# Set default transaction isolation level. Levels available are:
+# Set the default transaction isolation level. Levels available are:
# READ-UNCOMMITED, READ-COMMITED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = REPEATABLE-READ
-# Maximum size for internal in memory temporary table. If table
-# grows larger it is automatically converted to disk based table
-# This limitaion is for single table. There can be many of them.
+# Maximum size for internal (in-memory) temporary tables. If a table
+# grows larger than this value, it is automatically converted to disk
+# based table This limitation is for a single table. There can be many
+# of them.
tmp_table_size = 64M
-# binary logging is required for acting MASTER in replication
-# You also need binary log if you need ability to do point
-# in time recovery from your latest backup
+# Enable binary logging. This is required for acting as a MASTER in a
+# replication configuration. You also need the binary log if you need
+# the ability to do point in time recovery from your latest backup.
log_bin
-# If you're using chaining replication A->B->C you might wish to
-# turn on this option on server B. It makes updates done by
-# slave thread also logged in binary log. Normally they are not
+# If you're using replication with chained slaves (A->B->C), you need to
+# enable this option on server B. It enables logging of updates done by
+# the slave thread into the slave's binary log.
#log_slave_updates
-
-# Full query log. Every query (even with incorrect syntax) server gets goes here.
-# Useful for debugging. Normally is disabled in production
+# Enable the full query log. Every query (even ones with incorrect
+# syntax) that the server receives will be logged. This is useful for
+# debugging, it is usually disabled in production use.
#log
-# If you have any problems with MySQL server you might enable Warnings logging and
-# examine error log for possible explanations.
+# Print warnings to the error log file. If you have any problem with
+# MySQL you should enable logging of warnings and examine the error log
+# for possible explanations.
#log_warnings
-# Log slow queries. Slow queries are queries which take more than defined amount of time
-# or which do not use indexes well, if log_long_format is enabled
-# It is notmally good idea to have this on if you frequently add new queries to the system
+# Log slow queries. Slow queries are queries which take more than the
+# amount of time defined in "long_query_time" or which do not use
+# indexes well, if log_long_format is enabled. It is normally good idea
+# to have this turned on if you frequently add new queries to the
+# system.
log_slow_queries
-
-# All queries taking more than this amount of time will be trated as slow. Do not use value 1
-# here as this will result even in very fast queries logged sometimes, as MySQL measures time with
-# second accuracy only.
+# All queries taking more than this amount of time (in seconds) will be
+# trated as slow. Do not use "1" as a value here, as this will result in
+# even very fast queries being logged from time to time (as MySQL
+# currently measures time with second accuracy only).
long_query_time = 2
-# Log more information in slow query log. Normally it is good to have this on.
-# It results in logging of queries not using indexes additionally to long running queries.
+# Log more information in the slow query log. Normally it is good to
+# have this turned on. This will enable logging of queries that are not
+# using indexes in addition to long running queries.
log_long_format
+# The directory used by MySQL for storing temporary files. For example,
+# it is used to perform disk based large sorts, as well as for internal
+# and explicit temporary tables. It might be good to put it on a
+# swapfs/tmpfs filesystem, if you do not create very large temporary
+# files. Alternatively you can put it on dedicated disk. You can
+# specify multiple paths here by separating them by ";" - they will then
+# be used in a round-robin fashion.
+#tmpdir = /tmp
-# Temporary directory is used by MySQL for storing temporary files, for example
-# used to do disk based large sorts, as well as for internal and explicit
-# temporary tables.
-# It might be good to set it to swapfs/tmpfs filesystem if you do not have very
-# large temporary files created or set it to dedicated disk
-# You can specify several paths here spliting them by ";" they will be used in
-# round-robin fashion
-#tmpdir = /tmp
+# *** Replication related settings
-#*** Replication related settings
-
-
-# This value is required both for master ans slave
-# If you have single master it is typical to use value 1 for it
-# required unique id between 1 and 2^32 - 1
-# defaults to 1 if master-host is not set
-# but will not function as a master if omitted
+# Unique server identification number between 1 and 2^32-1. This value
+# is required for both master and slave hosts. It defaults to 1 if
+# "master-host" is not set, but will MySQL will not function as a master
+# if it is omitted.
server-id = 1
-
-# To configure this server as Replication Slave you will need
-# to set its server_id to some unique value, different from Master
-# and all slaves in the group.
-# You also can disable log-bin as logs are not required (while recomended)
-# for slaves
-#
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
#
-# The recomended way to set MASTER settings for the slave are:
-# Use the CHANGE MASTER TO command (fully described in our manual) -
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
@@ -252,191 +262,221 @@ server-id = 1
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
-# However if you need to replicate slave configuration over several boxes
-# you can use old approach:
+# OR
#
-# Set the variables below. However, in case you choose this method, then
+# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
-# change in this file to the variables' values below will be ignored and
+# changes in this file to the variable values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id = 2
#
# The replication master for this slave - required
-#master-host = <hostname>
+#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
-#master-user = <username>
+#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
-#master-password = <password>
+#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
-#master-port = <port>
+#master-port = <port>
-# Make Slave ReadOnly. Only user with SUPER privelege and slave
-# thread will be able to modify it. You might use it to ensure
-# no applications will accidently modify slave instead of master
+# Make the slave read-only. Only users with the SUPER privilege and the
+# replication slave thread will be able to modify data on it. You can
+# use this to ensure that no applications will accidently modify data on
+# the slave instead of the master
#read_only
-
#*** MyISAM Specific options
-# Size of Key Buffer, used to cache index blocks for MyISAM tables
-# Do not set it larger than 30% of available memory, as some memory
-# is required by OS to cache rows.
-# Even if you're not using MyISAM tables still set it to 8-64M
-# as it will be used for internal temporary disk tables.
+# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
+# Do not set it larger than 30% of your available memory, as some memory
+# is also required by the OS to cache rows. Even if you're not using
+# MyISAM tables, you should still set it to 8-64M as it will also be
+# used for internal temporary disk tables.
key_buffer_size = 32M
-# Size of buffer used for doing full table scans for MyISAM tables
-# allocated per thread, as full scan is needed
+# Size of the buffer used for doing full table scans of MyISAM tables.
+# Allocated per thread, if a full scan is needed.
read_buffer_size = 2M
-# Buffer is used for caching the rows while doing Sorts
-# Allocated per thread, then needed
+# When reading rows in sorted order after a sort, the rows are read
+# through this buffer to avoid a disk seeks. You can improve ORDER BY
+# performance a lot, if set this to a high value.
+# Allocated per thread, when needed.
read_rnd_buffer_size = 16M
-# The bulk insert tree is used for optimization of index modification
-# for bulk inserts (hundreds+ values) and LOAD DATA INFILE
-# Do not set larger than key_buffer_size for optimal performance
-# This buffer is allocated than bulk insert is detected
+# MyISAM uses special tree-like cache to make bulk inserts (that is,
+# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
+# INFILE) faster. This variable limits the size of the cache tree in
+# bytes per thread. Setting it to 0 will disable this optimisation. Do
+# not set it larger than "key_buffer_size" for optimal performance.
+# This buffer is allocated when a bulk insert is detected.
bulk_insert_buffer_size = 64M
-
-# This buffer is allocated than MySQL needs to rebuild the Index,
-# in REPAIR, OPTIMZE, ALTER table statements as well as in
-# LOAD DATA INFILE to empty table
-# it is allocated per thread so be careful with large settings.
+# This buffer is allocated when MySQL needs to rebuild the index in
+# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
+# into an empty table. It is allocated per thread so be careful with
+# large settings.
myisam_sort_buffer_size = 128M
-# Maximum size of temporary (sort) file index rebuild can use.
-# If sort is estimated to take larger amount of space, mush slower
-# (keycache) index rebuild method will be used
+# The maximum size of the temporary file MySQL is allowed to use while
+# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
+# If the file-size would be bigger than this, the index will be created
+# through the key cache (which is slower).
myisam_max_sort_file_size = 10G
-# Use sort method in case the difference between sort file and
-# Table index file is estimated to be less than this value
+# If the temporary file used for fast index creation would be bigger
+# than using the key cache by the amount specified here, then prefer the
+# key cache method. This is mainly used to force long character keys in
+# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size = 10G
-# If table has more than one index MyISAM can use more than one thread
-# to repair them in parallel. It makes sense if you have multiple of
-# CPUs and planty of memory.
+# If a table has more than one index, MyISAM can use more than one
+# thread to repair them by sorting in parallel. This makes sense if you
+# have multiple CPUs and plenty of memory.
myisam_repair_threads = 1
-# Automatically check and repair not properly closed MyISAM tables
+# Automatically check and repair not properly closed MyISAM tables.
myisam_recover
+# *** BDB Specific options ***
-#*** BDB Specific options
-
-# Use this option if you have BDB tables enabled but you do not plan to use them
+# Use this option if you run a MySQL server with BDB support enabled but
+# you do not plan to use it. This will save memory and may speed up some
+# things.
skip-bdb
-#*** INNODB Specific options
+# *** INNODB Specific options ***
-# Use this option if you have INNODB tables enabled but you do not plan to use them
+# Use this option if you have a MySQL server with InnoDB support enabled
+# but you do not plan to use it. This will save memory and disk space
+# and speed up some things.
#skip-innodb
-# Additional memory pool is used by Innodb to store metadata information.
-# If Innodb needs more memory for this purpose to allocate it from OS
-# As it is fast enough on most recent OS you normally do not need to set it higher
-# SHOW INNODB STATUS will show current amount of it in use
+# Additional memory pool that is used by InnoDB to store metadata
+# information. If InnoDB requires more memory for this purpose it will
+# start to allocate it from the OS. As this is fast enough on most
+# recent operating systems, you normally do not need to change this
+# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M
-# Innodb, unlike MyISAM uses bufferpool to cache both indexes and row data
-# so you would normally wish to have it large up to 50-70% of your memory size
-# Note on 32bit systems you might be limited to 2-3.5G of user level memory
-# per process so do not set it too high.
+# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
+# row data. The bigger you set this the less disk I/O is needed to
+# access data in tables. On a dedicated database server you may set this
+# parameter up to 80% of the machine physical memory size. Do not set it
+# too large, though, because competition of the physical memory may
+# cause paging in the operating system. Note that on 32bit systems you
+# might be limited to 2-3.5G of user level memory per process, so do not
+# set it too high.
innodb_buffer_pool_size = 2G
-# Innodb stores data in one or several files forming tablespace. If you have
-# single logical drive for your data, single autoextending file would be good enough
-# In other case single file per device is often good choice.
-# You may setup Innodb to use Raw disk partitions as well. Refer to the manual.
+# InnoDB stores data in one or more data files forming the tablespace.
+# If you have a single logical drive for your data, a single
+# autoextending file would be good enough. In other cases, a single file
+# per device is often a good choice. You can configure InnoDB to use raw
+# disk partitions as well - please refer to the manual for more info
+# about this.
innodb_data_file_path = ibdata1:10M:autoextend
+# Set this option if you would like the InnoDB tablespace files to be
+# stored in another location. By default this is the MySQL datadir.
+#innodb_data_home_dir = <directory>
-# Set this option if you would like Innodb tablespace files to be stored in other
-# location. Default is MySQL datadir.
-#innodb_data_home_dir
-
-# Number of IO threads to use for async IO operations. This value is hardcoded to
-# 4 on Unix
+# Number of IO threads to use for async IO operations. This value is
+# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
+# larger number.
innodb_file_io_threads = 4
-
-# If you run into Innodb tablespace corruption, setting this to nonzero value will
-# likely help you to dump your tables. Start from value 1 and increase it until
-# you're able to dump the table successfully.
+# If you run into InnoDB tablespace corruption, setting this to a nonzero
+# value will likely help you to dump your tables. Start from value 1 and
+# increase it until you're able to dump the table successfully.
#innodb_force_recovery=1
-# Number of threads allowed inside of Innodb kernel. Best setting highly depends
-# on the application, hardware as well as OS scheduler properties
-# Too high value may lead to thread thrashing
+# Number of threads allowed inside the InnoDB kernel. The optimal value
+# depends highly on the application, hardware as well as the OS
+# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency = 16
-
-# If set to 1 Innodb will flush(fsync) logs to the disk at each transaction commit
-# which offers full ACID behavior, however if you can afford few last commited transaction
-# lost you can set this value to 2 or 0. Innodb will anyway flush the log file once
-# per second. 0 - do not flush file at all. 2 - flush it to OS buffers but not to the disk.
+# If set to 1, InnoDB will flush (fsync) the transaction logs to the
+# disk at each commit, which offers full ACID behavior. If you are
+# willing to compromise this safety, and you are running small
+# transactions, you may set this to 0 or 2 to reduce disk I/O to the
+# logs. Value 0 means that the log is only written to the log file and
+# the log file flushed to disk approximately once per second. Value 2
+# means the log is written to the log file at each commit, but the log
+# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit = 1
-
-# Innodb uses fast shutdown by default. However you can disable it to make Innodb to do
-# purge and Insert buffer merge on shutdown. It may increase shutdown time a lot but
-# Innodb will have not need to do it after next startup
+# Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
+# and insert buffer merge on shutdown. It may increase shutdown time a
+# lot, but InnoDB will have to do it on the next startup instead.
#innodb_fast_shutdown
-# Buffer Innodb shall use for buffering log data. As soon as it is full Innodb
-# will have to flush it. As it is flushed once per second anyway even with
-# long transactions it does not make sense to have it very large.
+# The size of the buffer InnoDB uses for buffering log data. As soon as
+# it is full, InnoDB will have to flush it to disk. As it is flushed
+# once per second anyway, it does not make sense to have it very large
+# (even with long transactions).
innodb_log_buffer_size = 8M
-# Size of log file in group. You shall set combined size of log files large 25%-100% of
-# your buffer pool size to avoid not needed buffer pool flush activity on log file
-# overwrite. Note however larger logfile size will increase time needed for recovery
-# process.
+# Size of each log file in a log group. You should set the combined size
+# of log files to about 25%-100% of your buffer pool size to avoid
+# unneeded buffer pool flush activity on log file overwrite. However,
+# note that a larger logfile size will increase the time needed for the
+# recovery process.
innodb_log_file_size = 256M
-# Total number of files in the log group. Value 2-3 is usually good enough.
+# Total number of files in the log group. A value of 2-3 is usually good
+# enough.
innodb_log_files_in_group = 3
-# Location for Innodb log files. Default is MySQL datadir. You may wish to
-# point it to dedicated hard drive or RAID1 volume for improved performance
+# Location of the InnoDB log files. Default is the MySQL datadir. You
+# may wish to point it to a dedicated hard drive or a RAID1 volume for
+# improved performance
#innodb_log_group_home_dir
-# Maximum allowed Percentage of dirty pages in Innodb buffer pool.
-# If it is reached Innodb will start flushing them agressively not to run
-# out of clean pages at all. This is a soft limit, not guarantied to be held.
+# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
+# If it is reached, InnoDB will start flushing them out agressively to
+# not run out of clean pages at all. This is a soft limit, not
+# guaranteed to be held.
innodb_max_dirty_pages_pct = 90
-
-# Set flush method Innodb will use for Log. Tablespace always uses doublewrite flush logic.
-#innodb_flush_method
-
-# How long Innodb transaction shall wait for lock to be granted before giving up.
-# This value does not correspond to deadlock resolution. Innodb will detect Deadlock
-# as soon as it is formed.
+# The flush method InnoDB will use for Log. The tablespace always uses
+# doublewrite flush logic. The default value is "fdatasync", another
+# option is "O_DSYNC".
+#innodb_flush_method=O_DSYNC
+
+# How long an InnoDB transaction should wait for a lock to be granted
+# before being rolled back. InnoDB automatically detects transaction
+# deadlocks in its own lock table and rolls back the transaction. If you
+# use the LOCK TABLES command, or other transaction-safe storage engines
+# than InnoDB in the same transaction, then a deadlock may arise which
+# InnoDB cannot notice. In cases like this the timeout is useful to
+# resolve the situation.
innodb_lock_wait_timeout = 120
-
[mysqldump]
-# Do not buffer whole result set in memory before writing it to file
-# required for dumping very large tables
+# Do not buffer the whole result set in memory before writing it to
+# file. Required for dumping very large tables
quick
max_allowed_packet = 16M
@@ -444,7 +484,7 @@ max_allowed_packet = 16M
[mysql]
no-auto-rehash
-# Remove the next comment character if you are not familiar with SQL
+# Only allow UPDATEs and DELETEs that use keys.
#safe-updates
[isamchk]
@@ -463,7 +503,7 @@ write_buffer = 8M
interactive-timeout
[mysqld_safe]
-# Increase amount of open files allowed per process
-# Warning: Make sure you have global system limit high enough
-# The high value is required for large number of opened tables
+# Increase the amount of open files allowed per process. Warning: Make
+# sure you have set the global system limit high enough! The high value
+# is required for a large number of opened tables
open-files-limit = 8192
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 898b9a96c11..6f5c4142a45 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -26,8 +26,8 @@
#include <mysql_com.h>
#include <errno.h>
-#include <violite.h>
#include <my_sys.h>
+#include <violite.h>
#include <my_net.h>
#include <m_string.h>