Commit df56b252 authored by monty@work.mysql.com's avatar monty@work.mysql.com

merge

parents 052225a4 8ad79ab0
...@@ -15,6 +15,10 @@ $make -k clean || true ...@@ -15,6 +15,10 @@ $make -k clean || true
aclocal && autoheader && aclocal && automake && autoconf aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all) (cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf) (cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
if [ -d gemini ]
then
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
fi
CFLAGS=\"$cflags\" CXX=gcc CXXFLAGS=\"$cxxflags\" $configure" CFLAGS=\"$cflags\" CXX=gcc CXXFLAGS=\"$cxxflags\" $configure"
......
...@@ -43,8 +43,11 @@ alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet ...@@ -43,8 +43,11 @@ alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
pentium_cflags="-mpentiumpro" pentium_cflags="-mpentiumpro"
sparc_cflags="" sparc_cflags=""
# be as fast as we can be without losing our ability to backtrace
fast_cflags="-O3 -fno-omit-frame-pointer" fast_cflags="-O3 -fno-omit-frame-pointer"
reckless_cflags="-O3 -fomit-frame-pointer -ffixed-ebp" # this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer "
debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O2" debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O2"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
extra_flags="$pentium_cflags $reckless_cflags" extra_flags="$pentium_cflags $fast_cflags"
extra_configs="$pentium_configs" extra_configs="$pentium_configs"
strip=yes strip=yes
......
tonu@hundin.mysql.fi jani@janikt.pp.saunalahti.fi
monty@hundin.mysql.fi
mwagner@evoq.mwagner.org
sasha@mysql.sashanet.com sasha@mysql.sashanet.com
tonu@hundin.mysql.fi
monty@work.mysql.com
This diff is collapsed.
...@@ -1097,10 +1097,10 @@ dnl echo "DBG_GEM1: gemini='$gemini'" ...@@ -1097,10 +1097,10 @@ dnl echo "DBG_GEM1: gemini='$gemini'"
gemini_includes= gemini_includes=
gemini_libs= gemini_libs=
case "$gemini" in case "$gemini" in
no | default | *) no)
AC_MSG_RESULT([Not using Gemini DB]) AC_MSG_RESULT([Not using Gemini DB])
;; ;;
yes ) yes | default | *)
have_gemini_db="yes" have_gemini_db="yes"
gemini_includes="-I../gemini/incl -I../gemini" gemini_includes="-I../gemini/incl -I../gemini"
gemini_libs="\ gemini_libs="\
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
#define ADMIN_VERSION "8.20" #define ADMIN_VERSION "8.21"
#define MAX_MYSQL_VAR 64 #define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
...@@ -870,7 +870,7 @@ static int drop_db(MYSQL *mysql, const char *db) ...@@ -870,7 +870,7 @@ static int drop_db(MYSQL *mysql, const char *db)
return -1; return -1;
} }
} }
sprintf(name_buff,"drop database %.*s",FN_REFLEN,db); sprintf(name_buff,"drop database `%.*s`",FN_REFLEN,db);
if (mysql_query(mysql,name_buff)) if (mysql_query(mysql,name_buff))
{ {
my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL), my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL),
......
...@@ -338,7 +338,7 @@ static int get_options(int *argc, char ***argv) ...@@ -338,7 +338,7 @@ static int get_options(int *argc, char ***argv)
{ {
int pnlen = strlen(my_progname); int pnlen = strlen(my_progname);
if (pnlen < 6) // name too short if (pnlen < 6) /* name too short */
what_to_do = DO_CHECK; what_to_do = DO_CHECK;
else if (!strcmp("repair", my_progname + pnlen - 6)) else if (!strcmp("repair", my_progname + pnlen - 6))
what_to_do = DO_REPAIR; what_to_do = DO_REPAIR;
......
...@@ -285,8 +285,10 @@ export CC CFLAGS LD LDFLAGS ...@@ -285,8 +285,10 @@ export CC CFLAGS LD LDFLAGS
if test "$GXX" = "yes" if test "$GXX" = "yes"
then then
# mysqld requires this when compiled with gcc # mysqld requires -fno-implicit-templates.
CXXFLAGS="$CXXFLAGS -fno-implicit-templates" # Disable exceptions as they seams to create problems with gcc and threads.
# mysqld doesn't use run-time-type-checking, so we disable it.
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
fi fi
# Avoid bug in fcntl on some versions of linux # Avoid bug in fcntl on some versions of linux
...@@ -786,6 +788,11 @@ case $SYSTEM_TYPE in ...@@ -786,6 +788,11 @@ case $SYSTEM_TYPE in
echo "Enabling snprintf workaround for hpux 10.20" echo "Enabling snprintf workaround for hpux 10.20"
CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ" CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ" CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ"
if test "$with_named_thread" = "no"
then
echo "Using --with-named-thread=-lpthread"
with_named_thread="-lcma"
fi
;; ;;
*hpux11.*) *hpux11.*)
echo "Enabling pread/pwrite workaround for hpux 11" echo "Enabling pread/pwrite workaround for hpux 11"
...@@ -1082,7 +1089,7 @@ fi ...@@ -1082,7 +1089,7 @@ fi
AC_MSG_CHECKING("named thread libs:") AC_MSG_CHECKING("named thread libs:")
if test "$with_named_thread" != "no" if test "$with_named_thread" != "no"
then then
LIBS="$LIBS $with_named_thread" LIBS="$with_named_thread $LIBS $with_named_thread"
with_posix_threads="yes" with_posix_threads="yes"
with_mit_threads="no" with_mit_threads="no"
AC_MSG_RESULT("$with_named_thread") AC_MSG_RESULT("$with_named_thread")
...@@ -2074,6 +2081,17 @@ EOF ...@@ -2074,6 +2081,17 @@ EOF
echo "END OF INNODB CONFIGURATION" echo "END OF INNODB CONFIGURATION"
fi fi
if test "X$have_gemini_db" = "Xyes"; then
sql_server_dirs="gemini $sql_server_dirs"
echo "CONFIGURING FOR GEMINI DB"
(cd gemini && sh ./configure) \
|| AC_MSG_ERROR([could not configure Gemini DB])
echo "END OF GEMINI DB CONFIGURATION"
AC_DEFINE(HAVE_GEMINI_DB)
fi
if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes" if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes"
then then
# MIT user level threads # MIT user level threads
......
...@@ -213,6 +213,7 @@ enum ha_base_keytype { ...@@ -213,6 +213,7 @@ enum ha_base_keytype {
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ #define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
#define HA_ERR_LOCK_WAIT_TIMEOUT 146 #define HA_ERR_LOCK_WAIT_TIMEOUT 146
#define HA_ERR_LOCK_TABLE_FULL 147 #define HA_ERR_LOCK_TABLE_FULL 147
#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */
/* Other constants */ /* Other constants */
......
...@@ -62,6 +62,8 @@ extern int NEAR my_errno; /* Last error in mysys */ ...@@ -62,6 +62,8 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */ #define MY_COPYTIME 64 /* my_redel() copys time */
#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
#define MY_REDEL_MAKE_BACKUP 256 #define MY_REDEL_MAKE_BACKUP 256
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
...@@ -382,6 +384,12 @@ extern File my_create(const char *FileName,int CreateFlags, ...@@ -382,6 +384,12 @@ extern File my_create(const char *FileName,int CreateFlags,
int AccsesFlags, myf MyFlags); int AccsesFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags); extern int my_close(File Filedes,myf MyFlags);
extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
extern int my_readlink(char *to, const char *filename, myf MyFlags);
extern int my_realpath(char *to, const char *filename, myf MyFlags);
extern File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags,
myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags); extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset, extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
myf MyFlags); myf MyFlags);
...@@ -432,8 +440,14 @@ extern int my_redel(const char *from, const char *to, int MyFlags); ...@@ -432,8 +440,14 @@ extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags); extern int my_copystat(const char *from, const char *to, int MyFlags);
extern my_string my_filename(File fd); extern my_string my_filename(File fd);
#ifndef THREAD
extern void dont_break(void); extern void dont_break(void);
extern void allow_break(void); extern void allow_break(void);
#else
#define dont_break()
#define allow_break()
#endif
extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
extern void caseup(my_string str,uint length); extern void caseup(my_string str,uint length);
extern void casedn(my_string str,uint length); extern void casedn(my_string str,uint length);
......
...@@ -205,6 +205,9 @@ ...@@ -205,6 +205,9 @@
#define ER_SLAVE_THREAD 1202 #define ER_SLAVE_THREAD 1202
#define ER_TOO_MANY_USER_CONNECTIONS 1203 #define ER_TOO_MANY_USER_CONNECTIONS 1203
#define ER_SET_CONSTANTS_ONLY 1204 #define ER_SET_CONSTANTS_ONLY 1204
#define ER_CONNECT_TO_MASTER 1205 #define ER_LOCK_WAIT_TIMEOUT 1205
#define ER_QUERY_ON_MASTER 1206 #define ER_LOCK_TABLE_FULL 1206
#define ER_ERROR_MESSAGES 207 #define ER_READ_ONLY_TRANSACTION 1207
#define ER_CONNECT_TO_MASTER 1208
#define ER_QUERY_ON_MASTER 1209
#define ER_ERROR_MESSAGES 210
...@@ -22,7 +22,7 @@ extern "C" { ...@@ -22,7 +22,7 @@ extern "C" {
#endif #endif
#define GLOB 0 /* Error maps */ #define GLOB 0 /* Error maps */
#define GLOBERRS 24 /* Max number of error messages in map's */ #define GLOBERRS 27 /* Max number of error messages in map's */
#define EE(X) globerrs[ X ] /* Defines to add error to right map */ #define EE(X) globerrs[ X ] /* Defines to add error to right map */
extern const char * NEAR globerrs[]; /* my_error_messages is here */ extern const char * NEAR globerrs[]; /* my_error_messages is here */
...@@ -51,6 +51,9 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ ...@@ -51,6 +51,9 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_CANT_MKDIR 21 #define EE_CANT_MKDIR 21
#define EE_UNKNOWN_CHARSET 22 #define EE_UNKNOWN_CHARSET 22
#define EE_OUT_OF_FILERESOURCES 23 #define EE_OUT_OF_FILERESOURCES 23
#define EE_CANT_READLINK 24
#define EE_CANT_SYMLINK 25
#define EE_REALPATH 26
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -38,6 +38,7 @@ AC_CHECK_HEADERS(aio.h sched.h) ...@@ -38,6 +38,7 @@ AC_CHECK_HEADERS(aio.h sched.h)
AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(int, 4)
AC_CHECK_FUNCS(sched_yield) AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(fdatasync) AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS(localtime_r)
#AC_C_INLINE Already checked in MySQL #AC_C_INLINE Already checked in MySQL
AC_C_BIGENDIAN AC_C_BIGENDIAN
...@@ -95,6 +96,11 @@ case "$target_os" in ...@@ -95,6 +96,11 @@ case "$target_os" in
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac esac
case "$target" in
i[[4567]]86-*-*)
CFLAGS="$CFLAGS -DUNIV_INTEL_X86";;
esac
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile
buf/Makefile com/Makefile data/Makefile buf/Makefile com/Makefile data/Makefile
dict/Makefile dyn/Makefile dict/Makefile dyn/Makefile
......
...@@ -86,6 +86,20 @@ mutex_test_and_set( ...@@ -86,6 +86,20 @@ mutex_test_and_set(
/* mutex_fence(); */ /* mutex_fence(); */
return(res); return(res);
#elif defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw;
ulint res;
lw = &(mutex->lock_word);
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
"=eax" (res):
"ecx" (lw));
return(res);
#else #else
ibool ret; ibool ret;
...@@ -120,9 +134,10 @@ mutex_reset_lock_word( ...@@ -120,9 +134,10 @@ mutex_reset_lock_word(
__asm XCHG EDX, DWORD PTR [ECX] __asm XCHG EDX, DWORD PTR [ECX]
#else #else
mutex->lock_word = 0; mutex->lock_word = 0;
#if !(defined(__GNUC__) && defined(UNIV_INTEL_X86))
os_fast_mutex_unlock(&(mutex->os_fast_mutex)); os_fast_mutex_unlock(&(mutex->os_fast_mutex));
#endif #endif
#endif
} }
/********************************************************************** /**********************************************************************
......
...@@ -136,6 +136,13 @@ ut_difftime( ...@@ -136,6 +136,13 @@ ut_difftime(
/* out: time2 - time1 expressed in seconds */ /* out: time2 - time1 expressed in seconds */
ib_time_t time2, /* in: time */ ib_time_t time2, /* in: time */
ib_time_t time1); /* in: time */ ib_time_t time1); /* in: time */
/**************************************************************
Prints a timestamp to a file. */
void
ut_print_timestamp(
/*===============*/
FILE* file); /* in: file where to print */
/***************************************************************** /*****************************************************************
Runs an idle loop on CPU. The argument gives the desired delay Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++. */ in microseconds on 100 MHz Pentium + Visual C++. */
......
...@@ -2634,8 +2634,9 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -2634,8 +2634,9 @@ logs_empty_and_mark_files_at_shutdown(void)
{ {
dulint lsn; dulint lsn;
ulint arch_log_no; ulint arch_log_no;
fprintf(stderr, "InnoDB: Starting shutdown...\n"); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Starting shutdown...\n");
/* Wait until the master thread and all other operations are idle: our /* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */ algorithm only works if the server is idle at shutdown */
...@@ -2725,7 +2726,8 @@ loop: ...@@ -2725,7 +2726,8 @@ loop:
fil_flush_file_spaces(FIL_TABLESPACE); fil_flush_file_spaces(FIL_TABLESPACE);
fprintf(stderr, "InnoDB: Shutdown completed\n"); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Shutdown completed\n");
} }
/********************************************************** /**********************************************************
......
...@@ -813,7 +813,8 @@ innobase_start_or_create_for_mysql(void) ...@@ -813,7 +813,8 @@ innobase_start_or_create_for_mysql(void)
/* Create the thread which watches the timeouts for lock waits */ /* Create the thread which watches the timeouts for lock waits */
os_thread_create(&srv_lock_timeout_monitor_thread, NULL, os_thread_create(&srv_lock_timeout_monitor_thread, NULL,
thread_ids + 2 + SRV_MAX_N_IO_THREADS); thread_ids + 2 + SRV_MAX_N_IO_THREADS);
fprintf(stderr, "InnoDB: Started\n"); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Started\n");
srv_was_started = TRUE; srv_was_started = TRUE;
srv_is_being_started = FALSE; srv_is_being_started = FALSE;
...@@ -835,8 +836,9 @@ innobase_shutdown_for_mysql(void) ...@@ -835,8 +836,9 @@ innobase_shutdown_for_mysql(void)
{ {
if (!srv_was_started) { if (!srv_was_started) {
if (srv_is_being_started) { if (srv_is_being_started) {
ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: shutting down not properly started database\n"); " InnoDB: Warning: shutting down a not properly started database\n");
} }
return(DB_SUCCESS); return(DB_SUCCESS);
} }
......
...@@ -49,6 +49,51 @@ ut_difftime( ...@@ -49,6 +49,51 @@ ut_difftime(
return(difftime(time2, time1)); return(difftime(time2, time1));
} }
/**************************************************************
Prints a timestamp to a file. */
void
ut_print_timestamp(
/*===============*/
FILE* file) /* in: file where to print */
{
#ifdef __WIN__
SYSTEMTIME cal_tm;
GetLocalTime(&cal_tm);
fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
(int)cal_tm.wYear % 100,
(int)cal_tm.wMonth,
(int)cal_tm.wDay,
(int)cal_tm.wHour,
(int)cal_tm.wMinute,
(int)cal_tm.wSecond);
#else
struct tm cal_tm;
struct tm* cal_tm_ptr;
time_t tm;
time(&tm);
#ifdef HAVE_LOCALTIME_R
localtime_r(&tm, &cal_tm);
cal_tm_ptr = &cal_tm;
#else
cal_tm_ptr = localtime(&tm);
#endif
fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
cal_tm_ptr->tm_year % 100,
cal_tm_ptr->tm_mon+1,
cal_tm_ptr->tm_mday,
cal_tm_ptr->tm_hour,
cal_tm_ptr->tm_min,
cal_tm_ptr->tm_sec);
#endif
}
/***************************************************************** /*****************************************************************
Runs an idle loop on CPU. The argument gives the desired delay Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++. */ in microseconds on 100 MHz Pentium + Visual C++. */
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <violite.h>
#include <assert.h> #include <assert.h>
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
......
...@@ -310,8 +310,9 @@ show_failed_diff () ...@@ -310,8 +310,9 @@ show_failed_diff ()
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
$DIFF -c $result_file $reject_file $DIFF -c $result_file $reject_file
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "Please e-mail the above, along with the output of mysqlbug" echo "Please follow the instructions outlined at"
echo "and any other relevant info to bugs@lists.mysql.com" echo "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html"
echo "to find the reason to this problem and how to report this."
fi fi
} }
......
...@@ -34,3 +34,5 @@ this is a 2 2.0 ...@@ -34,3 +34,5 @@ this is a 2 2.0
1 1 1 1
1 and 0 or 2 2 or 1 and 0 1 and 0 or 2 2 or 1 and 0
1 1 1 1
sum(if(num is null,0.00,num))
144.54
...@@ -24,3 +24,13 @@ select -1.49 or -1.49,0.6 or 0.6; ...@@ -24,3 +24,13 @@ select -1.49 or -1.49,0.6 or 0.6;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1; select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0; select 1 and 0 or 2, 2 or 1 and 0;
#
# Problem with IF()
#
drop table if exists t1;
create table t1 (num double(12,2));
insert into t1 values (144.54);
select sum(if(num is null,0.00,num)) from t1;
drop table t1;
...@@ -33,6 +33,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ ...@@ -33,6 +33,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_alloc.c safemalloc.c my_fopen.c my_fstream.c \ my_alloc.c safemalloc.c my_fopen.c my_fstream.c \
my_error.c errors.c my_div.c my_messnc.c \ my_error.c errors.c my_div.c my_messnc.c \
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c \
mf_pack.c mf_pack2.c mf_unixpath.c mf_stripp.c \ mf_pack.c mf_pack2.c mf_unixpath.c mf_stripp.c \
mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \ mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
mf_qsort.c mf_qsort2.c mf_sort.c \ mf_qsort.c mf_qsort2.c mf_sort.c \
......
...@@ -46,6 +46,9 @@ const char * NEAR globerrs[GLOBERRS]= ...@@ -46,6 +46,9 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't create directory '%s' (Errcode: %d)", "Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file", "Character set '%s' is not a compiled character set and is not specified in the '%s' file",
"Out of resources when opening file '%s' (Errcode: %d)", "Out of resources when opening file '%s' (Errcode: %d)",
"Can't read value for symlink '%s' (Error %d)",
"Can't create symlink '%s' pointing at '%s' (Error %d)",
"Error on realpath() on '%s' (Error %d)",
}; };
void init_glob_errs(void) void init_glob_errs(void)
...@@ -81,6 +84,9 @@ void init_glob_errs() ...@@ -81,6 +84,9 @@ void init_glob_errs()
EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space..."; EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space...";
EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)"; EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)";
EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file"; EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file";
EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)", EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)";
EE(EE_CANT_READLINK)="Can't read value for symlink '%s' (Error %d)";
EE(EE_CANT_SYMLINK)="Can't create symlink '%s' pointing at '%s' (Error %d)";
EE(EE_REALPATH)="Error on realpath() on '%s' (Error %d)";
} }
#endif #endif
...@@ -24,17 +24,15 @@ ...@@ -24,17 +24,15 @@
/* Set variable that we can't break */ /* Set variable that we can't break */
#if !defined(THREAD)
void dont_break(void) void dont_break(void)
{ {
#if !defined(THREAD)
my_dont_interrupt=1; my_dont_interrupt=1;
#endif
return; return;
} /* dont_break */ } /* dont_break */
void allow_break(void) void allow_break(void)
{ {
#if !defined(THREAD)
{ {
reg1 int index; reg1 int index;
...@@ -54,8 +52,8 @@ void allow_break(void) ...@@ -54,8 +52,8 @@ void allow_break(void)
_my_signals=0; _my_signals=0;
} }
} }
#endif
} /* dont_break */ } /* dont_break */
#endif
/* Set old status */ /* Set old status */
......
...@@ -236,11 +236,16 @@ void symdirget(char *dir) ...@@ -236,11 +236,16 @@ void symdirget(char *dir)
*pos++=temp; *pos=0; /* Restore old filename */ *pos++=temp; *pos=0; /* Restore old filename */
if (fp) if (fp)
{ {
if (fgets(buff, sizeof(buff), fp)) if (fgets(buff, sizeof(buff)-1, fp))
{ {
for (pos=strend(buff); for (pos=strend(buff);
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ; pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
pos --); pos --);
/* Ensure that the symlink ends with the directory symbol */
if (pos == buff || pos[-1] != FN_LIBCHAR)
*pos++=FN_LIBCHAR;
strmake(dir,buff, (uint) (pos-buff)); strmake(dir,buff, (uint) (pos-buff));
} }
my_fclose(fp,MYF(0)); my_fclose(fp,MYF(0));
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
#include "mysys_priv.h"
#include "mysys_err.h"
#include <m_string.h>
#ifdef HAVE_REALPATH
#include <sys/param.h>
#include <sys/stat.h>
#endif
/*
Reads the content of a symbolic link
If the file is not a symbolic link, return the original file name in to.
*/
int my_readlink(char *to, const char *filename, myf MyFlags)
{
#ifndef HAVE_READLINK
strmov(to,filename);
return 0;
#else
int result=0;
int length;
DBUG_ENTER("my_readlink");
if ((length=readlink(filename, to, FN_REFLEN-1)) < 0)
{
/* Don't give an error if this wasn't a symlink */
if ((my_errno=errno) == EINVAL)
{
strmov(to,filename);
}
else
{
if (MyFlags & MY_WME)
my_error(EE_CANT_READLINK, MYF(0), filename, errno);
result= -1;
}
}
else
to[length]=0;
DBUG_RETURN(result);
#endif /* HAVE_READLINK */
}
/* Create a symbolic link */
int my_symlink(const char *content, const char *linkname, myf MyFlags)
{
#ifndef HAVE_READLINK
return 0;
#else
int result;
DBUG_ENTER("my_symlink");
result= 0;
if (symlink(content, linkname))
{
result= -1;
my_errno=errno;
if (MyFlags & MY_WME)
my_error(EE_CANT_SYMLINK, MYF(0), linkname, content, errno);
}
DBUG_RETURN(result);
#endif /* HAVE_READLINK */
}
/*
Create a file and a symbolic link that points to this file
If linkname is a null pointer or equal to filename, we don't
create a link.
*/
File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags, myf MyFlags)
{
File file;
int tmp_errno;
DBUG_ENTER("my_create_with_symlink");
if ((file=my_create(filename, createflags, access_flags, MyFlags)) >= 0)
{
/* Test if we should create a link */
if (linkname && strcmp(linkname,filename))
{
/* Delete old link/file */
if (MyFlags & MY_DELETE_OLD)
my_delete(linkname, MYF(0));
/* Create link */
if (my_symlink(filename, linkname, MyFlags))
{
/* Fail, remove everything we have done */
tmp_errno=my_errno;
my_close(file,MYF(0));
my_delete(filename, MYF(0));
file= -1;
my_errno=tmp_errno;
}
}
}
DBUG_RETURN(file);
}
/*
Resolve all symbolic links in path
'to' may be equal to 'filename'
Because purify gives a lot of UMR errors when using realpath(),
this code is disabled when using purify.
If MY_RESOLVE_LINK is given, only do realpath if the file is a link.
*/
#if defined(SCO)
#define BUFF_LEN 4097
#elif defined(MAXPATHLEN)
#define BUFF_LEN MAXPATHLEN
#else
#define BUFF_LEN FN_LEN
#endif
int my_realpath(char *to, const char *filename, myf MyFlags)
{
#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)
int result=0;
char buff[BUFF_LEN];
struct stat stat_buff;
DBUG_ENTER("my_realpath");
if (!(MyFlags & MY_RESOLVE_LINK) ||
(!lstat(filename,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
{
char *ptr;
if ((ptr=realpath(filename,buff)))
strmake(to,ptr,FN_REFLEN-1);
else
{
/* Realpath didn't work; Use original name */
my_errno=errno;
if (MyFlags & MY_WME)
my_error(EE_REALPATH, MYF(0), filename, my_errno);
if (to != filename)
strmov(to,filename);
result= -1;
}
}
return result;
#else
if (to != filename)
strmov(to,filename);
return 0;
#endif
}
...@@ -45,7 +45,7 @@ EOF ...@@ -45,7 +45,7 @@ EOF
exit 1 exit 1
} }
if ! test $# -gt 0; then usage; fi if test $# -le 0; then usage; fi
while test $# -gt 0; do while test $# -gt 0; do
case $1 in case $1 in
......
...@@ -114,7 +114,7 @@ fi ...@@ -114,7 +114,7 @@ fi
pid_file= pid_file=
err_log= err_log=
# Get first arguments from the my.cfg file, groups [mysqld] and [safe_mysqld] # Get first arguments from the my.cnf file, groups [mysqld] and [safe_mysqld]
# and then merge with the command line arguments # and then merge with the command line arguments
if test -x ./bin/my_print_defaults if test -x ./bin/my_print_defaults
then then
......
...@@ -4087,6 +4087,59 @@ const char *Field_blob::unpack(char *to, const char *from) ...@@ -4087,6 +4087,59 @@ const char *Field_blob::unpack(char *to, const char *from)
} }
#ifdef HAVE_GEMINI_DB
/* Blobs in Gemini tables are stored separately from the rows which contain
** them (except for tiny blobs, which are stored in the row). For all other
** blob types (blob, mediumblob, longblob), the row contains the length of
** the blob data and a blob id. These methods (pack_id, get_id, and
** unpack_id) handle packing and unpacking blob fields in Gemini rows.
*/
char *Field_blob::pack_id(char *to, const char *from, ulonglong id, uint max_length)
{
char *save=ptr;
ptr=(char*) from;
ulong length=get_length(); // Length of from string
if (length > max_length)
{
ptr=to;
length=max_length;
store_length(length); // Store max length
ptr=(char*) from;
}
else
memcpy(to,from,packlength); // Copy length
if (length)
{
int8store(to+packlength, id);
}
ptr=save; // Restore org row pointer
return to+packlength+sizeof(id);
}
ulonglong Field_blob::get_id(const char *from)
{
ulonglong id = 0;
ulong length=get_length(from);
if (length)
longlongget(id, from+packlength);
return id;
}
const char *Field_blob::unpack_id(char *to, const char *from, const char *bdata)
{
memcpy(to,from,packlength);
ulong length=get_length(from);
from+=packlength;
if (length)
memcpy_fixed(to+packlength, &bdata, sizeof(bdata));
else
bzero(to+packlength,sizeof(bdata));
return from+sizeof(ulonglong);
}
#endif /* HAVE_GEMINI_DB */
/* Keys for blobs are like keys on varchars */ /* Keys for blobs are like keys on varchars */
int Field_blob::pack_cmp(const char *a, const char *b, uint key_length) int Field_blob::pack_cmp(const char *a, const char *b, uint key_length)
......
...@@ -869,6 +869,13 @@ public: ...@@ -869,6 +869,13 @@ public:
} }
char *pack(char *to, const char *from, uint max_length= ~(uint) 0); char *pack(char *to, const char *from, uint max_length= ~(uint) 0);
const char *unpack(char *to, const char *from); const char *unpack(char *to, const char *from);
#ifdef HAVE_GEMINI_DB
char *pack_id(char *to, const char *from, ulonglong id,
uint max_length= ~(uint) 0);
ulonglong get_id(const char *from);
const char *unpack_id(char *to, const char *from, const char *bdata);
enum_field_types blobtype() { return (packlength == 1 ? FIELD_TYPE_TINY_BLOB : FIELD_TYPE_BLOB);}
#endif
char *pack_key(char *to, const char *from, uint max_length); char *pack_key(char *to, const char *from, uint max_length);
char *pack_key_from_key_image(char* to, const char *from, uint max_length); char *pack_key_from_key_image(char* to, const char *from, uint max_length);
int pack_cmp(const char *a, const char *b, uint key_length); int pack_cmp(const char *a, const char *b, uint key_length);
......
This diff is collapsed.
...@@ -19,17 +19,26 @@ ...@@ -19,17 +19,26 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#include "gem_global.h"
#include "dstd.h" #include "dstd.h"
#include "dsmpub.h" #include "dsmpub.h"
/* class for the the gemini handler */ /* class for the the gemini handler */
enum enum_key_string_options{KEY_CREATE,KEY_DELETE,KEY_CHECK}; enum enum_key_string_options{KEY_CREATE,KEY_DELETE,KEY_CHECK};
typedef struct st_gemini_share {
#define READ_UNCOMMITED 0 ha_rows *rec_per_key;
#define READ_COMMITED 1 THR_LOCK lock;
#define REPEATABLE_READ 2 pthread_mutex_t mutex;
#define SERIALIZEABLE 3 char *table_name;
uint table_name_length,use_count;
} GEM_SHARE;
typedef struct gemBlobDesc
{
dsmBlobId_t blobId;
dsmBuffer_t *pBlob;
} gemBlobDesc_t;
class ha_gemini: public handler class ha_gemini: public handler
{ {
...@@ -38,7 +47,7 @@ class ha_gemini: public handler ...@@ -38,7 +47,7 @@ class ha_gemini: public handler
uint int_option_flag; uint int_option_flag;
int tableNumber; int tableNumber;
dsmIndex_t *pindexNumbers; // dsm object numbers for the indexes on this table dsmIndex_t *pindexNumbers; // dsm object numbers for the indexes on this table
unsigned long lastRowid; dsmRecid_t lastRowid;
uint last_dup_key; uint last_dup_key;
bool fixed_length_row, key_read, using_ignore; bool fixed_length_row, key_read, using_ignore;
byte *rec_buff; byte *rec_buff;
...@@ -46,10 +55,12 @@ class ha_gemini: public handler ...@@ -46,10 +55,12 @@ class ha_gemini: public handler
dsmKey_t *pbracketLimit; dsmKey_t *pbracketLimit;
dsmKey_t *pfoundKey; dsmKey_t *pfoundKey;
dsmMask_t tableStatus; // Crashed/repair status dsmMask_t tableStatus; // Crashed/repair status
gemBlobDesc_t *pBlobDescs;
int index_open(char *tableName); int index_open(char *tableName);
int pack_row(byte **prow, int *ppackedLength, const byte *record); int pack_row(byte **prow, int *ppackedLength, const byte *record,
void unpack_row(char *record, char *prow); bool update);
int unpack_row(char *record, char *prow);
int findRow(THD *thd, dsmMask_t findMode, byte *buf); int findRow(THD *thd, dsmMask_t findMode, byte *buf);
int fetch_row(void *gemini_context, const byte *buf); int fetch_row(void *gemini_context, const byte *buf);
int handleIndexEntries(const byte * record, dsmRecid_t recid, int handleIndexEntries(const byte * record, dsmRecid_t recid,
...@@ -70,24 +81,28 @@ class ha_gemini: public handler ...@@ -70,24 +81,28 @@ class ha_gemini: public handler
void unpack_key(char *record, dsmKey_t *key, uint index); void unpack_key(char *record, dsmKey_t *key, uint index);
int key_cmp(uint keynr, const byte * old_row, int key_cmp(uint keynr, const byte * old_row,
const byte * new_row); const byte * new_row, bool updateStats);
int saveKeyStats(THD *thd);
void get_index_stats(THD *thd);
short cursorId; /* cursorId of active index cursor if any */ short cursorId; /* cursorId of active index cursor if any */
dsmMask_t lockMode; /* Shared or exclusive */ dsmMask_t lockMode; /* Shared or exclusive */
/* FIXFIX Don't know why we need this because I don't know what /* FIXFIX Don't know why we need this because I don't know what
store_lock method does but we core dump without this */ store_lock method does but we core dump without this */
THR_LOCK alock;
THR_LOCK_DATA lock; THR_LOCK_DATA lock;
GEM_SHARE *share;
public: public:
ha_gemini(TABLE *table): handler(table), file(0), ha_gemini(TABLE *table): handler(table), file(0),
int_option_flag(HA_READ_NEXT | HA_READ_PREV | int_option_flag(HA_READ_NEXT | HA_READ_PREV |
HA_REC_NOT_IN_SEQ | HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER | HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_HAVE_KEY_READ_ONLY | HA_LONGLONG_KEYS | HA_NULL_KEY | HA_HAVE_KEY_READ_ONLY |
HA_NO_BLOBS | HA_NO_TEMP_TABLES | HA_BLOB_KEY |
/* HA_BLOB_KEY | */ /*HA_NOT_EXACT_COUNT | */ HA_NO_TEMP_TABLES | HA_NO_FULLTEXT_KEY |
/*HA_NOT_EXACT_COUNT | */
/*HA_KEY_READ_WRONG_STR |*/ HA_DROP_BEFORE_CREATE), /*HA_KEY_READ_WRONG_STR |*/ HA_DROP_BEFORE_CREATE),
pbracketBase(0),pbracketLimit(0),pfoundKey(0), pbracketBase(0),pbracketLimit(0),pfoundKey(0),
cursorId(0) cursorId(0)
...@@ -100,7 +115,7 @@ class ha_gemini: public handler ...@@ -100,7 +115,7 @@ class ha_gemini: public handler
uint max_record_length() const { return MAXRECSZ; } uint max_record_length() const { return MAXRECSZ; }
uint max_keys() const { return MAX_KEY-1; } uint max_keys() const { return MAX_KEY-1; }
uint max_key_parts() const { return MAX_REF_PARTS; } uint max_key_parts() const { return MAX_REF_PARTS; }
uint max_key_length() const { return MAXKEYSZ; } uint max_key_length() const { return MAXKEYSZ / 2; }
bool fast_key_read() { return 1;} bool fast_key_read() { return 1;}
bool has_transactions() { return 1;} bool has_transactions() { return 1;}
...@@ -129,8 +144,12 @@ class ha_gemini: public handler ...@@ -129,8 +144,12 @@ class ha_gemini: public handler
void info(uint); void info(uint);
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
int reset(void); int reset(void);
int analyze(THD* thd, HA_CHECK_OPT* check_opt);
int check(THD* thd, HA_CHECK_OPT* check_opt); int check(THD* thd, HA_CHECK_OPT* check_opt);
int repair(THD* thd, HA_CHECK_OPT* check_opt); int repair(THD* thd, HA_CHECK_OPT* check_opt);
int restore(THD* thd, HA_CHECK_OPT* check_opt);
int backup(THD* thd, HA_CHECK_OPT* check_opt);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int external_lock(THD *thd, int lock_type); int external_lock(THD *thd, int lock_type);
virtual longlong get_auto_increment(); virtual longlong get_auto_increment();
void position(byte *record); void position(byte *record);
...@@ -139,7 +158,7 @@ class ha_gemini: public handler ...@@ -139,7 +158,7 @@ class ha_gemini: public handler
enum ha_rkey_function start_search_flag, enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len, const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag); enum ha_rkey_function end_search_flag);
void update_create_info(HA_CREATE_INFO *create_info);
int create(const char *name, register TABLE *form, int create(const char *name, register TABLE *form,
HA_CREATE_INFO *create_info); HA_CREATE_INFO *create_info);
int delete_table(const char *name); int delete_table(const char *name);
...@@ -167,6 +186,7 @@ extern long gemini_locktablesize; ...@@ -167,6 +186,7 @@ extern long gemini_locktablesize;
extern long gemini_lock_wait_timeout; extern long gemini_lock_wait_timeout;
extern long gemini_spin_retries; extern long gemini_spin_retries;
extern long gemini_connection_limit; extern long gemini_connection_limit;
extern char *gemini_basedir;
extern TYPELIB gemini_recovery_typelib; extern TYPELIB gemini_recovery_typelib;
extern ulong gemini_recovery_options; extern ulong gemini_recovery_options;
...@@ -175,12 +195,13 @@ bool gemini_end(void); ...@@ -175,12 +195,13 @@ bool gemini_end(void);
bool gemini_flush_logs(void); bool gemini_flush_logs(void);
int gemini_commit(THD *thd); int gemini_commit(THD *thd);
int gemini_rollback(THD *thd); int gemini_rollback(THD *thd);
int gemini_recovery_logging(THD *thd, bool on);
void gemini_disconnect(THD *thd); void gemini_disconnect(THD *thd);
int gemini_rollback_to_savepoint(THD *thd); int gemini_rollback_to_savepoint(THD *thd);
int gemini_parse_table_name(const char *fullname, char *dbname, char *tabname); int gemini_parse_table_name(const char *fullname, char *dbname, char *tabname);
int gemini_is_vst(const char *pname); int gemini_is_vst(const char *pname);
int gemini_set_option_long(int optid, long optval); int gemini_set_option_long(int optid, long optval);
const int gemini_blocksize = 8192; const int gemini_blocksize = BLKSIZE;
const int gemini_recbits = 7; const int gemini_recbits = DEFAULT_RECBITS;
...@@ -694,6 +694,15 @@ void handler::print_error(int error, myf errflag) ...@@ -694,6 +694,15 @@ void handler::print_error(int error, myf errflag)
case HA_ERR_RECORD_FILE_FULL: case HA_ERR_RECORD_FILE_FULL:
textno=ER_RECORD_FILE_FULL; textno=ER_RECORD_FILE_FULL;
break; break;
case HA_ERR_LOCK_WAIT_TIMEOUT:
textno=ER_LOCK_WAIT_TIMEOUT;
break;
case HA_ERR_LOCK_TABLE_FULL:
textno=ER_LOCK_TABLE_FULL;
break;
case HA_ERR_READ_ONLY_TRANSACTION:
textno=ER_READ_ONLY_TRANSACTION;
break;
default: default:
{ {
my_error(ER_GET_ERRNO,errflag,error); my_error(ER_GET_ERRNO,errflag,error);
...@@ -757,6 +766,25 @@ int ha_commit_rename(THD *thd) ...@@ -757,6 +766,25 @@ int ha_commit_rename(THD *thd)
return error; return error;
} }
/* Tell the handler to turn on or off logging to the handler's
recovery log
*/
int ha_recovery_logging(THD *thd, bool on)
{
int error=0;
DBUG_ENTER("ha_recovery_logging");
#ifdef USING_TRANSACTIONS
if (opt_using_transactions)
{
#ifdef HAVE_GEMINI_DB
error = gemini_recovery_logging(thd, on);
#endif
}
#endif
DBUG_RETURN(error);
}
int handler::index_next_same(byte *buf, const byte *key, uint keylen) int handler::index_next_same(byte *buf, const byte *key, uint keylen)
{ {
int error; int error;
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2) #define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2)
#define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2) #define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2)
#define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2) #define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2)
#define HA_NO_FULLTEXT_KEY (HA_NO_PREFIX_CHAR_KEYS*2)
/* Parameters for open() (in register form->filestat) */ /* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */ /* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */
...@@ -353,3 +354,4 @@ int ha_autocommit_or_rollback(THD *thd, int error); ...@@ -353,3 +354,4 @@ int ha_autocommit_or_rollback(THD *thd, int error);
void ha_set_spin_retries(uint retries); void ha_set_spin_retries(uint retries);
bool ha_flush_logs(void); bool ha_flush_logs(void);
int ha_commit_rename(THD *thd); int ha_commit_rename(THD *thd);
int ha_recovery_logging(THD *thd, bool on);
...@@ -487,7 +487,7 @@ Item_func_if::fix_length_and_dec() ...@@ -487,7 +487,7 @@ Item_func_if::fix_length_and_dec()
{ {
maybe_null=args[1]->maybe_null || args[2]->maybe_null; maybe_null=args[1]->maybe_null || args[2]->maybe_null;
max_length=max(args[1]->max_length,args[2]->max_length); max_length=max(args[1]->max_length,args[2]->max_length);
decimals=max(args[0]->decimals,args[1]->decimals); decimals=max(args[1]->decimals,args[2]->decimals);
enum Item_result arg1_type=args[1]->result_type(); enum Item_result arg1_type=args[1]->result_type();
enum Item_result arg2_type=args[2]->result_type(); enum Item_result arg2_type=args[2]->result_type();
if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT) if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
......
...@@ -35,6 +35,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count, ...@@ -35,6 +35,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count,
bool unlock, TABLE **write_locked); bool unlock, TABLE **write_locked);
static int lock_external(TABLE **table,uint count); static int lock_external(TABLE **table,uint count);
static int unlock_external(THD *thd, TABLE **table,uint count); static int unlock_external(THD *thd, TABLE **table,uint count);
static void print_lock_error(int error);
MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count) MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
...@@ -154,7 +155,7 @@ static int lock_external(TABLE **tables,uint count) ...@@ -154,7 +155,7 @@ static int lock_external(TABLE **tables,uint count)
(*tables)->file->external_lock(thd, F_UNLCK); (*tables)->file->external_lock(thd, F_UNLCK);
(*tables)->current_lock=F_UNLCK; (*tables)->current_lock=F_UNLCK;
} }
my_error(ER_CANT_LOCK,MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG),error); print_lock_error(error);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
else else
...@@ -325,7 +326,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count) ...@@ -325,7 +326,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
} }
} }
if (error_code) if (error_code)
my_error(ER_CANT_LOCK,MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG),error_code); print_lock_error(error_code);
DBUG_RETURN(error_code); DBUG_RETURN(error_code);
} }
...@@ -480,3 +481,24 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list) ...@@ -480,3 +481,24 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
} }
DBUG_RETURN(result); DBUG_RETURN(result);
} }
static void print_lock_error(int error)
{
int textno;
DBUG_ENTER("print_lock_error");
switch (error) {
case HA_ERR_LOCK_WAIT_TIMEOUT:
textno=ER_LOCK_WAIT_TIMEOUT;
break;
case HA_ERR_READ_ONLY_TRANSACTION:
textno=ER_READ_ONLY_TRANSACTION;
break;
default:
textno=ER_CANT_LOCK;
break;
}
my_error(textno,MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG),error);
DBUG_VOID_RETURN;
}
...@@ -303,14 +303,12 @@ static void dump_remote_log_entries(const char* logname) ...@@ -303,14 +303,12 @@ static void dump_remote_log_entries(const char* logname)
uint len; uint len;
NET* net = &mysql->net; NET* net = &mysql->net;
if(!position) position = 4; // protect the innocent from spam if(!position) position = 4; // protect the innocent from spam
if(position < 4) if (position < 4)
{ {
position = 4; position = 4;
// warn the guity // warn the guity
fprintf(stderr, sql_print_error("Warning: The position in the binary log can't be less than 4.\nStarting from position 4\n");
"Warning: with the position so small you would hit the magic number\n\ }
Unfortunately, no sweepstakes today, adjusted position to 4\n");
}
int4store(buf, position); int4store(buf, position);
int2store(buf + 4, binlog_flags); int2store(buf + 4, binlog_flags);
len = (uint) strlen(logname); len = (uint) strlen(logname);
......
...@@ -3079,8 +3079,12 @@ static void usage(void) ...@@ -3079,8 +3079,12 @@ static void usage(void)
--console Don't remove the console window\n\ --console Don't remove the console window\n\
--install Install mysqld as a service (NT)\n\ --install Install mysqld as a service (NT)\n\
--remove Remove mysqld from the service list (NT)\n\ --remove Remove mysqld from the service list (NT)\n\
--standalone Dummy option to start as a standalone program (NT)\n\ --standalone Dummy option to start as a standalone program (NT)\
"); ");
#ifdef USE_SYMDIR
puts("--use-symbolic-links Enable symbolic link support");
#endif
puts("");
#endif #endif
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
puts("\ puts("\
......
...@@ -215,3 +215,6 @@ ...@@ -215,3 +215,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -209,3 +209,6 @@ ...@@ -209,3 +209,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -206,3 +206,6 @@ ...@@ -206,3 +206,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -206,8 +206,8 @@ ...@@ -206,8 +206,8 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"Error connecting to master: %-.128s", "Error connecting to master: %-.128s",
"Error running query on master: %-.128s", "Error running query on master: %-.128s",
...@@ -210,3 +210,6 @@ ...@@ -210,3 +210,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -206,3 +206,6 @@ ...@@ -206,3 +206,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -209,3 +209,6 @@ ...@@ -209,3 +209,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -206,3 +206,6 @@ ...@@ -206,3 +206,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -208,3 +208,6 @@ ...@@ -208,3 +208,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -206,3 +206,6 @@ ...@@ -206,3 +206,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -208,3 +208,6 @@ ...@@ -208,3 +208,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -206,3 +206,6 @@ ...@@ -206,3 +206,6 @@
"Could not create slave thread, check system resources", "Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections", "User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET", "You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment