diff options
183 files changed, 2192 insertions, 570 deletions
diff --git a/.bzrignore b/.bzrignore index 31e06858b84..9542cfe8754 100644 --- a/.bzrignore +++ b/.bzrignore @@ -907,3 +907,4 @@ ndb/test/tools/hugoScanUpdate ndb/test/tools/ndb_cpcc ndb/test/tools/restart ndb/test/tools/verify_index +EXCEPTIONS-CLIENT diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index e4648f7d849..b48e861f6df 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -95,6 +95,7 @@ miguel@hegel.(none) miguel@hegel.br miguel@hegel.local miguel@hegel.txg +miguel@hegel.txg.br miguel@light. miguel@light.local miguel@sartre.local diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index fa3c6344a05..c1063363bdf 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -28,8 +28,8 @@ else # Some predefined settings $build_command= "BUILD/compile-pentium-max"; $PWD= cwd(); -$LOGFILE= $PWD . "/Bootstrap.log"; $opt_docdir= $PWD . "/mysqldoc"; +$opt_archive_log= undef; $opt_build_command= undef; $opt_changelog= undef; $opt_delete= undef; @@ -51,6 +51,7 @@ $version= "unknown"; $major=$minor=$release=0; GetOptions( + "archive-log|a", "build-command|b=s", "changelog|c:s", "directory|d=s", @@ -73,6 +74,17 @@ GetOptions( ) || print_help(""); # +# Override predefined build command +# +if (defined $opt_build_command) +{ + $build_command= $opt_build_command; +} + +print_help("") if ($opt_help); +defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!"); + +# # Override predefined Log file name # if (defined $opt_log) @@ -90,16 +102,7 @@ if (defined $opt_log) } } -# -# Override predefined build command -# -if (defined $opt_build_command) -{ - $build_command= $opt_build_command; -} - -print_help("") if ($opt_help); -defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!"); +$LOGFILE= $PWD . "/Bootstrap-" . $REPO . ".log" unless ($LOGFILE); &logger("Starting build"); &abort("The directory \"$REPO\" could not be found!") if (!-d $REPO); @@ -351,6 +354,21 @@ if (!$opt_skip_check) # All done when we came down here # &logger("SUCCESS: Build finished successfully.") if (!$opt_dry_run); + +# +# Move the log file into the Log dir of the target dir +# +if ($opt_archive_log) +{ + my $logdir= $target_dir . "/Logs"; + &logger("Moving $LOGFILE to $logdir"); + mkdir "$logdir" if (! -d $logdir); + $command= "mv "; + $command.= "-v " if ($opt_verbose || defined $opt_log); + $command.= "$LOGFILE $logdir"; + &run_command($command, "Could not move $LOGFILE to $logdir!"); +} + exit 0; # @@ -378,6 +396,8 @@ distribution check can be run before the source archive is being created. Options: +-a, --archive-log Move the log file into the Logs directory of + the exported tree after a successful build -b, --build-command=<cmd> Use <cmd> to compile the sources before packing the distribution. (default is "$build_command") @@ -398,7 +418,7 @@ Options: do not build or test the source distribution -h, --help Print this help message -l, --log[=<filename>] Write a log file [to <filename>] - (default is "$LOGFILE") + (default is "./Bootstrap-<bk repository>.log") -m, --mail=<address> Mail a failure report to the given address (and include a log file snippet, if logging is enabled) Note that the \@-Sign needs to be quoted! diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index e1ee513e06d..16f0738dc76 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -101,6 +101,7 @@ sub main # on the toplevel of the directory instead. file 'PUBLIC' shouldn't # exist in the new mysql distributions, but let's be sure.. unlink("$destdir/PUBLIC", "$destdir/README"); + unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT"); copy("$WD/Docs/MySQLEULA.txt", "$destdir"); # remove readline, bdb subdirs and update 'configure' diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 19b2efd4cab..491302a082a 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -26,7 +26,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \ all: $(targets) txt_files -txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE \ +txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \ INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt CLEAN_FILES: $(BUILD_SOURCES) @@ -204,7 +204,10 @@ INSTALL-BINARY: mysql.info $(GT) perl -w $(GT) mysql.info "Installing binary" "Installing source" > $@ ../COPYING: mysql.info $(GT) - perl -w $(GT) mysql.info "GPL license" "Function Index" > $@ + perl -w $(GT) mysql.info "GPL license" "MySQL FLOSS License Exception" > $@ + +../EXCEPTIONS-CLIENT: mysql.info $(GT) + perl -w $(GT) mysql.info "MySQL FLOSS License Exception" "Function Index" > $@ ../support-files/MacOSX/ReadMe.txt: mysql.info $(GT) perl -w $(GT) mysql.info "Mac OS X installation" "NetWare installation" > $@ diff --git a/Makefile.am b/Makefile.am index e2d61e56b60..7c2ed820a23 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,7 @@ AUTOMAKE_OPTIONS = foreign # These are built from source in the Docs directory -EXTRA_DIST = INSTALL-SOURCE README COPYING +EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack @sql_client_dirs@ \ diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index 7c599113b6e..9bcdb4be24f 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -187,7 +187,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D LICENSE=Commercial /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "HAVE_DLOPEN" /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D LICENSE=Commercial /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "HAVE_DLOPEN" /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /D MYSQL_SERVER_SUFFIX=-classic /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -243,7 +243,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D LICENSE=Commercial /D MYSQL_SERVER_SUFFIX=-nt /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /D LICENSE=Commercial /D MYSQL_SERVER_SUFFIX=-classic-nt /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" diff --git a/VC++Files/winmysqladmin/mysql_com.h b/VC++Files/winmysqladmin/mysql_com.h index 0870f340451..2a7eb57d745 100644 --- a/VC++Files/winmysqladmin/mysql_com.h +++ b/VC++Files/winmysqladmin/mysql_com.h @@ -155,25 +155,32 @@ enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY, #define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */ #define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */ -enum enum_shutdown_level { - /* - We want levels to be in growing order of hardness. So we leave room - for future intermediate levels. For now, escalating one level is += 10; - later if we insert new levels in between we will need a function - next_shutdown_level(level). Note that DEFAULT does not respect the - growing property. - */ - SHUTDOWN_DEFAULT= 0, /* mapped to WAIT_ALL_BUFFERS for now */ + +/* Shutdown/kill enums and constants */ + +/* Bits for THD::killable. */ +#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) +#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) +#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) +#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) + +enum mysql_enum_shutdown_level { /* - Here is the list in growing order (the next does the previous plus - something). WAIT_ALL_BUFFERS is what we have now. Others are "this MySQL - server does not support this shutdown level yet". + We want levels to be in growing order of hardness (because we use number + comparisons). Note that DEFAULT does not respect the growing property, but + it's ok. */ - SHUTDOWN_WAIT_CONNECTIONS= 10, /* wait for existing connections to finish */ - SHUTDOWN_WAIT_TRANSACTIONS= 20, /* wait for existing trans to finish */ - SHUTDOWN_WAIT_STATEMENTS= 30, /* wait for existing updating stmts to finish */ - SHUTDOWN_WAIT_ALL_BUFFERS= 40, /* flush InnoDB buffers */ - SHUTDOWN_WAIT_CRITICAL_BUFFERS= 50, /* flush MyISAM buffs (no corruption) */ + DEFAULT= 0, + /* wait for existing connections to finish */ + WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, + /* wait for existing trans to finish */ + WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, + /* wait for existing updates to finish (=> no partial MyISAM update) */ + WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, + /* flush InnoDB buffers and other storage engines' buffers*/ + WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), + /* don't flush InnoDB buffers, flush other storage engines' buffers*/ + WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, /* Now the 2 levels of the KILL command */ #if MYSQL_VERSION_ID >= 50000 KILL_QUERY= 254, diff --git a/client/mysql.cc b/client/mysql.cc index c9ee6819a13..015c168cea7 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2836,13 +2836,16 @@ com_status(String *buffer __attribute__((unused)), MYSQL_RES *result; LINT_INIT(result); tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql)); - if (!mysql_query(&mysql,"select DATABASE(),USER()") && + if (!mysql_query(&mysql,"select DATABASE(), USER() limit 1") && (result=mysql_use_result(&mysql))) { MYSQL_ROW cur=mysql_fetch_row(result); - tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : ""); - tee_fprintf(stdout, "Current user:\t\t%s\n",cur[1]); - (void) mysql_fetch_row(result); // Read eof + if (cur) + { + tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : ""); + tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]); + } + mysql_free_result(result); } #ifdef HAVE_OPENSSL if (mysql.net.vio && mysql.net.vio->ssl_arg && diff --git a/configure.in b/configure.in index a0ca0d51660..664ffd2a4a1 100644 --- a/configure.in +++ b/configure.in @@ -969,6 +969,16 @@ esac MAX_C_OPTIMIZE="-O3" MAX_CXX_OPTIMIZE="-O3" +# workaround for Sun Forte/x86 see BUG#4681 +case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in + *solaris*-i?86-no) + CFLAGS="$CFLAGS -DBIG_FILES" + CXXFLAGS="$CXXFLAGS -DBIG_FILES" + ;; + *) ;; +esac + + case $SYSTEM_TYPE in *solaris2.7*) # Solaris 2.7 has a broken /usr/include/widec.h @@ -1072,10 +1082,11 @@ case $SYSTEM_TYPE in MAX_C_OPTIMIZE="-O" fi ;; - *darwin7*) + *darwin[[7-8]]*) + # don't forget to escape [] like above if test "$ac_cv_prog_gcc" = "yes" then - FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" + FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT" CFLAGS="$CFLAGS $FLAGS" CXXFLAGS="$CXXFLAGS $FLAGS" MAX_C_OPTIMIZE="-O" @@ -1319,6 +1330,7 @@ then with_named_thread="-lgthreads -lsocket -lgthreads" # sched.h conflicts with fsu-threads touch ./include/sched.h + touch ./include/semaphore.h # We must have gcc if expr "$CC" : ".*gcc.*" diff --git a/extra/perror.c b/extra/perror.c index f1b1a4c2005..a28626fd873 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -42,7 +42,7 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_NDBCLUSTER_DB {"ndb", 0, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code, - (gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + (gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif #ifdef HAVE_SYS_ERRLIST {"all", 'a', "Print all the error messages and the number.", @@ -222,7 +222,7 @@ int main(int argc,char *argv[]) #ifdef HAVE_NDBCLUSTER_DB if (ndb_code) { - if (ndb_error_string(code, ndb_string, 1024) < 0) + if (ndb_error_string(code, ndb_string, sizeof(ndb_string)) < 0) msg= 0; else msg= ndb_string; diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 2014b2b0adc..8feae19a480 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -245,7 +245,15 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { - seg->charset->coll->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,&nr2); + CHARSET_INFO *cs= seg->charset; + uint length= ((uchar*)key) - pos; + uint char_length= length / cs->mbmaxlen; + if (length > char_length) + { + char_length= my_charpos(cs, pos, pos + length, char_length); + set_if_smaller(char_length, length); + } + cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2); } else { @@ -280,7 +288,14 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) } if (seg->type == HA_KEYTYPE_TEXT) { - seg->charset->coll->hash_sort(seg->charset,pos,end-pos,&nr,&nr2); + CHARSET_INFO *cs= seg->charset; + uint char_length= seg->length / cs->mbmaxlen; + if (seg->length > char_length) + { + char_length= my_charpos(cs, pos, pos + seg->length, char_length); + set_if_smaller(char_length, seg->length); + } + cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2); } else { @@ -401,9 +416,26 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) } if (seg->type == HA_KEYTYPE_TEXT) { + CHARSET_INFO *cs= seg->charset; + uint char_length= seg->length / cs->mbmaxlen; + uint char_length1; + uint char_length2; + uchar *pos1= (uchar*)rec1 + seg->start; + uchar *pos2= (uchar*)rec2 + seg->start; + if (seg->length > char_length) + { + char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length); + set_if_smaller(char_length1, seg->length); + char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length); + set_if_smaller(char_length2, seg->length); + } + else + { + char_length1= char_length2= seg->length; + } if (seg->charset->coll->strnncollsp(seg->charset, - (uchar*) rec1+seg->start,seg->length, - (uchar*) rec2+seg->start,seg->length)) + pos1,char_length1, + pos2,char_length2)) return 1; } else @@ -435,9 +467,27 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { + CHARSET_INFO *cs= seg->charset; + uint char_length= seg->length / cs->mbmaxlen; + uint char_length_key; + uint char_length_rec; + uchar *pos= (uchar*) rec + seg->start; + if (seg->length > char_length) + { + char_length_key= my_charpos(cs, key, key + seg->length, char_length); + set_if_smaller(char_length_key, seg->length); + char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length); + set_if_smaller(char_length_rec, seg->length); + } + else + { + char_length_key= seg->length; + char_length_rec= seg->length; + } + if (seg->charset->coll->strnncollsp(seg->charset, - (uchar*) rec+seg->start, seg->length, - (uchar*) key, seg->length)) + (uchar*) pos, char_length_rec, + (uchar*) key, char_length_key)) return 1; } else @@ -458,10 +508,19 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) { + CHARSET_INFO *cs= seg->charset; + uint char_length= (cs && cs->mbmaxlen > 1) ? seg->length / cs->mbmaxlen : + seg->length; + uchar *pos= (uchar*) rec + seg->start; if (seg->null_bit) *key++= test(rec[seg->null_pos] & seg->null_bit); - memcpy(key,rec+seg->start,(size_t) seg->length); - key+=seg->length; + if (seg->length > char_length) + { + char_length= my_charpos(cs, pos, pos + seg->length, char_length); + set_if_smaller(char_length, seg->length); + } + memcpy(key,rec+seg->start,(size_t) char_length); + key+= char_length; } } @@ -473,6 +532,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++) { + uint char_length; if (seg->null_bit) { if (!(*key++= 1 - test(rec[seg->null_pos] & seg->null_bit))) @@ -515,7 +575,18 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, } continue; } - memcpy(key, rec + seg->start, (size_t) seg->length); + char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1); + if (seg->length > char_length) + { + char_length= my_charpos(seg->charset, + rec + seg->start, rec + seg->start + seg->length, + char_length); + set_if_smaller(char_length, seg->length); + if (char_length < seg->length) + seg->charset->cset->fill(seg->charset, key + char_length, + seg->length - char_length, ' '); + } + memcpy(key, rec + seg->start, (size_t) char_length); key+= seg->length; } memcpy(key, &recpos, sizeof(byte*)); @@ -530,6 +601,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len) for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg && (int) k_len > 0; old+= seg->length, seg++) { + uint char_length; if (seg->null_bit) { k_len--; @@ -551,7 +623,16 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len) } continue; } - memcpy((byte*) key, old, seg->length); + char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1); + if (seg->length > char_length) + { + char_length= my_charpos(seg->charset, old, old+seg->length, char_length); + set_if_smaller(char_length, seg->length); + if (char_length < seg->length) + seg->charset->cset->fill(seg->charset, key + char_length, + seg->length - char_length, ' '); + } + memcpy(key, old, (size_t) char_length); key+= seg->length; k_len-= seg->length; } diff --git a/include/my_global.h b/include/my_global.h index f7e77abfd26..a9ca5416c88 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -645,21 +645,27 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/ #if SIZEOF_LONG == 4 -#define INT_MIN32 (long) 0x80000000L -#define INT_MAX32 (long) 0x7FFFFFFFL -#define INT_MIN24 ((long) 0xff800000L) -#define INT_MAX24 0x007fffffL -#define INT_MIN16 ((short int) 0x8000) -#define INT_MAX16 0x7FFF -#define INT_MIN8 ((char) 0x80) -#define INT_MAX8 ((char) 0x7F) +#define INT_MIN32 ((long) 0x80000000L) +#define INT_MAX32 ((long) 0x7FFFFFFFL) +#define UINT_MAX32 ((long) 0xFFFFFFFFL) +#define INT_MIN24 ((long) 0xFF800000L) +#define INT_MAX24 0x007FFFFFL +#define UINT_MAX24 0x00FFFFFFL +#define INT_MIN16 ((short int) 0x8000) +#define INT_MAX16 0x7FFF +#define UINT_MAX16 0xFFFF +#define INT_MIN8 ((char) 0x80) +#define INT_MAX8 ((char) 0x7F) #else /* Probably Alpha */ #define INT_MIN32 ((long) (int) 0x80000000) #define INT_MAX32 ((long) (int) 0x7FFFFFFF) -#define INT_MIN24 ((long) (int) 0xff800000) -#define INT_MAX24 ((long) (int) 0x007fffff) -#define INT_MIN16 ((short int) 0xffff8000) +#define UINT_MAX32 ((long) (int) 0xFFFFFFFF) +#define INT_MIN24 ((long) (int) 0xFF800000) +#define INT_MAX24 ((long) (int) 0x007FFFFF) +#define UINT_MAX24 ((long) (int) 0x00FFFFFF) +#define INT_MIN16 ((short int) 0xFFFF8000) #define INT_MAX16 ((short int) 0x00007FFF) +#define UINT_MAX16 ((short int) 0x0000FFFF) #endif /* From limits.h instead */ diff --git a/include/mysql_com.h b/include/mysql_com.h index 47231ef31c6..36d41b2964a 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -223,25 +223,32 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, #define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM #define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY -enum enum_shutdown_level { - /* - We want levels to be in growing order of hardness. So we leave room - for future intermediate levels. For now, escalating one level is += 10; - later if we insert new levels in between we will need a function - next_shutdown_level(level). Note that DEFAULT does not respect the - growing property. - */ - SHUTDOWN_DEFAULT= 0, /* mapped to WAIT_ALL_BUFFERS for now */ + +/* Shutdown/kill enums and constants */ + +/* Bits for THD::killable. */ +#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) +#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) +#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) +#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) + +enum mysql_enum_shutdown_level { /* - Here is the list in growing order (the next does the previous plus - something). WAIT_ALL_BUFFERS is what we have now. Others are "this MySQL - server does not support this shutdown level yet". + We want levels to be in growing order of hardness (because we use number + comparisons). Note that DEFAULT does not respect the growing property, but + it's ok. */ - SHUTDOWN_WAIT_CONNECTIONS= 10, /* wait for existing connections to finish */ - SHUTDOWN_WAIT_TRANSACTIONS= 20, /* wait for existing trans to finish */ - SHUTDOWN_WAIT_STATEMENTS= 30, /* wait for existing updating stmts to finish */ - SHUTDOWN_WAIT_ALL_BUFFERS= 40, /* flush InnoDB buffers */ - SHUTDOWN_WAIT_CRITICAL_BUFFERS= 50, /* flush MyISAM buffs (no corruption) */ + DEFAULT= 0, + /* wait for existing connections to finish */ + WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, + /* wait for existing trans to finish */ + WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, + /* wait for existing updates to finish (=> no partial MyISAM update) */ + WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, + /* flush InnoDB buffers and other storage engines' buffers*/ + WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), + /* don't flush InnoDB buffers, flush other storage engines' buffers*/ + WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, /* Now the 2 levels of the KILL command */ #if MYSQL_VERSION_ID >= 50000 KILL_QUERY= 254, diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c index cad51c224e2..964c396dd08 100644 --- a/innobase/buf/buf0flu.c +++ b/innobase/buf/buf0flu.c @@ -217,7 +217,9 @@ buf_flush_buffered_writes(void) /*===========================*/ { buf_block_t* block; + byte* write_buf; ulint len; + ulint len2; ulint i; if (trx_doublewrite == NULL) { @@ -244,6 +246,16 @@ buf_flush_buffered_writes(void) block = trx_doublewrite->buf_block_arr[i]; ut_a(block->state == BUF_BLOCK_FILE_PAGE); + if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4) + != mach_read_from_4(block->frame + UNIV_PAGE_SIZE + - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: The page to be written seems corrupt!\n" +"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n" +"InnoDB: before posting to the doublewrite buffer.\n"); + } + if (block->check_index_page_at_flush && !page_simple_validate(block->frame)) { @@ -272,6 +284,19 @@ buf_flush_buffered_writes(void) trx_doublewrite->block1, 0, len, (void*)trx_doublewrite->write_buf, NULL); + write_buf = trx_doublewrite->write_buf; + + for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) { + if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4) + != mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE + - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: The page to be written seems corrupt!\n" +"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n"); + } + } + if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) { len = (trx_doublewrite->first_free - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE; @@ -282,6 +307,22 @@ buf_flush_buffered_writes(void) (void*)(trx_doublewrite->write_buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE), NULL); + + write_buf = trx_doublewrite->write_buf + + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE; + for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; + len2 += UNIV_PAGE_SIZE) { + if (mach_read_from_4(write_buf + len2 + + FIL_PAGE_LSN + 4) + != mach_read_from_4(write_buf + len2 + + UNIV_PAGE_SIZE + - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: The page to be written seems corrupt!\n" +"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n"); + } + } } /* Now flush the doublewrite buffer data to disk */ @@ -295,6 +336,18 @@ buf_flush_buffered_writes(void) for (i = 0; i < trx_doublewrite->first_free; i++) { block = trx_doublewrite->buf_block_arr[i]; + if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4) + != mach_read_from_4(block->frame + UNIV_PAGE_SIZE + - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: ERROR: The page to be written seems corrupt!\n" +"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n" +"InnoDB: after posting and flushing the doublewrite buffer.\n" +"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n", + (ulong)block->buf_fix_count, (ulong)block->io_fix, + (ulong)block->state); + } ut_a(block->state == BUF_BLOCK_FILE_PAGE); fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c index fd8e02585ae..1e4d906b7b5 100644 --- a/innobase/dict/dict0crea.c +++ b/innobase/dict/dict0crea.c @@ -32,6 +32,7 @@ static dtuple_t* dict_create_sys_tables_tuple( /*=========================*/ + /* out: the tuple which should be inserted */ dict_table_t* table, /* in: table */ mem_heap_t* heap) /* in: memory heap from which the memory for the built tuple is allocated */ diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 71cf908db4e..eeefd7bf1ae 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -682,6 +682,7 @@ dict_init(void) rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION); dict_foreign_err_file = os_file_create_tmpfile(); + ut_a(dict_foreign_err_file); mutex_create(&dict_foreign_err_mutex); mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH); } diff --git a/innobase/include/dyn0dyn.h b/innobase/include/dyn0dyn.h index 501fde05e90..abee62300e3 100644 --- a/innobase/include/dyn0dyn.h +++ b/innobase/include/dyn0dyn.h @@ -47,7 +47,8 @@ dyn_array_open( /*===========*/ /* out: pointer to the buffer */ dyn_array_t* arr, /* in: dynamic array */ - ulint size); /* in: size in bytes of the buffer */ + ulint size); /* in: size in bytes of the buffer; MUST be + smaller than DYN_ARRAY_DATA_SIZE! */ /************************************************************************* Closes the buffer returned by dyn_array_open. */ UNIV_INLINE diff --git a/innobase/include/mtr0log.h b/innobase/include/mtr0log.h index 41be168a371..9c9c6f696e8 100644 --- a/innobase/include/mtr0log.h +++ b/innobase/include/mtr0log.h @@ -111,7 +111,8 @@ mlog_open( /*======*/ /* out: buffer, NULL if log mode MTR_LOG_NONE */ mtr_t* mtr, /* in: mtr */ - ulint size); /* in: buffer size in bytes */ + ulint size); /* in: buffer size in bytes; MUST be + smaller than DYN_ARRAY_DATA_SIZE! */ /************************************************************ Closes a buffer opened to mlog. */ UNIV_INLINE diff --git a/innobase/include/mtr0log.ic b/innobase/include/mtr0log.ic index aa3f945c202..08d9a6448eb 100644 --- a/innobase/include/mtr0log.ic +++ b/innobase/include/mtr0log.ic @@ -18,7 +18,8 @@ mlog_open( /*======*/ /* out: buffer, NULL if log mode MTR_LOG_NONE */ mtr_t* mtr, /* in: mtr */ - ulint size) /* in: buffer size in bytes */ + ulint size) /* in: buffer size in bytes; MUST be + smaller than DYN_ARRAY_DATA_SIZE! */ { dyn_array_t* mlog; diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h index 6549a3748df..f1647c47bce 100644 --- a/innobase/include/os0file.h +++ b/innobase/include/os0file.h @@ -169,12 +169,12 @@ void os_io_init_simple(void); /*===================*/ /*************************************************************************** -Creates a temporary file. In case of error, causes abnormal termination. */ +Creates a temporary file. */ FILE* os_file_create_tmpfile(void); /*========================*/ - /* out: temporary file handle (never NULL) */ + /* out: temporary file handle (never NULL) */ /*************************************************************************** The os_file_opendir() function opens a directory stream corresponding to the directory named by the dirname argument. The directory stream is positioned diff --git a/innobase/include/page0page.ic b/innobase/include/page0page.ic index e7c0f8ee07c..3d2bf3b090e 100644 --- a/innobase/include/page0page.ic +++ b/innobase/include/page0page.ic @@ -479,7 +479,20 @@ page_rec_get_next( offs = rec_get_next_offs(rec); - ut_a(offs < UNIV_PAGE_SIZE); + if (offs >= UNIV_PAGE_SIZE) { + fprintf(stderr, +"InnoDB: Next record offset is nonsensical %lu in record at offset %lu\n", + (ulong)offs, (ulong)(rec - page)); + fprintf(stderr, +"\nInnoDB: rec address %lx, first buffer frame %lx\n" +"InnoDB: buffer pool high end %lx, buf fix count %lu\n", + (ulong)rec, (ulong)buf_pool->frame_zero, + (ulong)buf_pool->high_end, + (ulong)buf_block_align(rec)->buf_fix_count); + buf_page_print(page); + + ut_a(0); + } if (offs == 0) { diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index caee374d2ef..2e42c2f5036 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -99,6 +99,8 @@ extern lint srv_conc_n_threads; extern ibool srv_fast_shutdown; +extern ibool srv_innodb_status; + extern ibool srv_use_doublewrite_buf; extern ibool srv_set_thread_priorities; diff --git a/innobase/include/srv0start.h b/innobase/include/srv0start.h index 0074de537c3..75af1a212b4 100644 --- a/innobase/include/srv0start.h +++ b/innobase/include/srv0start.h @@ -64,15 +64,17 @@ innobase_start_or_create_for_mysql(void); /* out: DB_SUCCESS or error code */ /******************************************************************** Shuts down the Innobase database. */ - int innobase_shutdown_for_mysql(void); /*=============================*/ /* out: DB_SUCCESS or error code */ - extern dulint srv_shutdown_lsn; extern dulint srv_start_lsn; +#ifdef __NETWARE__ +void set_panic_flag_for_netware(void); +#endif + extern ulint srv_sizeof_trx_t_in_ha_innodb_cc; extern ibool srv_is_being_started; diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h index a155f68bd12..5f30a894874 100644 --- a/innobase/include/ut0dbg.h +++ b/innobase/include/ut0dbg.h @@ -22,7 +22,38 @@ extern ulint* ut_dbg_null_ptr; extern const char* ut_dbg_msg_assert_fail; extern const char* ut_dbg_msg_trap; extern const char* ut_dbg_msg_stop; - +/* Have a graceful exit on NetWare rather than a segfault to avoid abends */ +#ifdef __NETWARE__ +extern ibool panic_shutdown; +#define ut_a(EXPR) do {\ + if (!((ulint)(EXPR) + ut_dbg_zero)) {\ + ut_print_timestamp(stderr);\ + fprintf(stderr, ut_dbg_msg_assert_fail,\ + os_thread_pf(os_thread_get_curr_id()), __FILE__,\ + (ulint)__LINE__);\ + fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\ + fputs(ut_dbg_msg_trap, stderr);\ + ut_dbg_stop_threads = TRUE;\ + if (ut_dbg_stop_threads) {\ + fprintf(stderr, ut_dbg_msg_stop,\ + os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\ + }\ + if(!panic_shutdown){\ + panic_shutdown = TRUE;\ + innobase_shutdown_for_mysql();}\ + exit(1);\ + }\ +} while (0) +#define ut_error do {\ + ut_print_timestamp(stderr);\ + fprintf(stderr, ut_dbg_msg_assert_fail,\ + os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\ + fprintf(stderr, ut_dbg_msg_trap);\ + ut_dbg_stop_threads = TRUE;\ + if(!panic_shutdown){panic_shutdown = TRUE;\ + innobase_shutdown_for_mysql();}\ +} while (0) +#else #define ut_a(EXPR) do {\ if (!((ulint)(EXPR) + ut_dbg_zero)) {\ ut_print_timestamp(stderr);\ @@ -49,6 +80,7 @@ extern const char* ut_dbg_msg_stop; ut_dbg_stop_threads = TRUE;\ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\ } while (0) +#endif #ifdef UNIV_DEBUG #define ut_ad(EXPR) ut_a(EXPR) diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 92e8f224dea..c9c0cd109a9 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -509,6 +509,7 @@ lock_sys_create( /* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */ lock_latest_err_file = os_file_create_tmpfile(); + ut_a(lock_latest_err_file); } /************************************************************************* diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index d5ca8f927c6..392580eb570 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -478,22 +478,72 @@ os_io_init_simple(void) } } +#ifndef UNIV_HOTBACKUP +/************************************************************************* +Creates a temporary file. This function is defined in ha_innodb.cc. */ + +int +innobase_mysql_tmpfile(void); +/*========================*/ + /* out: temporary file descriptor, or < 0 on error */ +#endif /* !UNIV_HOTBACKUP */ + /*************************************************************************** -Creates a temporary file. In case of error, causes abnormal termination. */ +Creates a temporary file. */ FILE* os_file_create_tmpfile(void) /*========================*/ - /* out: temporary file handle (never NULL) */ + /* out: temporary file handle, or NULL on error */ { - FILE* file = tmpfile(); - if (file == NULL) { + FILE* file = NULL; + int fd = -1; +#ifdef UNIV_HOTBACKUP + int tries; + for (tries = 10; tries--; ) { + char* name = tempnam(fil_path_to_mysql_datadir, "ib"); + if (!name) { + break; + } + + fd = open(name, +# ifdef __WIN__ + O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY | +# endif /* __WIN__ */ + O_CREAT | O_EXCL | O_RDWR, + S_IREAD | S_IWRITE); + if (fd >= 0) { +# ifndef __WIN__ + unlink(name); +# endif /* !__WIN__ */ + free(name); + break; + } + ut_print_timestamp(stderr); - fputs(" InnoDB: Error: unable to create temporary file\n", - stderr); - os_file_handle_error(NULL, "tmpfile"); - ut_error; + fprintf(stderr, " InnoDB: Warning: " + "unable to create temporary file %s, retrying\n", + name); + free(name); + } +#else /* UNIV_HOTBACKUP */ + fd = innobase_mysql_tmpfile(); +#endif /* UNIV_HOTBACKUP */ + + if (fd >= 0) { + file = fdopen(fd, "w+b"); + } + + if (!file) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: unable to create temporary file;" + " errno: %d\n", errno); + if (fd >= 0) { + close(fd); + } } + return(file); } @@ -3623,6 +3673,9 @@ consecutive_loop: ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: ERROR: The page to be written seems corrupt!\n"); + fprintf(stderr, +"InnoDB: Writing a block of %lu bytes, currently writing at offset %lu\n", + (ulong)total_len, (ulong)len2); buf_page_print(combined_buf + len2); fprintf(stderr, "InnoDB: ERROR: The page to be written seems corrupt!\n"); diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index dfe7f070637..fd12759ad0a 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -3010,6 +3010,30 @@ row_rename_table_for_mysql( NULL); trx->error_state = DB_SUCCESS; } + } else { + err = dict_load_foreigns(new_name); + + if (err != DB_SUCCESS) { + + ut_print_timestamp(stderr); + + fputs( + " InnoDB: Error: in RENAME TABLE table ", + stderr); + ut_print_name(stderr, new_name); + fputs("\n" + "InnoDB: is referenced in foreign key constraints\n" + "InnoDB: which are not compatible with the new table definition.\n", + stderr); + + ut_a(dict_table_rename_in_cache(table, + old_name, FALSE)); + + trx->error_state = DB_SUCCESS; + trx_general_rollback_for_mysql(trx, FALSE, + NULL); + trx->error_state = DB_SUCCESS; + } } } funct_exit: diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index bf7f6f1fc3a..2c0092adc6e 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -3224,8 +3224,15 @@ rec_loop: if (srv_force_recovery == 0 || moves_up == FALSE) { ut_print_timestamp(stderr); + buf_page_print(buf_frame_align(rec)); fprintf(stderr, -" InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n" +"\nInnoDB: rec address %lx, first buffer frame %lx\n" +"InnoDB: buffer pool high end %lx, buf block fix count %lu\n", + (ulong)rec, (ulong)buf_pool->frame_zero, + (ulong)buf_pool->high_end, + (ulong)buf_block_align(rec)->buf_fix_count); + fprintf(stderr, +"InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n" "InnoDB: ", (ulong) (rec - buf_frame_align(rec)), (ulong) next_offs, diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 813adbc0e43..389cd5b779d 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -242,6 +242,9 @@ merge to completion before shutdown */ ibool srv_fast_shutdown = FALSE; +/* Generate a innodb_status.<pid> file */ +ibool srv_innodb_status = FALSE; + ibool srv_use_doublewrite_buf = TRUE; ibool srv_set_thread_priorities = TRUE; diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 74dd23e4252..3d49a594924 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1112,16 +1112,24 @@ NetWare. */ mutex_create(&srv_monitor_file_mutex); mutex_set_level(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK); - srv_monitor_file_name = mem_alloc( - strlen(fil_path_to_mysql_datadir) + - 20 + sizeof "/innodb_status."); - sprintf(srv_monitor_file_name, "%s/innodb_status.%lu", - fil_path_to_mysql_datadir, os_proc_get_number()); - srv_monitor_file = fopen(srv_monitor_file_name, "w+"); - if (!srv_monitor_file) { - fprintf(stderr, "InnoDB: unable to create %s: %s\n", - srv_monitor_file_name, strerror(errno)); - return(DB_ERROR); + if (srv_innodb_status) { + srv_monitor_file_name = mem_alloc( + strlen(fil_path_to_mysql_datadir) + + 20 + sizeof "/innodb_status."); + sprintf(srv_monitor_file_name, "%s/innodb_status.%lu", + fil_path_to_mysql_datadir, os_proc_get_number()); + srv_monitor_file = fopen(srv_monitor_file_name, "w+"); + if (!srv_monitor_file) { + fprintf(stderr, "InnoDB: unable to create %s: %s\n", + srv_monitor_file_name, strerror(errno)); + return(DB_ERROR); + } + } else { + srv_monitor_file_name = NULL; + srv_monitor_file = os_file_create_tmpfile(); + if (!srv_monitor_file) { + return(DB_ERROR); + } } /* Restrict the maximum number of file i/o threads */ @@ -1177,6 +1185,7 @@ NetWare. */ for (i = 0; i < srv_n_file_io_threads; i++) { n[i] = i; + os_thread_create(io_handler_thread, n + i, thread_ids + i); } @@ -1606,7 +1615,9 @@ innobase_shutdown_for_mysql(void) /* out: DB_SUCCESS or error code */ { ulint i; - +#ifdef __NETWARE__ + extern ibool panic_shutdown; +#endif if (!srv_was_started) { if (srv_is_being_started) { ut_print_timestamp(stderr); @@ -1623,8 +1634,11 @@ innobase_shutdown_for_mysql(void) The step 1 is the real InnoDB shutdown. The remaining steps 2 - ... just free data structures after the shutdown. */ +#ifdef __NETWARE__ + if(!panic_shutdown) +#endif logs_empty_and_mark_files_at_shutdown(); - + if (srv_conc_n_threads != 0) { fprintf(stderr, "InnoDB: Warning: query counter shows %ld queries still\n" @@ -1687,15 +1701,16 @@ innobase_shutdown_for_mysql(void) if (srv_monitor_file) { fclose(srv_monitor_file); srv_monitor_file = 0; - unlink(srv_monitor_file_name); - mem_free(srv_monitor_file_name); + if (srv_monitor_file_name) { + unlink(srv_monitor_file_name); + mem_free(srv_monitor_file_name); + } } - + mutex_free(&srv_monitor_file_mutex); /* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside them */ - sync_close(); /* 4. Free the os_conc_mutex and all os_events and os_mutexes */ @@ -1706,7 +1721,7 @@ innobase_shutdown_for_mysql(void) /* 5. Free all allocated memory and the os_fast_mutex created in ut0mem.c */ - ut_free_all_mem(); + ut_free_all_mem(); if (os_thread_count != 0 || os_event_count != 0 @@ -1736,3 +1751,11 @@ innobase_shutdown_for_mysql(void) return((int) DB_SUCCESS); } + +#ifdef __NETWARE__ +void set_panic_flag_for_netware() +{ + extern ibool panic_shutdown; + panic_shutdown = TRUE; +} +#endif diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c index 65703ec1c86..2a0cfe1f13a 100644 --- a/innobase/ut/ut0dbg.c +++ b/innobase/ut/ut0dbg.c @@ -14,7 +14,12 @@ ulint ut_dbg_zero = 0; /* If this is set to TRUE all threads will stop into the next assertion and assert */ ibool ut_dbg_stop_threads = FALSE; - +#ifdef __NETWARE__ +ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there + happens an InnoDB assertion failure or other + fatal error condition that requires an + immediate shutdown. */ +#endif /* Null pointer used to generate memory trap */ ulint* ut_dbg_null_ptr = NULL; diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 9a591df9f77..09410e348c2 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -107,7 +107,13 @@ ut_malloc_low( /* Make an intentional seg fault so that we get a stack trace */ + /* Intentional segfault on NetWare causes an abend. Avoid this + by graceful exit handling in ut_a(). */ +#if (!defined __NETWARE__) if (*ut_mem_null_ptr) ut_mem_null_ptr = 0; +#else + ut_a(0); +#endif } if (set_to_zero) { diff --git a/install-sh b/install-sh index e9de23842dc..c1666c37407 100755 --- a/install-sh +++ b/install-sh @@ -43,7 +43,7 @@ mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" -instcmd="$mvprog" +instcmd="$cpprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am index 7e43ff751f9..5c2dc9c7ba6 100644 --- a/libmysql/Makefile.am +++ b/libmysql/Makefile.am @@ -1,9 +1,12 @@ -# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +# Copyright (C) 2000-2004 MySQL 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 program is free software; you can redistribute it and/or modify +# it under the terms of version 2 GNU General Public License as +# published by the Free Software Foundation. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# EXCEPTIONS-CLIENT in the directory of this software distribution. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,7 +17,7 @@ # License along with this library; if not, write to the Free # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA - +# # This file is public domain and comes with NO WARRANTY of any kind target = libmysqlclient.la diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index b073155f02b..389e8e9ff34 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -1,21 +1,24 @@ -## 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 -## -## This file is public domain and comes with NO WARRANTY of any kind +# Copyright (C) 2000-2004 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 GNU General Public License as +# published by the Free Software Foundation. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# EXCEPTIONS-CLIENT in the directory of this software distribution. +# +# 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 +# +# This file is public domain and comes with NO WARRANTY of any kind MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 1d4f45b729f..5857c0c84d6 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -18,7 +18,7 @@ extern uint mysql_port; extern my_string mysql_unix_port; #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \ - CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS | \ + CLIENT_TRANSACTIONS | \ CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION) sig_handler pipe_sig_handler(int sig __attribute__((unused))); diff --git a/libmysql/conf_to_src.c b/libmysql/conf_to_src.c index 8d931309abb..785e3cad4c1 100644 --- a/libmysql/conf_to_src.c +++ b/libmysql/conf_to_src.c @@ -1,9 +1,12 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000-2004 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmysql/dll.c b/libmysql/dll.c index e9334d68a0c..b0e4b9cab3b 100644 --- a/libmysql/dll.c +++ b/libmysql/dll.c @@ -1,9 +1,12 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000-2004 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c index 6d78569887e..710bf4ccd8d 100644 --- a/libmysql/errmsg.c +++ b/libmysql/errmsg.c @@ -1,9 +1,12 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000-2004 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmysql/get_password.c b/libmysql/get_password.c index 0e3b2dcb0ae..e55e77320f0 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -1,9 +1,12 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (C) 2000-2004 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3a1d0d4c9fc..fbadfc2c76e 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1,9 +1,12 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (C) 2000-2004 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmysql/manager.c b/libmysql/manager.c index f1c8d045e6c..f030eb17889 100644 --- a/libmysql/manager.c +++ b/libmysql/manager.c @@ -1,9 +1,12 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000-2004 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am index 5329c2cf18f..939cb4c73dd 100644 --- a/libmysql_r/Makefile.am +++ b/libmysql_r/Makefile.am @@ -1,9 +1,12 @@ -# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +# Copyright (C) 2000-2004 MySQL 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 program is free software; you can redistribute it and/or modify +# it under the terms of version 2 GNU General Public License as +# published by the Free Software Foundation. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# EXCEPTIONS-CLIENT in the directory of this software distribution. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,8 +17,8 @@ # License along with this library; if not, write to the Free # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA - - +# +# This file is public domain and comes with NO WARRANTY of any kind target = libmysqlclient_r.la target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ diff --git a/man/Makefile.am b/man/Makefile.am index 37eb8a13f4e..539c43dfed6 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -23,7 +23,7 @@ man_MANS = mysql.1 isamchk.1 isamlog.1 mysql_zap.1 mysqlaccess.1 \ EXTRA_DIST = mysql.1.in isamchk.1.in isamlog.1.in mysql_zap.1.in \ mysqlaccess.1.in mysqladmin.1.in mysqld.1.in mysqld_multi.1.in \ - mysqldump.1.in mysqlshow.1.in perror.1.in replace.1.in \ + mysqldump.1.in mysqlshow.1.in perror.1.in replace.1.in mysqlman.1.in \ mysqld_safe.1.in mysql_fix_privilege_tables.1.in CLEANFILES = $(man_MANS) diff --git a/man/mysqlman.1.in b/man/mysqlman.1.in new file mode 100644 index 00000000000..610a64da198 --- /dev/null +++ b/man/mysqlman.1.in @@ -0,0 +1,15 @@ +.TH mysqlman 1 "20 July 2004" "MySQL @MYSQL_BASE_VERSION@" "MySQL database" +.SH NAME +mysqlman \- default man page for mysql +.SH "DESCRIPTION" +Certain executables distributed with the MySQL database management system do +not have specific man pages. +.SH "SEE ALSO" +In most cases, you can run the executable from the command line with a "--help" +argument to display a brief summary of the executable's arguments and function. +For more information about MySQL, please refer to the MySQL reference manual, +which may already be installed locally and which is also available online at +http://dev.mysql.com/doc/ +.SH BUGS +Please refer to http://bugs.mysql.com/ to report bugs. +.\" end of man page diff --git a/myisam/mi_key.c b/myisam/mi_key.c index a872787fecd..36fe01a27f2 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -212,6 +212,8 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, if (!(*key++= (char) 1-*old++)) /* Copy null marker */ { k_length-=length; + if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART)) + k_length-=2; /* Skip length */ continue; /* Found NULL */ } } diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 1b03acddbc1..24f5db1401d 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -63,8 +63,8 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *keypos,*maxpos; uchar lastkey[MI_MAX_KEY_BUFF],*buff; DBUG_ENTER("_mi_search"); - DBUG_PRINT("enter",("pos: %ld nextflag: %d lastpos: %ld", - pos,nextflag,info->lastpos)); + DBUG_PRINT("enter",("pos: %lu nextflag: %u lastpos: %lu", + (ulong) pos, nextflag, (ulong) info->lastpos)); DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,key_len);); if (pos == HA_OFFSET_ERROR) @@ -235,15 +235,15 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, if (length == 0 || page > end) { my_errno=HA_ERR_CRASHED; - DBUG_PRINT("error",("Found wrong key: length: %d page: %lx end: %lx", - length,page,end)); + DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p", + length, page, end)); DBUG_RETURN(MI_FOUND_WRONG_KEY); } if ((flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag, ¬_used)) >= 0) break; #ifdef EXTRA_DEBUG - DBUG_PRINT("loop",("page: %lx key: '%s' flag: %d",page,t_buff,flag)); + DBUG_PRINT("loop",("page: %p key: '%s' flag: %d", page, t_buff, flag)); #endif memcpy(buff,t_buff,length); *ret_pos=page; @@ -251,7 +251,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, if (flag == 0) memcpy(buff,t_buff,length); /* Result is first key */ *last_key= page == end; - DBUG_PRINT("exit",("flag: %d ret_pos: %lx",flag,*ret_pos)); + DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos)); DBUG_RETURN(flag); } /* _mi_seq_search */ @@ -381,8 +381,8 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, if (page > end) { my_errno=HA_ERR_CRASHED; - DBUG_PRINT("error",("Found wrong key: length: %d page: %lx end: %lx", - length,page,end)); + DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p", + length, page, end)); DBUG_RETURN(MI_FOUND_WRONG_KEY); } @@ -396,9 +396,18 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, matched=prefix_len+left; - for (my_flag=0;left;left--) - if ((my_flag= (int) sort_order[*vseg++] - (int) sort_order[*k++])) - break; + if (sort_order) + { + for (my_flag=0;left;left--) + if ((my_flag= (int) sort_order[*vseg++] - (int) sort_order[*k++])) + break; + } + else + { + for (my_flag=0;left;left--) + if ((my_flag= (int) *vseg++ - (int) *k++)) + break; + } if (my_flag>0) /* mismatch */ break; @@ -502,7 +511,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, *last_key= page == end; - DBUG_PRINT("exit",("flag: %d ret_pos: %lx",flag,*ret_pos)); + DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos)); DBUG_RETURN(flag); } /* _mi_prefix_search */ @@ -579,7 +588,7 @@ my_off_t _mi_dpos(MI_INFO *info, uint nod_flag, uchar *after_key) after_key-=(nod_flag + info->s->rec_reflength); switch (info->s->rec_reflength) { #if SIZEOF_OFF_T > 4 - case 8: pos= (my_off_t) mi_uint5korr(after_key); break; + case 8: pos= (my_off_t) mi_uint8korr(after_key); break; case 7: pos= (my_off_t) mi_uint7korr(after_key); break; case 6: pos= (my_off_t) mi_uint6korr(after_key); break; case 5: pos= (my_off_t) mi_uint5korr(after_key); break; @@ -750,8 +759,9 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, key+= length; /* Same diff_key as prev */ if (length > keyseg->length) { - DBUG_PRINT("error",("Found too long null packed key: %d of %d at %lx", - length, keyseg->length, *page_pos)); + DBUG_PRINT("error", + ("Found too long null packed key: %u of %u at %p", + length, keyseg->length, *page_pos)); DBUG_DUMP("key",(char*) *page_pos,16); my_errno=HA_ERR_CRASHED; return 0; @@ -806,7 +816,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, } if (length > (uint) keyseg->length) { - DBUG_PRINT("error",("Found too long packed key: %d of %d at %lx", + DBUG_PRINT("error",("Found too long packed key: %u of %u at %p", length, keyseg->length, *page_pos)); DBUG_DUMP("key",(char*) *page_pos,16); my_errno=HA_ERR_CRASHED; @@ -861,7 +871,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, { if (length > keyinfo->maxlength) { - DBUG_PRINT("error",("Found too long binary packed key: %d of %d at %lx", + DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %p", length, keyinfo->maxlength, *page_pos)); DBUG_DUMP("key",(char*) *page_pos,16); my_errno=HA_ERR_CRASHED; @@ -908,7 +918,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, length-=tmp; from=page; from_end=page_end; } - DBUG_PRINT("info",("key: %lx from: %lx length: %u", + DBUG_PRINT("info",("key: %p from: %p length: %u", key, from, length)); memcpy_overlap((byte*) key, (byte*) from, (size_t) length); key+=length; @@ -964,7 +974,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, } } } - DBUG_PRINT("exit",("page: %lx length: %d",page,*return_key_length)); + DBUG_PRINT("exit",("page: %p length: %u", page, *return_key_length)); DBUG_RETURN(page); } /* _mi_get_key */ @@ -1015,7 +1025,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uint nod_flag; uchar *lastpos; DBUG_ENTER("_mi_get_last_key"); - DBUG_PRINT("enter",("page: %lx endpos: %lx",page,endpos)); + DBUG_PRINT("enter",("page: %p endpos: %p", page, endpos)); nod_flag=mi_test_if_nod(page); if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) @@ -1035,13 +1045,13 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, *return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,lastkey); if (*return_key_length == 0) { - DBUG_PRINT("error",("Couldn't find last key: page: %lx",page)); + DBUG_PRINT("error",("Couldn't find last key: page: %p", page)); my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); } } } - DBUG_PRINT("exit",("lastpos: %lx length: %d",lastpos,*return_key_length)); + DBUG_PRINT("exit",("lastpos: %p length: %u", lastpos, *return_key_length)); DBUG_RETURN(lastpos); } /* _mi_get_last_key */ @@ -1126,8 +1136,9 @@ int _mi_search_next(register MI_INFO *info, register MI_KEYDEF *keyinfo, uint nod_flag; uchar lastkey[MI_MAX_KEY_BUFF]; DBUG_ENTER("_mi_search_next"); - DBUG_PRINT("enter",("nextflag: %d lastpos: %ld int_keypos: %lx", - nextflag,(long) info->lastpos,info->int_keypos)); + DBUG_PRINT("enter",("nextflag: %u lastpos: %lu int_keypos: %lu", + nextflag, (ulong) info->lastpos, + (ulong) info->int_keypos)); DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,key_length);); /* Force full read if we are at last key or if we are not on a leaf @@ -1234,7 +1245,7 @@ int _mi_search_first(register MI_INFO *info, register MI_KEYDEF *keyinfo, info->page_changed=info->buff_used=0; info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length); - DBUG_PRINT("exit",("found key at %ld",(ulong) info->lastpos)); + DBUG_PRINT("exit",("found key at %lu", (ulong) info->lastpos)); DBUG_RETURN(0); } /* _mi_search_first */ @@ -1468,8 +1479,8 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key, } s_temp->totlength=(uint) length; s_temp->prev_length=0; - DBUG_PRINT("test",("tot_length: %d length: %d uniq_key_length: %d", - key_length,length,s_temp->key_length)); + DBUG_PRINT("test",("tot_length: %u length: %d uniq_key_length: %u", + key_length, length, s_temp->key_length)); /* If something after that hasn't length=0, test if we can combine */ if ((s_temp->next_key_pos=next_key)) @@ -1575,7 +1586,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key, ref_length=0; next_length_pack=0; } - DBUG_PRINT("test",("length: %d next_key: %lx",length,next_key)); + DBUG_PRINT("test",("length: %d next_key: %p", length, next_key)); { uint tmp_length; diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index e10c0739cb4..c3f9eea875d 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -62,6 +62,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r $(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 0c46fa17e1f..261da9c7a6a 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -612,6 +612,7 @@ show_failed_diff () echo "Please follow the instructions outlined at" echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html" echo "to find the reason to this problem and how to report this." + echo "" fi } diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 5d50a3da666..e85ad303564 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -476,3 +476,9 @@ alter table t1 drop key no_such_key; ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists alter table t1 drop key a; drop table t1; +create table t1 (a int); +alter table t1 rename to `t1\\`; +ERROR 42000: Incorrect table name 't1\\' +rename table t1 to `t1\\`; +ERROR 42000: Incorrect table name 't1\\' +drop table t1; diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result index 000c0c16d77..a4ced14bb12 100644 --- a/mysql-test/r/binary.result +++ b/mysql-test/r/binary.result @@ -59,8 +59,10 @@ concat("-",a,"-",b,"-") -hello-hello- select concat("-",a,"-",b,"-") from t1 where b="hello "; concat("-",a,"-",b,"-") +-hello-hello- select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello "; concat("-",a,"-",b,"-") +-hello-hello- alter table t1 modify b tinytext not null, drop key b, add key (b(100)); select concat("-",a,"-",b,"-") from t1; concat("-",a,"-",b,"-") diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 811696ef052..1d3deb0b09a 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -470,3 +470,13 @@ select s1 from t1 where s1 > 'a' order by s1; s1 b c +drop table t1; +create table t1(a char(1)) default charset = ucs2; +insert into t1 values ('a'),('b'),('c'); +alter table t1 modify a char(5); +select a, hex(a) from t1; +a hex(a) +a 0061 +b 0062 +c 0063 +drop table t1; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 17059e6e2a9..6c6e5114cf8 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -79,6 +79,21 @@ SELECT 'a\t' < 'a'; SELECT 'a\t' < 'a '; 'a\t' < 'a ' 1 +SELECT 'a' = 'a ' collate utf8_bin; +'a' = 'a ' collate utf8_bin +1 +SELECT 'a\0' < 'a' collate utf8_bin; +'a\0' < 'a' collate utf8_bin +1 +SELECT 'a\0' < 'a ' collate utf8_bin; +'a\0' < 'a ' collate utf8_bin +1 +SELECT 'a\t' < 'a' collate utf8_bin; +'a\t' < 'a' collate utf8_bin +1 +SELECT 'a\t' < 'a ' collate utf8_bin; +'a\t' < 'a ' collate utf8_bin +1 CREATE TABLE t1 (a char(10) character set utf8 not null); INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a '); SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1; @@ -325,3 +340,203 @@ insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪꪪ'); ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1 drop table t1; +create table t1 ( +c char(10) character set utf8, +unique key a using hash (c(1)) +) engine=heap; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) character set utf8 default NULL, + UNIQUE KEY `a` (`c`(1)) +) ENGINE=HEAP DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'aa' for key 1 +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'aaa' for key 1 +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +select c as c_all from t1 order by c; +c_all +a +b +c +d +e +f +б +select c as c_a from t1 where c='a'; +c_a +a +select c as c_a from t1 where c='б'; +c_a +б +drop table t1; +create table t1 ( +c char(10) character set utf8, +unique key a using btree (c(1)) +) engine=heap; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) character set utf8 default NULL, + UNIQUE KEY `a` TYPE BTREE (`c`(1)) +) ENGINE=HEAP DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'aa' for key 1 +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'aaa' for key 1 +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +select c as c_all from t1 order by c; +c_all +a +b +c +d +e +f +б +select c as c_a from t1 where c='a'; +c_a +a +select c as c_a from t1 where c='б'; +c_a +б +drop table t1; +create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10))); +insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); +insert into t1 values ('aaaaaaaaaa'); +insert into t1 values ('aaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1 +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1 +insert into t1 values (repeat('b',20)); +select c c1 from t1 where c='1'; +c1 +1 +select c c2 from t1 where c='2'; +c2 +2 +select c c3 from t1 where c='3'; +c3 +3 +select c cx from t1 where c='x'; +cx +x +select c cy from t1 where c='y'; +cy +y +select c cz from t1 where c='z'; +cz +z +select c ca10 from t1 where c='aaaaaaaaaa'; +ca10 +aaaaaaaaaa +select c cb20 from t1 where c=repeat('b',20); +cb20 +bbbbbbbbbbbbbbbbbbbb +drop table t1; +create table t1 (c char(3) character set utf8 collate utf8_bin, unique (c(2))); +insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); +insert into t1 values ('a'); +insert into t1 values ('aa'); +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'aaa' for key 1 +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bbb' for key 1 +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'ааа' for key 1 +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'ббб' for key 1 +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1 +drop table t1; +create table t1 ( +c char(10) character set utf8 collate utf8_bin, +unique key a using hash (c(1)) +) engine=heap; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) character set utf8 collate utf8_bin default NULL, + UNIQUE KEY `a` (`c`(1)) +) ENGINE=HEAP DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'aa' for key 1 +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'aaa' for key 1 +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +select c as c_all from t1 order by c; +c_all +a +b +c +d +e +f +б +select c as c_a from t1 where c='a'; +c_a +a +select c as c_a from t1 where c='б'; +c_a +б +drop table t1; +create table t1 ( +c char(10) character set utf8 collate utf8_bin, +unique key a using btree (c(1)) +) engine=heap; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) character set utf8 collate utf8_bin default NULL, + UNIQUE KEY `a` TYPE BTREE (`c`(1)) +) ENGINE=HEAP DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'aa' for key 1 +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'aaa' for key 1 +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бÐ' for key 1 +select c as c_all from t1 order by c; +c_all +a +b +c +d +e +f +б +select c as c_a from t1 where c='a'; +c_a +a +select c as c_a from t1 where c='б'; +c_a +б +drop table t1; diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result index 4800bbf4ecb..167adea6674 100644 --- a/mysql-test/r/endspace.result +++ b/mysql-test/r/endspace.result @@ -19,7 +19,7 @@ select 'a a' > 'a', 'a \0' < 'a'; 1 1 select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a' -1 1 1 +1 0 0 create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)); insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); check table t1; diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index f2c11bc51f6..a58432cb06e 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -155,3 +155,6 @@ select * from t1 where a like '%ESKA%'; a PPUH PESKA-I Maria Struniarska DROP TABLE t1; +select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin; +_cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin +1 diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 12eef4aa881..90aa04515d7 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -43,7 +43,7 @@ Warnings: Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)` select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2); log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2) -10.000000 10.000000 NULL NULL NULL 2.000000 NULL NULL +10 10 NULL NULL NULL 2 NULL NULL explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used @@ -51,7 +51,7 @@ Warnings: Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)` select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL); ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL) -10.000000 10.000000 NULL NULL NULL +10 10 NULL NULL NULL explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used @@ -59,7 +59,7 @@ Warnings: Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)` select log2(8),log2(15),log2(-2),log2(0),log2(NULL); log2(8) log2(15) log2(-2) log2(0) log2(NULL) -3.000000 3.906891 NULL NULL NULL +3 3.9068905956085 NULL NULL NULL explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used @@ -67,7 +67,7 @@ Warnings: Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)` select log10(100),log10(18),log10(-4),log10(0),log10(NULL); log10(100) log10(18) log10(-4) log10(0) log10(NULL) -2.000000 1.255273 NULL NULL NULL +2 1.2552725051033 NULL NULL NULL explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used @@ -75,7 +75,7 @@ Warnings: Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)` select pow(10,log10(10)),power(2,4); pow(10,log10(10)) power(2,4) -10.000000 16.000000 +10 16 explain extended select pow(10,log10(10)),power(2,4); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used @@ -90,35 +90,35 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select sql_no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()` -select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1); -pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1) -3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398 -explain extended select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1); +select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6); +pi() format(sin(pi()/2),6) format(cos(pi()/2),6) format(abs(tan(pi())),6) format(cot(1),6) format(asin(1),6) format(acos(0),6) format(atan(1),6) +3.141593 1.000000 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398 +explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select pi() AS `pi()`,sin((pi() / 2)) AS `sin(pi()/2)`,cos((pi() / 2)) AS `cos(pi()/2)`,abs(tan(pi())) AS `abs(tan(pi()))`,(1 / tan(1)) AS `cot(1)`,asin(1) AS `asin(1)`,acos(0) AS `acos(0)`,atan(1) AS `atan(1)` +Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)` select degrees(pi()),radians(360); degrees(pi()) radians(360) 180 6.2831853071796 SELECT ACOS(1.0); ACOS(1.0) -0.000000 +0 SELECT ASIN(1.0); ASIN(1.0) -1.570796 +1.5707963267949 SELECT ACOS(0.2*5.0); ACOS(0.2*5.0) -0.000000 +0 SELECT ACOS(0.5*2.0); ACOS(0.5*2.0) -0.000000 +0 SELECT ASIN(0.8+0.2); ASIN(0.8+0.2) -1.570796 +1.5707963267949 SELECT ASIN(1.2-0.2); ASIN(1.2-0.2) -1.570796 +1.5707963267949 explain extended select degrees(pi()),radians(360); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index aa6c0c3f505..35b90349804 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -229,3 +229,22 @@ GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost' REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁ FROM ÀÚÅÒ@localhost; DROP DATABASE ÂÄ; SET NAMES latin1; +insert into mysql.user (host, user) values ('localhost', 'test11'); +insert into mysql.db (host, db, user, select_priv) values +('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y'); +alter table mysql.db order by db asc; +flush privileges; +show grants for test11@localhost; +Grants for test11@localhost +GRANT USAGE ON *.* TO 'test11'@'localhost' +GRANT SELECT ON `ab%`.* TO 'test11'@'localhost' +GRANT SELECT ON `a%`.* TO 'test11'@'localhost' +alter table mysql.db order by db desc; +flush privileges; +show grants for test11@localhost; +Grants for test11@localhost +GRANT USAGE ON *.* TO 'test11'@'localhost' +GRANT SELECT ON `ab%`.* TO 'test11'@'localhost' +GRANT SELECT ON `a%`.* TO 'test11'@'localhost' +delete from mysql.user where user='test11'; +delete from mysql.db where user='test11'; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 010e86273a2..f7e0bbf3e2c 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -87,3 +87,43 @@ sqty 5 9 drop table t1; +CREATE TABLE t1 ( +`id` bigint(20) NOT NULL default '0', +`description` text +) ENGINE=MyISAM; +CREATE TABLE t2 ( +`id` bigint(20) NOT NULL default '0', +`description` varchar(20) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, 'test'); +INSERT INTO t2 VALUES (1, 'test'); +CREATE TABLE t3 ( +`id` bigint(20) NOT NULL default '0', +`order_id` bigint(20) NOT NULL default '0' +) ENGINE=MyISAM; +select +a.id, a.description, +count(b.id) as c +from t1 a left join t3 b on a.id=b.order_id +group by a.id, a.description +having (a.description is not null) and (c=0); +id description c +1 test 0 +select +a.*, +count(b.id) as c +from t2 a left join t3 b on a.id=b.order_id +group by a.id, a.description +having (a.description is not null) and (c=0); +id description c +1 test 0 +INSERT INTO t1 VALUES (2, 'test2'); +select +a.id, a.description, +count(b.id) as c +from t1 a left join t3 b on a.id=b.order_id +group by a.id, a.description +having (a.description is not null) and (c=0); +id description c +1 test 0 +2 test2 0 diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index c3fbd73ac42..c49c9abb368 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -217,3 +217,13 @@ DELETE from t1 where a < 100; SELECT * from t1; a DROP TABLE t1; +CREATE TABLE `job_titles` ( +`job_title_id` int(6) unsigned NOT NULL default '0', +`job_title` char(18) NOT NULL default '', +PRIMARY KEY (`job_title_id`), +UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`) +) ENGINE=HEAP; +SELECT MAX(job_title_id) FROM job_titles; +MAX(job_title_id) +NULL +DROP TABLE job_titles; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 9a123729c4b..0109097d3a1 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -412,6 +412,7 @@ aaa. aaa . select concat(a,'.') from t1 where binary a='aaa'; concat(a,'.') +aaa . aaa. update t1 set a='bbb' where a='aaa'; select concat(a,'.') from t1; @@ -529,3 +530,12 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a NULL NULL NULL NULL YES HASH drop table t1,t2; +create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); +insert into t1 values (null,''), (null,''); +explain select count(*) from t1 where a is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx idx 4 const 1 Using where +select count(*) from t1 where a is null; +count(*) +2 +drop table t1; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index e0a2a364e45..9ef1202a9a1 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -317,6 +317,7 @@ NDBCLUSTER YES/NO Clustered, fault-tolerant, memory-based tables NDB YES/NO Alias for NDBCLUSTER EXAMPLE YES/NO Example storage engine ARCHIVE YES/NO Archive storage engine +CSV YES/NO CSV storage engine drop table if exists tx; prepare stmt1 from ' drop table if exists tx ' ; execute stmt1 ; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 6df76da91d8..4ca96316800 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -475,3 +475,89 @@ id name uid id name uid 1025 Y 25 1025 Y 25 1026 Z 26 1026 Z 26 drop table t1,t2; +create table t1 (x bigint unsigned not null); +insert into t1(x) values (0xfffffffffffffff0); +insert into t1(x) values (0xfffffffffffffff1); +select * from t1; +x +18446744073709551600 +18446744073709551601 +select count(*) from t1 where x>0; +count(*) +2 +select count(*) from t1 where x=0; +count(*) +0 +select count(*) from t1 where x<0; +count(*) +0 +select count(*) from t1 where x < -16; +count(*) +0 +select count(*) from t1 where x = -16; +count(*) +0 +select count(*) from t1 where x > -16; +count(*) +2 +select count(*) from t1 where x = 18446744073709551601; +count(*) +1 +create table t2 (x bigint not null); +insert into t2(x) values (0xfffffffffffffff0); +insert into t2(x) values (0xfffffffffffffff1); +select * from t2; +x +-16 +-15 +select count(*) from t2 where x>0; +count(*) +0 +select count(*) from t2 where x=0; +count(*) +0 +select count(*) from t2 where x<0; +count(*) +2 +select count(*) from t2 where x < -16; +count(*) +0 +select count(*) from t2 where x = -16; +count(*) +1 +select count(*) from t2 where x > -16; +count(*) +1 +select count(*) from t2 where x = 18446744073709551601; +count(*) +0 +drop table t1; +create table t1 (x bigint unsigned not null primary key) engine=innodb; +insert into t1(x) values (0xfffffffffffffff0); +insert into t1(x) values (0xfffffffffffffff1); +select * from t1; +x +18446744073709551600 +18446744073709551601 +select count(*) from t1 where x>0; +count(*) +2 +select count(*) from t1 where x=0; +count(*) +0 +select count(*) from t1 where x<0; +count(*) +0 +select count(*) from t1 where x < -16; +count(*) +0 +select count(*) from t1 where x = -16; +count(*) +0 +select count(*) from t1 where x > -16; +count(*) +1 +select count(*) from t1 where x = 18446744073709551601; +count(*) +1 +drop table t1; diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index e77ef9f975b..71d1b9ad381 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -79,3 +79,20 @@ SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1; DATE_FORMAT(f1, "%l.%i %p") DATE_FORMAT(f2, "%l.%i %p") 9.00 AM 12.00 PM DROP TABLE t1; +CREATE TABLE t1 (f1 DATE); +CREATE TABLE t2 (f2 VARCHAR(8)); +CREATE TABLE t3 (f2 CHAR(8)); +INSERT INTO t1 VALUES ('1978-11-26'); +INSERT INTO t2 SELECT f1+0 FROM t1; +INSERT INTO t2 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1; +INSERT INTO t3 SELECT f1+0 FROM t1; +INSERT INTO t3 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1; +SELECT * FROM t2; +f2 +19781126 +19781126 +SELECT * FROM t3; +f2 +19781126 +19781126 +DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 30de1e62df7..f6a19a861a1 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -75,14 +75,17 @@ insert t1 values (121,"16"); select c1 + c1 * (c2 / 100) as col from t1; col 140.36 -create table t2 select c1 + c1 * (c2 / 100) as col from t1; +create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1; select * from t2; -col -140.36 +col1 col2 col3 col4 +140.36 121.00000 121 3.47850542618522e-07 show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `col` double default NULL + `col1` double default NULL, + `col2` double(22,5) default NULL, + `col3` double default NULL, + `col4` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create table t1 (a float); diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result index 07eb47faa7c..d8edf9085b7 100644 --- a/mysql-test/r/type_uint.result +++ b/mysql-test/r/type_uint.result @@ -5,8 +5,12 @@ insert into t1 values (1); insert into t1 values (-1); Warnings: Warning 1264 Data truncated; out of range for column 'this' at row 1 +insert into t1 values ('5000000000'); +Warnings: +Warning 1265 Data truncated for column 'this' at row 1 select * from t1; this 1 0 +4294967295 drop table t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 5fed85d7f50..317af337c46 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -312,3 +312,14 @@ insert into t1 values (1,1), (2,2); alter table t1 drop key no_such_key; alter table t1 drop key a; drop table t1; + +# +# BUG#4717 - check for valid table names +# +create table t1 (a int); +--error 1103 +alter table t1 rename to `t1\\`; +--error 1103 +rename table t1 to `t1\\`; +drop table t1; + diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 188ef571f7e..d9ef91496e9 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -303,4 +303,15 @@ DROP TABLE t1; create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`); insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c'); select s1 from t1 where s1 > 'a' order by s1; +drop table t1; + +# +# Bug #5081 : UCS2 fields are filled with '0x2020' +# after extending field length +# +create table t1(a char(1)) default charset = ucs2; +insert into t1 values ('a'),('b'),('c'); +alter table t1 modify a char(5); +select a, hex(a) from t1; +drop table t1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 9a383e66603..21880732e47 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -46,6 +46,15 @@ SELECT 'a\0' < 'a '; SELECT 'a\t' < 'a'; SELECT 'a\t' < 'a '; +# +# The same for binary collation +# +SELECT 'a' = 'a ' collate utf8_bin; +SELECT 'a\0' < 'a' collate utf8_bin; +SELECT 'a\0' < 'a ' collate utf8_bin; +SELECT 'a\t' < 'a' collate utf8_bin; +SELECT 'a\t' < 'a ' collate utf8_bin; + CREATE TABLE t1 (a char(10) character set utf8 not null); INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a '); SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1; @@ -189,7 +198,7 @@ drop table t2; # # Bug 4521: unique key prefix interacts poorly with utf8 -# Check keys with prefix compression +# MYISAM: keys with prefix compression, case insensitive collation. # create table t1 (c varchar(30) character set utf8, unique(c(10))); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); @@ -211,7 +220,8 @@ drop table t1; # # Bug 4521: unique key prefix interacts poorly with utf8 -# Check fixed length keys +# MYISAM: fixed length keys, case insensitive collation +# create table t1 (c char(3) character set utf8, unique (c(2))); insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); insert into t1 values ('a'); @@ -236,3 +246,149 @@ insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪꪪ'); drop table t1; +# +# Bug 4531: unique key prefix interacts poorly with utf8 +# Check HEAP+HASH, case insensitive collation +# +create table t1 ( +c char(10) character set utf8, +unique key a using hash (c(1)) +) engine=heap; +show create table t1; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +--error 1062 +insert into t1 values ('aa'); +--error 1062 +insert into t1 values ('aaa'); +insert into t1 values ('б'); +--error 1062 +insert into t1 values ('бб'); +--error 1062 +insert into t1 values ('ббб'); +select c as c_all from t1 order by c; +select c as c_a from t1 where c='a'; +select c as c_a from t1 where c='б'; +drop table t1; + +# +# Bug 4531: unique key prefix interacts poorly with utf8 +# Check HEAP+BTREE, case insensitive collation +# +create table t1 ( +c char(10) character set utf8, +unique key a using btree (c(1)) +) engine=heap; +show create table t1; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +--error 1062 +insert into t1 values ('aa'); +--error 1062 +insert into t1 values ('aaa'); +insert into t1 values ('б'); +--error 1062 +insert into t1 values ('бб'); +--error 1062 +insert into t1 values ('ббб'); +select c as c_all from t1 order by c; +select c as c_a from t1 where c='a'; +select c as c_a from t1 where c='б'; +drop table t1; + + +# +# Bug 4521: unique key prefix interacts poorly with utf8 +# MYISAM: keys with prefix compression, binary collation. +# +create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10))); +insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); +insert into t1 values ('aaaaaaaaaa'); +--error 1062 +insert into t1 values ('aaaaaaaaaaa'); +--error 1062 +insert into t1 values ('aaaaaaaaaaaa'); +insert into t1 values (repeat('b',20)); +select c c1 from t1 where c='1'; +select c c2 from t1 where c='2'; +select c c3 from t1 where c='3'; +select c cx from t1 where c='x'; +select c cy from t1 where c='y'; +select c cz from t1 where c='z'; +select c ca10 from t1 where c='aaaaaaaaaa'; +select c cb20 from t1 where c=repeat('b',20); +drop table t1; + +# +# Bug 4521: unique key prefix interacts poorly with utf8 +# MYISAM: fixed length keys, binary collation +# +create table t1 (c char(3) character set utf8 collate utf8_bin, unique (c(2))); +insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); +insert into t1 values ('a'); +insert into t1 values ('aa'); +--error 1062 +insert into t1 values ('aaa'); +insert into t1 values ('b'); +insert into t1 values ('bb'); +--error 1062 +insert into t1 values ('bbb'); +insert into t1 values ('а'); +insert into t1 values ('аа'); +--error 1062 +insert into t1 values ('ааа'); +insert into t1 values ('б'); +insert into t1 values ('бб'); +--error 1062 +insert into t1 values ('ббб'); +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +--error 1062 +insert into t1 values ('ꪪꪪꪪ'); +drop table t1; + +# +# Bug 4531: unique key prefix interacts poorly with utf8 +# Check HEAP+HASH, binary collation +# +create table t1 ( +c char(10) character set utf8 collate utf8_bin, +unique key a using hash (c(1)) +) engine=heap; +show create table t1; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +--error 1062 +insert into t1 values ('aa'); +--error 1062 +insert into t1 values ('aaa'); +insert into t1 values ('б'); +--error 1062 +insert into t1 values ('бб'); +--error 1062 +insert into t1 values ('ббб'); +select c as c_all from t1 order by c; +select c as c_a from t1 where c='a'; +select c as c_a from t1 where c='б'; +drop table t1; + +# +# Bug 4531: unique key prefix interacts poorly with utf8 +# Check HEAP+BTREE, binary collation +# +create table t1 ( +c char(10) character set utf8 collate utf8_bin, +unique key a using btree (c(1)) +) engine=heap; +show create table t1; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +--error 1062 +insert into t1 values ('aa'); +--error 1062 +insert into t1 values ('aaa'); +insert into t1 values ('б'); +--error 1062 +insert into t1 values ('бб'); +--error 1062 +insert into t1 values ('ббб'); +select c as c_all from t1 order by c; +select c as c_a from t1 where c='a'; +select c as c_a from t1 where c='б'; +drop table t1; diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index ad83202afa0..4ca2f28fa6e 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -90,3 +90,9 @@ select * from t1 where a like '%PES%'; select * from t1 where a like '%PESKA%'; select * from t1 where a like '%ESKA%'; DROP TABLE t1; + +# +# LIKE crashed for binary collations in some cases +# +select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin; + diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 36ad2dfb0a2..e58c097b5a6 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -26,8 +26,8 @@ explain extended select pow(10,log10(10)),power(2,4); set @@rand_seed1=10000000,@@rand_seed2=1000000; select rand(999999),rand(); explain extended select rand(999999),rand(); -select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1); -explain extended select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1); +select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6); +explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6); select degrees(pi()),radians(360); # diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index c112a0e0c1d..e1319690dc5 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -173,3 +173,19 @@ REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁ FROM ÀÚÅÒ@localhost; DROP DATABASE ÂÄ; SET NAMES latin1; + +# +# Bug #4898: User privileges depending on ORDER BY Settings of table db +# +insert into mysql.user (host, user) values ('localhost', 'test11'); +insert into mysql.db (host, db, user, select_priv) values +('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y'); +alter table mysql.db order by db asc; +flush privileges; +show grants for test11@localhost; +alter table mysql.db order by db desc; +flush privileges; +show grants for test11@localhost; +delete from mysql.user where user='test11'; +delete from mysql.db where user='test11'; + diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 7e4cbe76cca..870f57a4483 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -75,3 +75,49 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2; select sum(qty) as sqty from t1 group by id having count(id) > 0; select sum(qty) as sqty from t1 group by id having count(distinct id) > 0; drop table t1; + +# +# Test case for Bug #4358 Problem with HAVING clause that uses alias from the +# select list and TEXT field +# + +CREATE TABLE t1 ( + `id` bigint(20) NOT NULL default '0', + `description` text +) ENGINE=MyISAM; + +CREATE TABLE t2 ( + `id` bigint(20) NOT NULL default '0', + `description` varchar(20) +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES (1, 'test'); +INSERT INTO t2 VALUES (1, 'test'); + +CREATE TABLE t3 ( + `id` bigint(20) NOT NULL default '0', + `order_id` bigint(20) NOT NULL default '0' +) ENGINE=MyISAM; + +select + a.id, a.description, + count(b.id) as c +from t1 a left join t3 b on a.id=b.order_id +group by a.id, a.description +having (a.description is not null) and (c=0); + +select + a.*, + count(b.id) as c +from t2 a left join t3 b on a.id=b.order_id +group by a.id, a.description +having (a.description is not null) and (c=0); + +INSERT INTO t1 VALUES (2, 'test2'); + +select + a.id, a.description, + count(b.id) as c +from t1 a left join t3 b on a.id=b.order_id +group by a.id, a.description +having (a.description is not null) and (c=0); diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index d867d5f4323..37fc5a43227 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -150,3 +150,17 @@ INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; DROP TABLE t1; + +# +# Bug#4411 Server hangs when trying to SELECT MAX(id) from an empty HEAP table +# +CREATE TABLE `job_titles` ( + `job_title_id` int(6) unsigned NOT NULL default '0', + `job_title` char(18) NOT NULL default '', + PRIMARY KEY (`job_title_id`), + UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`) +) ENGINE=HEAP; + +SELECT MAX(job_title_id) FROM job_titles; + +DROP TABLE job_titles; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 298a8b1b61b..e6d47b5c570 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -502,3 +502,12 @@ alter table t1 disable keys; show keys from t1; drop table t1,t2; +# +# index search for NULL in blob. Bug #4816 +# +create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); +insert into t1 values (null,''), (null,''); +explain select count(*) from t1 where a is null; +select count(*) from t1 where a is null; +drop table t1; + diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 471af8e4a5b..6037f68db55 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -383,3 +383,46 @@ select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; drop table t1,t2; + +# Fix for bug#4488 +# +create table t1 (x bigint unsigned not null); +insert into t1(x) values (0xfffffffffffffff0); +insert into t1(x) values (0xfffffffffffffff1); +select * from t1; +select count(*) from t1 where x>0; +select count(*) from t1 where x=0; +select count(*) from t1 where x<0; +select count(*) from t1 where x < -16; +select count(*) from t1 where x = -16; +select count(*) from t1 where x > -16; +select count(*) from t1 where x = 18446744073709551601; + + +create table t2 (x bigint not null); +insert into t2(x) values (0xfffffffffffffff0); +insert into t2(x) values (0xfffffffffffffff1); +select * from t2; +select count(*) from t2 where x>0; +select count(*) from t2 where x=0; +select count(*) from t2 where x<0; +select count(*) from t2 where x < -16; +select count(*) from t2 where x = -16; +select count(*) from t2 where x > -16; +select count(*) from t2 where x = 18446744073709551601; + +drop table t1; +create table t1 (x bigint unsigned not null primary key) engine=innodb; +insert into t1(x) values (0xfffffffffffffff0); +insert into t1(x) values (0xfffffffffffffff1); +select * from t1; +select count(*) from t1 where x>0; +select count(*) from t1 where x=0; +select count(*) from t1 where x<0; +select count(*) from t1 where x < -16; +select count(*) from t1 where x = -16; +select count(*) from t1 where x > -16; +select count(*) from t1 where x = 18446744073709551601; + +drop table t1; + diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 8d67802d42a..64420a85189 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -88,3 +88,22 @@ CREATE TABLE t1 (f1 time default NULL, f2 time default NULL); INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00'); SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1; DROP TABLE t1; + +# +# Bug 4937: different date -> string conversion when using SELECT ... UNION +# and INSERT ... SELECT ... UNION +# + +CREATE TABLE t1 (f1 DATE); +CREATE TABLE t2 (f2 VARCHAR(8)); +CREATE TABLE t3 (f2 CHAR(8)); + +INSERT INTO t1 VALUES ('1978-11-26'); +INSERT INTO t2 SELECT f1+0 FROM t1; +INSERT INTO t2 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1; +INSERT INTO t3 SELECT f1+0 FROM t1; +INSERT INTO t3 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1; +SELECT * FROM t2; +SELECT * FROM t3; + +DROP TABLE t1, t2, t3; diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index d3ddecfc314..cfaa5d611f2 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -31,10 +31,14 @@ select a from t1 order by a; select min(a) from t1; drop table t1; +# +# BUG#3612, BUG#4393, BUG#4356, BUG#4394 +# + create table t1 (c1 double, c2 varchar(20)); insert t1 values (121,"16"); select c1 + c1 * (c2 / 100) as col from t1; -create table t2 select c1 + c1 * (c2 / 100) as col from t1; +create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1; select * from t2; show create table t2; drop table t1,t2; diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index ee5f5e8123b..b1f59242e8e 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -10,5 +10,6 @@ SET SQL_WARNINGS=1; create table t1 (this int unsigned); insert into t1 values (1); insert into t1 values (-1); +insert into t1 values ('5000000000'); select * from t1; drop table t1; diff --git a/ndb/include/kernel/Interpreter.hpp b/ndb/include/kernel/Interpreter.hpp index 2c282be361c..74399f5732e 100644 --- a/ndb/include/kernel/Interpreter.hpp +++ b/ndb/include/kernel/Interpreter.hpp @@ -83,7 +83,7 @@ public: static Uint32 LoadConst64(Uint32 Register); // Value in next 2 words static Uint32 Add(Uint32 DstReg, Uint32 SrcReg1, Uint32 SrcReg2); static Uint32 Sub(Uint32 DstReg, Uint32 SrcReg1, Uint32 SrcReg2); - static Uint32 Branch(Uint32 Inst, Uint32 R1, Uint32 R2); + static Uint32 Branch(Uint32 Inst, Uint32 Reg1, Uint32 Reg2); static Uint32 ExitOK(); /** @@ -184,8 +184,8 @@ Interpreter::Sub(Uint32 Dcoleg, Uint32 SrcReg1, Uint32 SrcReg2){ inline Uint32 -Interpreter::Branch(Uint32 Inst, Uint32 R1, Uint32 R2){ - return (R1 << 9) + (R2 << 6) + Inst; +Interpreter::Branch(Uint32 Inst, Uint32 Reg1, Uint32 Reg2){ + return (Reg1 << 9) + (Reg2 << 6) + Inst; } inline diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index 2975d0a5f78..038950a7a32 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -3,9 +3,11 @@ #define NDBGLOBAL_H #include <my_global.h> - #define NDB_BASE_PORT 2200 +/** signal & SIG_PIPE */ +#include <my_alarm.h> + #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) #define NDB_WIN32 #else diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp index 8755c13e9bb..a1bb91ea9c5 100644 --- a/ndb/include/util/BaseString.hpp +++ b/ndb/include/util/BaseString.hpp @@ -176,7 +176,7 @@ public: /** * Trim string from <i>delim</i> */ - static char* trim(char * src, const char * delim = " \t"); + static char* trim(char * src, const char * delim); private: char* m_chr; unsigned m_len; diff --git a/ndb/src/common/mgmcommon/LocalConfig.cpp b/ndb/src/common/mgmcommon/LocalConfig.cpp index 46afc58b756..0440ce84dba 100644 --- a/ndb/src/common/mgmcommon/LocalConfig.cpp +++ b/ndb/src/common/mgmcommon/LocalConfig.cpp @@ -280,3 +280,5 @@ LocalConfig::readConnectString(const char * connectString){ } return return_value; } + +template class Vector<MgmtSrvrId>; diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp index caf19ddba0e..46b043c7004 100644 --- a/ndb/src/cw/cpcd/APIService.cpp +++ b/ndb/src/cw/cpcd/APIService.cpp @@ -382,3 +382,5 @@ CPCDAPISession::listProcesses(Parser_t::Context & /* unused */, m_cpcd.m_processes.unlock(); } + +template class Vector<ParserRow<CPCDAPISession> const*>; diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp index 40a5fd49493..44db10422b9 100644 --- a/ndb/src/cw/cpcd/CPCD.cpp +++ b/ndb/src/cw/cpcd/CPCD.cpp @@ -431,3 +431,5 @@ CPCD::report(int id, CPCEvent::EventType t){ } m_subscribers.unlock(); } + +template class MutexVector<EventSubscriber*>; diff --git a/ndb/src/cw/cpcd/Monitor.cpp b/ndb/src/cw/cpcd/Monitor.cpp index 2935cd0a648..141de926d4d 100644 --- a/ndb/src/cw/cpcd/Monitor.cpp +++ b/ndb/src/cw/cpcd/Monitor.cpp @@ -75,3 +75,5 @@ void CPCD::Monitor::signal() { NdbCondition_Signal(m_changeCondition); } + +template class MutexVector<CPCD::Process*>; diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index a67dba95dc7..0a986f63fda 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> -#include <signal.h> - #include <BaseString.hpp> #include <InputStream.hpp> diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp index 11f6238d5f7..913c31de1f7 100644 --- a/ndb/src/cw/cpcd/main.cpp +++ b/ndb/src/cw/cpcd/main.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> /* Needed for mkdir(2) */ -#include <signal.h> #include "CPCD.hpp" #include "APIService.hpp" diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp index 8adef788365..f0ca54884be 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp @@ -937,3 +937,8 @@ operator<<(NdbOut& ndbout, const TableS & table){ } // for return ndbout; } + +template class Vector<TableS*>; +template class Vector<AttributeS*>; +template class Vector<AttributeDesc*>; + diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp index be58d72ff72..23805173484 100644 --- a/ndb/src/kernel/blocks/backup/restore/main.cpp +++ b/ndb/src/kernel/blocks/backup/restore/main.cpp @@ -353,3 +353,4 @@ main(int argc, const char** argv) return 1; } // main +template class Vector<BackupConsumer*>; diff --git a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index eb9ff08c2b1..0dc196d5f56 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -1441,7 +1441,10 @@ int Dbtup::interpreterNextLab(Signal* signal, register Uint32 theRegister; Uint32 TdataWritten = 0; Uint32 RstackPtr = 0; - Uint32 TregMemBuffer[32]; + union { + Uint32 TregMemBuffer[32]; + Uint64 Tdummy[16]; + }; Uint32 TstackMemBuffer[32]; /* ---------------------------------------------------------------- */ @@ -1492,19 +1495,23 @@ int Dbtup::interpreterNextLab(Signal* signal, // word read. Thus we set the register to be a 32 bit register. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0x50; - TregMemBuffer[theRegister + 2] = 0; + * (Int64*)(TregMemBuffer+theRegister+2) = TregMemBuffer[theRegister+1]; } else if (TnoDataRW == 3) { /* ------------------------------------------------------------- */ // Three words read means that we get the instruction plus two // 32 words read. Thus we set the register to be a 64 bit register. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0x60; + TregMemBuffer[theRegister+3] = TregMemBuffer[theRegister+2]; + TregMemBuffer[theRegister+2] = TregMemBuffer[theRegister+1]; } else if (TnoDataRW == 1) { /* ------------------------------------------------------------- */ // One word read means that we must have read a NULL value. We set // the register to indicate a NULL value. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0; + TregMemBuffer[theRegister + 2] = 0; + TregMemBuffer[theRegister + 3] = 0; } else if (TnoDataRW == (Uint32)-1) { jam(); tupkeyErrorLab(signal); @@ -1546,8 +1553,8 @@ int Dbtup::interpreterNextLab(Signal* signal, AttributeHeader& ah = AttributeHeader::init(&TdataForUpdate[0], TattrId, TattrNoOfWords); - TdataForUpdate[1] = TregMemBuffer[theRegister + 1]; - TdataForUpdate[2] = TregMemBuffer[theRegister + 2]; + TdataForUpdate[1] = TregMemBuffer[theRegister + 2]; + TdataForUpdate[2] = TregMemBuffer[theRegister + 3]; Tlen = TattrNoOfWords + 1; if (Toptype == ZUPDATE) { if (TattrNoOfWords <= 2) { @@ -1593,24 +1600,22 @@ int Dbtup::interpreterNextLab(Signal* signal, case Interpreter::LOAD_CONST16: jam(); TregMemBuffer[theRegister] = 0x50; /* 32 BIT UNSIGNED CONSTANT */ - TregMemBuffer[theRegister + 1] = theInstruction >> 16; - TregMemBuffer[theRegister + 2] = 0; + * (Int64*)(TregMemBuffer+theRegister+2) = theInstruction >> 16; break; case Interpreter::LOAD_CONST32: jam(); TregMemBuffer[theRegister] = 0x50; /* 32 BIT UNSIGNED CONSTANT */ - TregMemBuffer[theRegister + 1] = TcurrentProgram[TprogramCounter]; - TregMemBuffer[theRegister + 2] = 0; + * (Int64*)(TregMemBuffer+theRegister+2) = * + (TcurrentProgram+TprogramCounter); TprogramCounter++; break; case Interpreter::LOAD_CONST64: jam(); TregMemBuffer[theRegister] = 0x60; /* 64 BIT UNSIGNED CONSTANT */ - TregMemBuffer[theRegister + 1] = TcurrentProgram[TprogramCounter + 0]; - TregMemBuffer[theRegister + 2] = TcurrentProgram[TprogramCounter + 1]; - TprogramCounter += 2; + TregMemBuffer[theRegister + 2 ] = * (TcurrentProgram + TprogramCounter++); + TregMemBuffer[theRegister + 3 ] = * (TcurrentProgram + TprogramCounter++); break; case Interpreter::ADD_REG_REG: @@ -1620,27 +1625,16 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TdestRegister = Interpreter::getReg3(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; - Uint32 Tany64bit = (((TleftType | TrightType) & 0x60) == 0x60); + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TleftType | TrightType) != 0) { - Uint32 Tdest0 = Tleft0 + Tright0; - Uint32 Tdest1 = 0; - TregMemBuffer[TdestRegister + 1] = Tdest0; - TregMemBuffer[TdestRegister] = 0x50; - if (Tany64bit) { - TregMemBuffer[TdestRegister] = 0x60; - Tdest1 = Tleft1 + Tright1; - if (Tdest0 < Tleft0) { - Tdest1++; - } - }//if - TregMemBuffer[TdestRegister + 2] = Tdest1; + Uint64 Tdest0 = Tleft0 + Tright0; + * (Int64*)(TregMemBuffer+TdestRegister+2) = Tdest0; + TregMemBuffer[TdestRegister] = 0x60; } else { return TUPKEY_abort(signal, 20); } @@ -1654,30 +1648,18 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TdestRegister = Interpreter::getReg3(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; - + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; - Uint32 Tany64bit = (((TleftType | TrightType) & 0x60) == 0x60); + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TleftType | TrightType) != 0) { - Uint32 Tdest0 = Tleft0 - Tright0; - Uint32 Tdest1 = 0; - TregMemBuffer[TdestRegister + 1] = Tdest0; - TregMemBuffer[TdestRegister] = 0x50; - if (Tany64bit) { - TregMemBuffer[TdestRegister] = 0x60; - Tdest1 = Tleft1 - Tright1; - if (Tdest0 > Tleft0) { - Tdest1--; - }//if - }//if - TregMemBuffer[TdestRegister + 2] = Tdest1; + Int64 Tdest0 = Tleft0 - Tright0; + * (Int64*)(TregMemBuffer+TdestRegister+2) = Tdest0; + TregMemBuffer[TdestRegister] = 0x60; } else { - return TUPKEY_abort(signal, 21); - }//if + return TUPKEY_abort(signal, 20); + } break; } @@ -1711,12 +1693,12 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft0 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft1 = TregMemBuffer[theRegister + 3]; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright0 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright1 = TregMemBuffer[TrightRegister + 3]; if ((TrightType | TleftType) != 0) { jam(); if ((Tleft0 == Tright0) && (Tleft1 == Tright1)) { @@ -1733,12 +1715,12 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft0 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft1 = TregMemBuffer[theRegister + 3]; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright0 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright1 = TregMemBuffer[TrightRegister + 3]; if ((TrightType | TleftType) != 0) { jam(); if ((Tleft0 != Tright0) || (Tleft1 != Tright1)) { @@ -1754,17 +1736,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 < Tright0) || ((Tleft0 == Tright0) && - (Tleft1 < Tright1))) { + if (Tleft0 < Tright0) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { @@ -1777,17 +1758,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 < Tright0) || ((Tleft0 == Tright0) && - (Tleft1 <= Tright1))) { + if (Tleft0 <= Tright0) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { @@ -1800,17 +1780,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 > Tright0) || ((Tleft0 == Tright0) && - (Tleft1 > Tright1))) { + if (Tleft0 > Tright0){ TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { @@ -1823,17 +1802,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 > Tright0) || ((Tleft0 == Tright0) && - (Tleft1 >= Tright1))) { + if (Tleft0 >= Tright0){ TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp index e38ae566430..123c7f9207f 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp @@ -1013,3 +1013,4 @@ BLOCK_FUNCTIONS(Ndbfs); template class Vector<AsyncFile*>; template class Vector<OpenFiles::OpenFileItem>; template class MemoryChannel<Request>; +template class Pool<Request>; diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index 858af88d6de..e68c266c394 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -38,10 +38,6 @@ #include <sys/processor.h> // For system informatio #endif -#if !defined NDB_SOFTOSE && !defined NDB_OSE -#include <signal.h> // For process signals -#endif - extern EventLogger g_eventLogger; void catchsigs(bool ignore); // for process signal handling diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index c5c9d62f565..75aea2bda7f 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -35,8 +35,6 @@ #include <NdbSleep.h> #include <new> -#include <signal.h> // For process signals - extern "C" { extern void (* ndb_new_handler)(); } diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index fe9be9bcd44..8b9568fd12d 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -2023,3 +2023,5 @@ CmdBackupCallback(const MgmtSrvr::BackupEvent & event){ ndbout << str << endl; } #endif + +template class Vector<char const*>; diff --git a/ndb/src/mgmclient/CpcClient.cpp b/ndb/src/mgmclient/CpcClient.cpp index 47e336e2749..0291573a704 100644 --- a/ndb/src/mgmclient/CpcClient.cpp +++ b/ndb/src/mgmclient/CpcClient.cpp @@ -559,3 +559,4 @@ SimpleCpcClient::ParserDummy::ParserDummy(NDB_SOCKET_TYPE sock) } template class Vector<SimpleCpcClient::Process>; +template class Vector<ParserRow<SimpleCpcClient::ParserDummy> const*>; diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp index e70b454a01f..ec468836d84 100644 --- a/ndb/src/mgmclient/main.cpp +++ b/ndb/src/mgmclient/main.cpp @@ -24,8 +24,6 @@ #include "CommandInterpreter.hpp" -#include <signal.h> - const char *progname = "ndb_mgm"; diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 55384a2f91e..624f0a132a3 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -2883,3 +2883,6 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, msg.assign("Success"); return 0; } + +template class Vector<SigMatch>; +template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbApiSignal*&, unsigned); diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index ec734fe24c5..121176f5a19 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string.h> +#include <ndb_global.h> #include <ctype.h> #include <uucode.h> @@ -1271,3 +1271,7 @@ MgmApiSession::setParameter(Parser_t::Context &, m_output->println("result: %d", ret); m_output->println(""); } + +template class MutexVector<int>; +template class Vector<ParserRow<MgmApiSession> const*>; +template class Vector<unsigned short>; diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 50b9c6db6cf..bac367bb689 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -859,15 +859,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) case 0: tOperation->interpretedUpdateTuple(); tOperation->equal("SYSKEY_0", aTableId ); - { -#ifdef WORDS_BIGENDIAN - Uint64 cacheSize64 = opValue; // XXX interpreter bug on Uint32 - tOperation->incValue("NEXTID", cacheSize64); -#else - Uint32 cacheSize32 = opValue; // XXX for little-endian - tOperation->incValue("NEXTID", cacheSize32); -#endif - } + tOperation->incValue("NEXTID", opValue); tRecAttrResult = tOperation->getValue("NEXTID"); if (tConnection->execute( Commit ) == -1 ) diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp index cd051bb4609..c1f0e6f0481 100644 --- a/ndb/src/ndbapi/NdbConnection.cpp +++ b/ndb/src/ndbapi/NdbConnection.cpp @@ -1014,7 +1014,7 @@ NdbConnection::getNdbScanOperation(const char* aTableName) if (tab != 0){ return getNdbScanOperation(tab); } else { - setOperationErrorCodeAbort(theNdb->theError.code); + setOperationErrorCodeAbort(theNdb->theDictionary->m_error.code); return NULL; }//if } diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp index 2935df9c235..3a7e0dda85e 100644 --- a/ndb/src/ndbapi/NdbOperationInt.cpp +++ b/ndb/src/ndbapi/NdbOperationInt.cpp @@ -408,9 +408,7 @@ NdbOperation::incValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue) // Load aValue into register 7 if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) goto incValue_error1; - if (insertATTRINFO((Uint32)(aValue >> 32)) == -1) - goto incValue_error1; - if (insertATTRINFO(Uint32(aValue & 0xFFFFFFFF)) == -1) + if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) goto incValue_error1; // Add register 6 and 7 and put result in register 7 if (insertATTRINFO( Interpreter::Add(7, 6, 7)) == -1) @@ -451,9 +449,7 @@ NdbOperation::subValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue) // Load aValue into register 7 if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) goto subValue_error1; - if (insertATTRINFO((Uint32)(aValue >> 32)) == -1) - goto subValue_error1; - if (insertATTRINFO(Uint32(aValue & 0xFFFFFFFF)) == -1) + if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) goto subValue_error1; // Subtract register 6 and 7 and put result in register 7 if (insertATTRINFO( Interpreter::Sub(7, 6, 7)) == -1) @@ -690,8 +686,6 @@ int NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant) { INT_DEBUG(("load_const_u64 %u %llu", RegDest, Constant)); - Uint32 tTemp1; - Uint32 tTemp2; if (initial_interpreterCheck() == -1) return -1; if (RegDest >= 8) @@ -699,15 +693,11 @@ NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant) setErrorCodeAbort(4229); return -1; } - tTemp1 = (Uint32)(Constant & 0xFFFFFFFF); - tTemp2 = (Uint32)(Constant >> 32); - + // 64 bit value if (insertATTRINFO( Interpreter::LoadConst64(RegDest)) == -1) return -1; - if (insertATTRINFO(tTemp1) == -1) - return -1; - if (insertATTRINFO(tTemp2) == -1) + if (insertATTRINFOloop((Uint32*)&Constant, 2) == -1) return -1; theErrorLine++; return 0; diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index d1e57e874ee..7ec9a6a55a3 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -34,10 +34,6 @@ #include <ndb_version.h> #include <SignalLoggerManager.hpp> -#if !defined NDB_OSE && !defined NDB_SOFTOSE -#include <signal.h> -#endif - //#define REPORT_TRANSPORTER //#define API_TRACE; @@ -353,12 +349,15 @@ TransporterFacade::start_instance(const char * connectString){ if(s_config_retriever->do_connect() == -1) break; - - const Uint32 nodeId = s_config_retriever->allocNodeId(); + + Uint32 nodeId = s_config_retriever->allocNodeId(); + for(Uint32 i = 0; nodeId == 0 && i<5; i++){ + NdbSleep_SecSleep(3); + nodeId = s_config_retriever->allocNodeId(); + } if(nodeId == 0) break; - - + ndb_mgm_configuration * props = s_config_retriever->getConfig(); if(props == 0) break; diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp index 906bb7c34b2..60ea3625524 100644 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ b/ndb/src/ndbapi/TransporterFacade.hpp @@ -316,6 +316,7 @@ TransporterFacade::getIsNodeSendable(NodeId n) const { "%d of node: %d", node.m_info.m_type, n); abort(); + return false; // to remove compiler warning } } diff --git a/ndb/test/ndbapi/testBackup.cpp b/ndb/test/ndbapi/testBackup.cpp index 07355de2623..d328a7db292 100644 --- a/ndb/test/ndbapi/testBackup.cpp +++ b/ndb/test/ndbapi/testBackup.cpp @@ -205,6 +205,11 @@ int runClearTable(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_OK; } +int runDropTable(NDBT_Context* ctx, NDBT_Step* step){ + GETNDB(step)->getDictionary()->dropTable(ctx->getTab()->getName()); + return NDBT_OK; +} + #include "bank/Bank.hpp" int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ @@ -408,7 +413,7 @@ TESTCASE("BackupOne", INITIALIZER(runRestoreOne); VERIFIER(runVerifyOne); FINALIZER(runClearTable); - + FINALIZER(runDropTable); } TESTCASE("BackupBank", "Test that backup and restore works during transaction load\n" diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 92c994fad7c..15fa4db4abc 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -3,7 +3,7 @@ # max-time: 1500 cmd: testIndex -args: -n CreateAll +args: -n CreateAll T1 T6 T13 #-m 7200 1: testIndex -n InsertDeleteGentle T7 max-time: 3600 @@ -20,12 +20,12 @@ args: -n CreateLoadDrop T1 T10 # max-time: 600 cmd: testBackup -args: -n BackupOne - -max-time: 600 -cmd: testBackup -args: -n BackupBank T6 +args: -n BackupOne T1 T6 T3 I3 +#max-time: 600 +#cmd: testBackup +#args: -n BackupBank T6 +# # # MGMAPI AND MGSRV # diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 0ea700e1d66..90e14a39296 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -938,9 +938,11 @@ gather_result(atrt_config& config, int * result){ BaseString tmp = g_gather_progname; for(size_t i = 0; i<config.m_processes.size(); i++){ atrt_process & proc = config.m_processes[i]; - tmp.appfmt(" %s:%s", - proc.m_hostname.c_str(), - proc.m_proc.m_cwd.c_str()); + if(proc.m_proc.m_path != ""){ + tmp.appfmt(" %s:%s", + proc.m_hostname.c_str(), + proc.m_proc.m_cwd.c_str()); + } } const int r1 = system(tmp.c_str()); diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp index 6cb3db7d0d3..a40c6ba7d7c 100644 --- a/ndb/test/src/NdbBackup.cpp +++ b/ndb/test/src/NdbBackup.cpp @@ -70,11 +70,11 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ * Fetch configuration from management server */ ConfigRetriever cr(0, NODE_TYPE_API); - ndb_mgm_configuration * p; + ndb_mgm_configuration * p = 0; BaseString tmp; tmp.assfmt("%s:%d", host.c_str(), port); NdbMgmHandle handle = ndb_mgm_create_handle(); - if(handle == 0 || ndb_mgm_connect(handle, tmp.c_str()) != 0 && + if(handle == 0 || ndb_mgm_connect(handle, tmp.c_str()) != 0 || (p = ndb_mgm_get_configuration(handle, 0)) == 0){ const char * s = 0; @@ -97,7 +97,8 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ ndbout << "Invalid configuration fetched, DB missing" << endl; return NULL; } - unsigned int type = 123456; + + unsigned int type = NODE_TYPE_DB + 1; if(iter.get(CFG_TYPE_OF_SECTION, &type) || type != NODE_TYPE_DB){ ndbout <<"type = " << type << endl; ndbout <<"Invalid configuration fetched, I'm wrong type of node" << endl; @@ -148,31 +149,18 @@ NdbBackup::execRestore(bool _restore_data, ndbout << "res: " << res << endl; -#if 0 - snprintf(buf, 255, "ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s %s/BACKUP/BACKUP-%d", - ownNodeId, - addr, - _node_id, - _backup_id, - _restore_data?"-r":"", - _restore_meta?"-m":"", - path, - _backup_id); - + snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .", +#if 1 + "", +#else + "valgrind --leak-check=yes -v " #endif - - snprintf(buf, 255, "valgrind --leak-check=yes -v ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s .", - ownNodeId, addr.c_str(), _node_id, _backup_id, _restore_data?"-r":"", _restore_meta?"-m":""); - // path, - // _backup_id); - - ndbout << "buf: "<< buf <<endl; res = system(buf); diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index b0ef8219fdf..86d34066c55 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -307,3 +307,5 @@ waitClusterStatus(const char* _addr, } return 0; } + +template class Vector<ndb_mgm_node_state>; diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 7692869c607..5165f63955c 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -88,7 +88,7 @@ do done for i in COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - MySQLEULA.txt LICENSE.doc README.NW + EXCEPTIONS-CLIENT MySQLEULA.txt LICENSE.doc README.NW do if [ -f $i ] then diff --git a/scripts/make_sharedlib_distribution.sh b/scripts/make_sharedlib_distribution.sh index 4104a315296..fbc945e445a 100644 --- a/scripts/make_sharedlib_distribution.sh +++ b/scripts/make_sharedlib_distribution.sh @@ -45,8 +45,10 @@ fi mkdir -p $BASE/lib for i in \ - libmysql/.libs/libmysqlclient.so* \ - libmysql_r/.libs/libmysqlclient_r.so* + libmysql/.libs/libmysqlclient.s{l,o}* \ + libmysql/.libs/libmysqlclient*.dylib \ + libmysql_r/.libs/libmysqlclient_r.s{l,o}* \ + libmysql_r/.libs/libmysqlclient_r*.dylib do if [ -f $i ] then diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index eaaf219afc4..19a5fb7276b 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -275,7 +275,7 @@ touch $BASE/innobase/ib_config.h # cd $SOURCE -for i in COPYING ChangeLog README \ +for i in COPYING ChangeLog README EXCEPTIONS-CLIENT\ INSTALL-SOURCE INSTALL-WIN \ INSTALL-WIN-SOURCE \ Docs/manual_toc.html Docs/manual.html \ diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 1f5ba707f05..b0c40102a6b 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -189,7 +189,6 @@ sub new $self->{'transactions'} = 1; # Transactions enabled $limits{'max_columns'} = 90; # Max number of columns in table $limits{'max_tables'} = 32; # No comments - $limits{'working_blobs'} = 0; # NDB tables can't handle BLOB's } if (defined($main::opt_create_options) && $main::opt_create_options =~ /type=bdb/i) diff --git a/sql-common/client.c b/sql-common/client.c index 289944d35a0..4a8bdda5c5e 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1037,7 +1037,7 @@ void mysql_read_default_options(struct st_mysql_options *options, options->client_flag&= ~CLIENT_LOCAL_FILES; break; case 22: - options->client_flag&= CLIENT_LOCAL_FILES; + options->client_flag&= ~CLIENT_LOCAL_FILES; break; case 23: /* replication probe */ #ifndef TO_BE_DELETED diff --git a/sql/Makefile.am b/sql/Makefile.am index 1a984604dbf..d1dfbfb390e 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -45,6 +45,7 @@ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ @innodb_system_libs@ \ @ndbcluster_libs@ @ndbcluster_system_libs@ \ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@ +mysqld_DEPENDENCIES = @ndbcluster_libs@ @ndbcluster_system_libs@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ item_strfunc.h item_timefunc.h item_uniq.h \ item_create.h item_subselect.h item_row.h \ @@ -153,8 +154,8 @@ sql_lex.o: lex_hash.h udf_example.so: udf_example.cc $(CXXCOMPILE) -shared -o $@ $< -#distclean: -# rm -f lex_hash.h +distclean: + rm -f lex_hash.h # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 728af469bb0..06a19e478ae 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -43,6 +43,9 @@ TODO: #endif #include "mysql_priv.h" + +#ifdef HAVE_CSV_DB + #include "ha_tina.h" #include <sys/mman.h> @@ -844,3 +847,5 @@ int ha_tina::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_i DBUG_RETURN(0); } + +#endif /* enable CSV */ diff --git a/sql/field.cc b/sql/field.cc index af9ad110f0e..522daa9e2cd 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -46,6 +46,8 @@ template class List_iterator<create_field>; uchar Field_null::null[1]={1}; const char field_separator=','; +#define DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE 320 + /***************************************************************************** Static help functions *****************************************************************************/ @@ -876,7 +878,7 @@ int Field_decimal::store(double nr) reg4 uint i,length; char fyllchar,*to; - char buff[320]; + char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; fyllchar = zerofill ? (char) '0' : (char) ' '; #ifdef HAVE_SNPRINTF @@ -1751,13 +1753,14 @@ void Field_medium::sql_type(String &res) const int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) { long tmp; - int error= 0; + int error= 0, cuted_fields= 0; char *end; tmp= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES); len-= tmp; from+= tmp; my_errno=0; + if (unsigned_flag) { if (!len || *from == '-') @@ -1774,6 +1777,34 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) if (error || (from+len != end && table->in_use->count_cuted_fields && !test_if_int(from,len,end,cs))) + error= 1; +#if SIZEOF_LONG > 4 + if (unsigned_flag) + { + if (tmp > UINT_MAX32) + { + tmp= UINT_MAX32; + error= 1; + my_errno=ERANGE; + } + } + else + { + if (tmp > INT_MAX32) + { + tmp= INT_MAX32; + error= 1; + my_errno=ERANGE; + } + else if (tmp < INT_MIN32) + { + tmp= INT_MIN32; + error= 1; + my_errno=ERANGE; + } + } +#endif + if (error) { set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1); error= 1; @@ -2695,7 +2726,7 @@ String *Field_double::val_str(String *val_buffer, #endif doubleget(nr,ptr); - uint to_length=max(field_length,320); + uint to_length=max(field_length, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE); val_buffer->alloc(to_length); char *to=(char*) val_buffer->ptr(); @@ -2707,7 +2738,8 @@ String *Field_double::val_str(String *val_buffer, else { #ifdef HAVE_FCONVERT - char buff[320],*pos=buff; + char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; + char *pos= buff; int decpt,sign,tmp_dec=dec; VOID(fconvert(nr,tmp_dec,&decpt,&sign,buff)); @@ -4232,16 +4264,44 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) } -int Field_string::store(double nr) +/* + Store double value in Field_string or Field_varstring. + + SYNOPSIS + store(double nr) + nr number + + DESCRIPTION + Pretty prints double number into field_length characters buffer. +*/ + +int Field_str::store(double nr) { - char buff[MAX_FIELD_WIDTH],*end; - int width=min(field_length,DBL_DIG+5); - sprintf(buff,"%-*.*g",width,max(width-5,0),nr); - end=strcend(buff,' '); - return Field_string::store(buff,(uint) (end - buff), &my_charset_bin); + bool use_scientific_notation=TRUE; + char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; + int length; + if (field_length < 32 && nr > 1) // TODO: negative numbers + { + if (ceiling == 0) + { + static double e[]= {1e1, 1e2, 1e4, 1e8, 1e16 }; + double p= 1; + for (int i= sizeof(e)/sizeof(e[0]), j= 1<<i ; j; i--, j>>= 1 ) + { + if (field_length & j) + p*= e[i]; + } + ceiling= p-1; + } + use_scientific_notation= (ceiling < nr); + } + length= sprintf(buff, "%-.*g", + use_scientific_notation ? max(0,field_length-5) : field_length, + nr); + DBUG_ASSERT(length <= field_length); + return store((const char *)buff, (uint) length, charset()); } - int Field_string::store(longlong nr) { char buff[64]; @@ -4410,16 +4470,6 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) } -int Field_varstring::store(double nr) -{ - char buff[MAX_FIELD_WIDTH],*end; - int width=min(field_length,DBL_DIG+5); - sprintf(buff,"%-*.*g",width,max(width-5,0),nr); - end=strcend(buff,' '); - return Field_varstring::store(buff,(uint) (end - buff), &my_charset_bin); -} - - int Field_varstring::store(longlong nr) { char buff[64]; diff --git a/sql/field.h b/sql/field.h index 7f35b006c03..83c5a71f07f 100644 --- a/sql/field.h +++ b/sql/field.h @@ -336,25 +336,28 @@ public: class Field_str :public Field { protected: CHARSET_INFO *field_charset; + double ceiling; // for ::store(double nr) public: Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,CHARSET_INFO *charset) :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg) - { + unireg_check_arg, field_name_arg, table_arg), ceiling(0.0) + { field_charset=charset; if (charset->state & MY_CS_BINSORT) flags|=BINARY_FLAG; } Item_result result_type () const { return STRING_RESULT; } uint decimals() const { return NOT_FIXED_DEC; } + int store(double nr); + int store(const char *to,uint length,CHARSET_INFO *cs)=0; void make_field(Send_field *); uint size_of() const { return sizeof(*this); } CHARSET_INFO *charset(void) const { return field_charset; } void set_charset(CHARSET_INFO *charset) { field_charset=charset; } - bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; } + bool binary() const { return field_charset == &my_charset_bin; } uint32 max_length() { return field_length; } friend class create_field; }; @@ -904,7 +907,6 @@ public: bool zero_pack() const { return 0; } void reset(void) { charset()->cset->fill(charset(),ptr,field_length,' '); } int store(const char *to,uint length,CHARSET_INFO *charset); - int store(double nr); int store(longlong nr); double val_real(void); longlong val_int(void); @@ -950,7 +952,6 @@ public: uint32 pack_length() const { return (uint32) field_length+2; } uint32 key_length() const { return (uint32) field_length; } int store(const char *to,uint length,CHARSET_INFO *charset); - int store(double nr); int store(longlong nr); double val_real(void); longlong val_int(void); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index e98068ef974..d7993939092 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -340,8 +340,10 @@ static void do_cut_string(Copy_field *copy) static void do_expand_string(Copy_field *copy) { + CHARSET_INFO *cs= copy->from_field->charset(); memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); - bfill(copy->to_ptr+copy->from_length,copy->to_length-copy->from_length,' '); + cs->cset->fill(cs, copy->to_ptr+copy->from_length, + copy->to_length-copy->from_length, ' '); } static void do_varstring(Copy_field *copy) diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 39ef6ca855a..7cd534d60b3 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -357,9 +357,11 @@ ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const case HA_KEYTYPE_VARTEXT: /* As BDB stores only one copy of equal strings, we can't use key read - on these + on these. Binary collations do support key read though. */ - flags&= ~HA_KEYREAD_ONLY; + if (!(table->key_info[idx].key_part[i].field->charset()->state + & MY_CS_BINSORT)) + flags&= ~HA_KEYREAD_ONLY; break; default: // Keep compiler happy break; diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index cc828b6e6b2..d7327362286 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -360,7 +360,8 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd, int ha_heap::delete_table(const char *name) { - int error=heap_delete_table(name); + char buff[FN_REFLEN]; + int error= heap_delete_table(fn_format(buff,name,"","",4+2)); return error == ENOENT ? 0 : error; } @@ -429,7 +430,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, { if (!f_is_packed(flag) && f_packtype(flag) == (int) FIELD_TYPE_DECIMAL && - !(flag & FIELDFLAG_BINARY)) + !(field->charset() == &my_charset_bin)) seg->type= (int) HA_KEYTYPE_TEXT; else seg->type= (int) HA_KEYTYPE_BINARY; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index a8309d4f32c..b1e5a16bc32 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -118,6 +118,7 @@ my_bool innobase_use_native_aio = FALSE; my_bool innobase_fast_shutdown = TRUE; my_bool innobase_file_per_table = FALSE; my_bool innobase_locks_unsafe_for_binlog = FALSE; +my_bool innobase_create_status_file = FALSE; static char *internal_innobase_data_file_path = NULL; @@ -135,6 +136,10 @@ char innodb_dummy_stmt_trx_handle = 'D'; static HASH innobase_open_tables; +#ifdef __NETWARE__ /* some special cleanup for NetWare */ +bool nw_panic = FALSE; +#endif + static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length, my_bool not_used __attribute__((unused))); static INNOBASE_SHARE *get_share(const char *table_name); @@ -420,6 +425,30 @@ innobase_mysql_print_thd( } /************************************************************************* +Creates a temporary file. */ +extern "C" +int +innobase_mysql_tmpfile(void) +/*========================*/ + /* out: temporary file descriptor, or < 0 on error */ +{ + char filename[FN_REFLEN]; + File fd = create_temp_file(filename, NullS, "ib", +#ifdef __WIN__ + O_BINARY | O_TRUNC | O_SEQUENTIAL | + O_TEMPORARY | O_SHORT_LIVED | +#endif /* __WIN__ */ + O_CREAT | O_EXCL | O_RDWR, + MYF(MY_WME)); +#ifndef __WIN__ + if (fd >= 0) { + unlink(filename); + } +#endif /* !__WIN__ */ + return(fd); +} + +/************************************************************************* Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still lacks one. */ @@ -912,6 +941,7 @@ innobase_init(void) srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog; srv_max_n_open_files = (ulint) innobase_open_files; + srv_innodb_status = (ibool) innobase_create_status_file; srv_print_verbose_log = mysql_embedded ? 0 : 1; @@ -982,6 +1012,11 @@ innobase_end(void) DBUG_ENTER("innobase_end"); +#ifdef __NETWARE__ /* some special cleanup for NetWare */ + if (nw_panic) { + set_panic_flag_for_netware(); + } +#endif if (innodb_inited) { innodb_inited= 0; @@ -4403,7 +4438,7 @@ ha_innobase::update_table_comment( trx_search_latch_release_if_reserved(prebuilt->trx); str = NULL; - if (FILE* file = tmpfile()) { + if (FILE* file = os_file_create_tmpfile()) { long flen; /* output the data to a temporary file */ @@ -4465,7 +4500,7 @@ ha_innobase::get_foreign_key_create_info(void) update_thd(current_thd); - if (FILE* file = tmpfile()) { + if (FILE* file = os_file_create_tmpfile()) { long flen; prebuilt->trx->op_info = (char*)"getting info on foreign keys"; diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index 6815bdd632d..6556931fa1a 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -189,7 +189,8 @@ extern char *innobase_unix_file_flush_method; /* The following variables have to be my_bool for SHOW VARIABLES to work */ extern my_bool innobase_log_archive, innobase_use_native_aio, innobase_fast_shutdown, - innobase_file_per_table, innobase_locks_unsafe_for_binlog; + innobase_file_per_table, innobase_locks_unsafe_for_binlog, + innobase_create_status_file; extern "C" { extern ulong srv_max_buf_pool_modified_pct; } diff --git a/sql/item.h b/sql/item.h index e1bed6bd1d8..6900fa11b90 100644 --- a/sql/item.h +++ b/sql/item.h @@ -862,7 +862,7 @@ public: }; /* - The following class is used to optimize comparing of date columns + The following class is used to optimize comparing of date and bigint columns We need to save the original item, to be able to set the field to the original value in 'opt_range'. */ @@ -872,7 +872,9 @@ class Item_int_with_ref :public Item_int Item *ref; public: Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg) - {} + { + unsigned_flag= ref_arg->unsigned_flag; + } int save_in_field(Field *field, bool no_conversions) { return ref->save_in_field(field, no_conversions); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 14c0d996360..3c75dba42da 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -303,10 +303,10 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) my_coll_agg_error((*a)->collation, (*b)->collation, owner->func_name()); return 1; } - if (my_binary_compare(cmp_collation.collation)) + if (cmp_collation.collation == &my_charset_bin) { /* - We are using binary collation, change to compare byte by byte, + We are using BLOB/BINARY/VARBINARY, change to compare byte by byte, without removing end space */ if (func == &Arg_comparator::compare_string) @@ -315,6 +315,22 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) func= &Arg_comparator::compare_e_binary_string; } } + else if (type == INT_RESULT) + { + if (func == &Arg_comparator::compare_int_signed) + { + if ((*a)->unsigned_flag) + func= ((*b)->unsigned_flag)? &Arg_comparator::compare_int_unsigned : + &Arg_comparator::compare_int_unsigned_signed; + else if ((*b)->unsigned_flag) + func= &Arg_comparator::compare_int_signed_unsigned; + } + else if (func== &Arg_comparator::compare_e_int) + { + if ((*a)->unsigned_flag ^ (*b)->unsigned_flag) + func= &Arg_comparator::compare_e_int_diff_signedness; + } + } return 0; } @@ -416,7 +432,7 @@ int Arg_comparator::compare_e_real() return test(val1 == val2); } -int Arg_comparator::compare_int() +int Arg_comparator::compare_int_signed() { longlong val1= (*a)->val_int(); if (!(*a)->null_value) @@ -434,6 +450,82 @@ int Arg_comparator::compare_int() return -1; } + +/* + Compare values as BIGINT UNSIGNED. +*/ + +int Arg_comparator::compare_int_unsigned() +{ + ulonglong val1= (*a)->val_int(); + if (!(*a)->null_value) + { + ulonglong val2= (*b)->val_int(); + if (!(*b)->null_value) + { + owner->null_value= 0; + if (val1 < val2) return -1; + if (val1 == val2) return 0; + return 1; + } + } + owner->null_value= 1; + return -1; +} + + +/* + Compare signed (*a) with unsigned (*B) +*/ + +int Arg_comparator::compare_int_signed_unsigned() +{ + longlong sval1= (*a)->val_int(); + if (!(*a)->null_value) + { + ulonglong uval2= (ulonglong)(*b)->val_int(); + if (!(*b)->null_value) + { + owner->null_value= 0; + if (sval1 < 0 || (ulonglong)sval1 < uval2) + return -1; + if ((ulonglong)sval1 == uval2) + return 0; + return 1; + } + } + owner->null_value= 1; + return -1; +} + + +/* + Compare unsigned (*a) with signed (*B) +*/ + +int Arg_comparator::compare_int_unsigned_signed() +{ + ulonglong uval1= (ulonglong)(*a)->val_int(); + if (!(*a)->null_value) + { + longlong sval2= (*b)->val_int(); + if (!(*b)->null_value) + { + owner->null_value= 0; + if (sval2 < 0) + return 1; + if (uval1 < (ulonglong)sval2) + return -1; + if (uval1 == (ulonglong)sval2) + return 0; + return 1; + } + } + owner->null_value= 1; + return -1; +} + + int Arg_comparator::compare_e_int() { longlong val1= (*a)->val_int(); @@ -443,6 +535,17 @@ int Arg_comparator::compare_e_int() return test(val1 == val2); } +/* + Compare unsigned *a with signed *b or signed *a with unsigned *b. +*/ +int Arg_comparator::compare_e_int_diff_signedness() +{ + longlong val1= (*a)->val_int(); + longlong val2= (*b)->val_int(); + if ((*a)->null_value || (*b)->null_value) + return test((*a)->null_value && (*b)->null_value); + return (val1 >= 0) && test(val1 == val2); +} int Arg_comparator::compare_row() { @@ -2356,7 +2459,7 @@ void Item_func_like::turboBM_compute_suffixes(int *suff) *splm1 = pattern_len; - if (cs == &my_charset_bin) + if (!cs->sort_order) { int i; for (i = pattern_len - 2; i >= 0; i--) @@ -2459,7 +2562,7 @@ void Item_func_like::turboBM_compute_bad_character_shifts() for (i = bmBc; i < end; i++) *i = pattern_len; - if (cs == &my_charset_bin) + if (!cs->sort_order) { for (j = 0; j < plm1; j++) bmBc[(uint) (uchar) pattern[j]] = plm1 - j; @@ -2490,7 +2593,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const const int tlmpl= text_len - pattern_len; /* Searching */ - if (cs == &my_charset_bin) + if (!cs->sort_order) { while (j <= tlmpl) { diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 7c96226b08a..4f2dcb6a412 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -65,12 +65,16 @@ public: int compare_string(); // compare args[0] & args[1] int compare_binary_string(); // compare args[0] & args[1] int compare_real(); // compare args[0] & args[1] - int compare_int(); // compare args[0] & args[1] + int compare_int_signed(); // compare args[0] & args[1] + int compare_int_signed_unsigned(); + int compare_int_unsigned_signed(); + int compare_int_unsigned(); int compare_row(); // compare args[0] & args[1] int compare_e_string(); // compare args[0] & args[1] int compare_e_binary_string(); // compare args[0] & args[1] int compare_e_real(); // compare args[0] & args[1] int compare_e_int(); // compare args[0] & args[1] + int compare_e_int_diff_signedness(); int compare_e_row(); // compare args[0] & args[1] static arg_cmp_func comparator_matrix [4][2]; diff --git a/sql/item_func.cc b/sql/item_func.cc index e3874d8e4fa..c90a70a6bb6 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -969,7 +969,7 @@ void Item_func_round::fix_length_and_dec() if (tmp < 0) decimals=0; else - decimals=tmp; + decimals=min(tmp,NOT_FIXED_DEC); } } @@ -1639,7 +1639,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, func->max_length=min(initid.max_length,MAX_BLOB_WIDTH); func->maybe_null=initid.maybe_null; const_item_cache=initid.const_item; - func->decimals=min(initid.decimals,31); + func->decimals=min(initid.decimals,NOT_FIXED_DEC); } initialized=1; if (error) diff --git a/sql/item_func.h b/sql/item_func.h index c05c1b01259..eaa0a044fd6 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -335,7 +335,7 @@ class Item_dec_func :public Item_real_func Item_dec_func(Item *a,Item *b) :Item_real_func(a,b) {} void fix_length_and_dec() { - decimals=6; max_length=float_length(decimals); + decimals=NOT_FIXED_DEC; max_length=float_length(decimals); maybe_null=1; } inline double fix_result(double value) diff --git a/sql/item_sum.h b/sql/item_sum.h index 507a36194de..fcace9e322a 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -282,7 +282,11 @@ public: class Item_sum_avg :public Item_sum_num { - void fix_length_and_dec() { decimals+=4; maybe_null=1; } + void fix_length_and_dec() + { + decimals=min(decimals+4, NOT_FIXED_DEC); + maybe_null=1; + } double sum; ulonglong count; @@ -337,7 +341,11 @@ class Item_sum_variance : public Item_sum_num { double sum, sum_sqr; ulonglong count; - void fix_length_and_dec() { decimals+=4; maybe_null=1; } + void fix_length_and_dec() + { + decimals=min(decimals+4, NOT_FIXED_DEC); + maybe_null=1; + } public: Item_sum_variance(Item *item_par) :Item_sum_num(item_par),count(0) {} diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 73aec7e8bdd..5d9a6dd9490 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -113,10 +113,15 @@ static bool make_datetime(date_time_format_types format, TIME *ltime, } -/* Date formats corresponding to compound %r and %T conversion specifiers */ -static DATE_TIME_FORMAT time_ampm_format= {{}, '\0', 0, +/* + Date formats corresponding to compound %r and %T conversion specifiers + + Note: We should init at least first element of "positions" array + (first member) or hpux11 compiler will die horribly. +*/ +static DATE_TIME_FORMAT time_ampm_format= {{0}, '\0', 0, {(char *)"%I:%i:%S %p", 11}}; -static DATE_TIME_FORMAT time_24hrs_format= {{}, '\0', 0, +static DATE_TIME_FORMAT time_24hrs_format= {{0}, '\0', 0, {(char *)"%H:%i:%S", 8}}; /* diff --git a/sql/lock.cc b/sql/lock.cc index ac689495ca3..0917c143a8a 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -732,15 +732,14 @@ bool lock_global_read_lock(THD *thd) while (protect_against_global_read_lock && !thd->killed) pthread_cond_wait(&COND_refresh, &LOCK_open); waiting_for_read_lock--; - thd->exit_cond(old_message); if (thd->killed) { - (void) pthread_mutex_unlock(&LOCK_open); + thd->exit_cond(old_message); DBUG_RETURN(1); } thd->global_read_lock=1; global_read_lock++; - (void) pthread_mutex_unlock(&LOCK_open); + thd->exit_cond(old_message); } DBUG_RETURN(0); } @@ -761,11 +760,12 @@ void unlock_global_read_lock(THD *thd) bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh) { const char *old_message; - bool result=0; + bool result= 0, need_exit_cond; DBUG_ENTER("wait_if_global_read_lock"); + LINT_INIT(old_message); (void) pthread_mutex_lock(&LOCK_open); - if (global_read_lock) + if (need_exit_cond= (bool)global_read_lock) { if (thd->global_read_lock) // This thread had the read locks { @@ -780,11 +780,13 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh) (void) pthread_cond_wait(&COND_refresh,&LOCK_open); if (thd->killed) result=1; - thd->exit_cond(old_message); } if (!abort_on_refresh && !result) protect_against_global_read_lock++; - pthread_mutex_unlock(&LOCK_open); + if (unlikely(need_exit_cond)) // global read locks are rare + thd->exit_cond(old_message); + else + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(result); } diff --git a/sql/log.cc b/sql/log.cc index afba530ce49..ac412f2de9a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1782,17 +1782,12 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, NOTES One must have a lock on LOCK_log before calling this function. - This lock will be freed before return! - - The reason for the above is that for enter_cond() / exit_cond() to - work the mutex must be got before enter_cond() but releases before - exit_cond(). - If you don't do it this way, you will get a deadlock in THD::awake() + This lock will be freed before return! That's required by + THD::enter_cond() (see NOTES in sql_class.h). */ void MYSQL_LOG:: wait_for_update(THD* thd, bool master_or_slave) { - safe_mutex_assert_owner(&LOCK_log); const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log, master_or_slave ? "Has read all relay log; waiting for \ @@ -1800,7 +1795,6 @@ the slave I/O thread to update it" : "Has sent all binlog to slave; \ waiting for binlog to be updated"); pthread_cond_wait(&update_cond, &LOCK_log); - pthread_mutex_unlock(&LOCK_log); // See NOTES thd->exit_cond(old_msg); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7522cbc7c41..2c85fb004d8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -237,10 +237,10 @@ bool opt_help= 0; bool opt_verbose= 0; arg_cmp_func Arg_comparator::comparator_matrix[4][2] = -{{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string}, - {&Arg_comparator::compare_real, &Arg_comparator::compare_e_real}, - {&Arg_comparator::compare_int, &Arg_comparator::compare_e_int}, - {&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}}; +{{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string}, + {&Arg_comparator::compare_real, &Arg_comparator::compare_e_real}, + {&Arg_comparator::compare_int_signed, &Arg_comparator::compare_e_int}, + {&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}}; /* Global variables */ @@ -1590,6 +1590,8 @@ static void registerwithneb() ulong neb_event_callback(struct EventBlock *eblock) { EventChangeVolStateEnter_s *voldata; + extern bool nw_panic; + voldata= (EventChangeVolStateEnter_s *)eblock->EBEventData; /* Deactivation of a volume */ @@ -1602,6 +1604,7 @@ ulong neb_event_callback(struct EventBlock *eblock) if (!memcmp(&voldata->volID, &datavolid, sizeof(VolumeID_t))) { consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n"); + nw_panic = TRUE; kill_server(0); } } @@ -1879,9 +1882,11 @@ static void init_signals(void) sigaddset(&set,SIGPIPE); #endif sigaddset(&set,SIGINT); +#ifndef IGNORE_SIGHUP_SIGQUIT sigaddset(&set,SIGQUIT); - sigaddset(&set,SIGTERM); sigaddset(&set,SIGHUP); +#endif + sigaddset(&set,SIGTERM); /* Fix signals if blocked by parents (can happen on Mac OS X) */ sigemptyset(&sa.sa_mask); @@ -1965,11 +1970,13 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) #ifdef USE_ONE_SIGNAL_HAND (void) sigaddset(&set,THR_SERVER_ALARM); // For alarms #endif +#ifndef IGNORE_SIGHUP_SIGQUIT (void) sigaddset(&set,SIGQUIT); - (void) sigaddset(&set,SIGTERM); #if THR_CLIENT_ALARM != SIGHUP (void) sigaddset(&set,SIGHUP); #endif +#endif + (void) sigaddset(&set,SIGTERM); (void) sigaddset(&set,SIGTSTP); /* Save pid to this process (or thread on Linux) */ @@ -2925,6 +2932,9 @@ we force server id to 2, but this MySQL server will not act as a slave."); printf(ER(ER_READY),my_progname,server_version, ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysqld_unix_port), mysqld_port); + if (MYSQL_COMPILATION_COMMENT[0] != '\0') + fputs(" " MYSQL_COMPILATION_COMMENT, stdout); + putchar('\n'); fflush(stdout); #if defined(__NT__) || defined(HAVE_SMEM) @@ -3942,6 +3952,7 @@ enum options_mysqld OPT_INNODB_LOCK_WAIT_TIMEOUT, OPT_INNODB_THREAD_CONCURRENCY, OPT_INNODB_FORCE_RECOVERY, + OPT_INNODB_STATUS_FILE, OPT_INNODB_MAX_DIRTY_PAGES_PCT, OPT_INNODB_OPEN_FILES, OPT_BDB_CACHE_SIZE, @@ -4171,6 +4182,10 @@ Disable with --skip-innodb (will save memory).", {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT, "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct, (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, + {"innodb_status_file", OPT_INNODB_STATUS_FILE, + "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file", + (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file, + 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif /* End HAVE_INNOBASE_DB */ {"isam", OPT_ISAM, "Enable ISAM (if this version of MySQL supports it). \ Disable with --skip-isam.", diff --git a/sql/protocol.cc b/sql/protocol.cc index 7738349c742..7c4b09ac3e3 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -200,11 +200,13 @@ net_printf(THD *thd, uint errcode, ...) 2+SQLSTATE_LENGTH+1 : 2) : 0); #ifndef EMBEDDED_LIBRARY text_pos=(char*) net->buff + head_length + offset + 1; + length=(char*)net->buff_end-text_pos; +#else + length=sizeof(text_pos)-1; #endif - (void) vsprintf(my_const_cast(char*) (text_pos),format,args); - length=(uint) strlen((char*) text_pos); - if (length >= sizeof(net->last_error)) - length=sizeof(net->last_error)-1; /* purecov: inspected */ + length=my_vsnprintf(my_const_cast(char*) (text_pos), + min(length, sizeof(net->last_error)), + format,args); va_end(args); #ifndef EMBEDDED_LIBRARY diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 4feb24f06b2..d7b70fe122c 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -589,6 +589,8 @@ pthread_handler_decl(handle_failsafe_rpl,arg) THD *thd = new THD; thd->thread_stack = (char*)&thd; MYSQL* recovery_captain = 0; + const char* msg; + pthread_detach_this_thread(); if (init_failsafe_rpl_thread(thd) || !(recovery_captain=mysql_init(0))) { @@ -596,11 +598,11 @@ pthread_handler_decl(handle_failsafe_rpl,arg) goto err; } pthread_mutex_lock(&LOCK_rpl_status); + msg= thd->enter_cond(&COND_rpl_status, + &LOCK_rpl_status, "Waiting for request"); while (!thd->killed && !abort_loop) { bool break_req_chain = 0; - const char* msg = thd->enter_cond(&COND_rpl_status, - &LOCK_rpl_status, "Waiting for request"); pthread_cond_wait(&COND_rpl_status, &LOCK_rpl_status); thd->proc_info="Processing request"; while (!break_req_chain) @@ -618,9 +620,8 @@ pthread_handler_decl(handle_failsafe_rpl,arg) break; } } - thd->exit_cond(msg); } - pthread_mutex_unlock(&LOCK_rpl_status); + thd->exit_cond(msg); err: if (recovery_captain) mysql_close(recovery_captain); diff --git a/sql/set_var.cc b/sql/set_var.cc index 2189356e51d..5db4b1476a6 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -34,6 +34,12 @@ - If the variable should show up in 'show variables' add it to the init_vars[] struct in this file + NOTES: + - Be careful with var->save_result: sys_var::check() only updates + ulonglong_value; so other members of the union are garbage then; to use + them you must first assign a value to them (in specific ::check() for + example). + TODO: - Add full support for the variable character_set (for 4.1) @@ -2332,7 +2338,7 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var) bool sys_var_sync_binlog_period::update(THD *thd, set_var *var) { pthread_mutex_t *lock_log= mysql_bin_log.get_log_lock(); - sync_binlog_period= var->save_result.ulong_value; + sync_binlog_period= (ulong) var->save_result.ulonglong_value; /* Must reset the counter otherwise it may already be beyond the new period and so the new period will not be taken into account. Need mutex otherwise diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index b62911b8090..772e3e387d6 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -88,7 +88,7 @@ character-set=latin2 "Blob sloupec '%-.64s' nem-Bù¾e být pou¾it jako klíè", "P-Bøíli¹ velká délka sloupce '%-.64s' (nejvíce %d). Pou¾ijte BLOB", "M-Bù¾ete mít pouze jedno AUTO pole a to musí být definováno jako klíè", -"%s: p-Bøipraven na spojení\n", +"%s: p-Bøipraven na spojení", "%s: norm-Bální ukonèení\n", "%s: p-Bøijat signal %d, konèím\n", "%s: ukon-Bèení práce hotovo\n", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 07c6c422465..91fdb82fe59 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -82,7 +82,7 @@ character-set=latin1 "BLOB feltet '%-.64s' kan ikke bruges ved specifikation af indeks", "For stor feltlængde for kolonne '%-.64s' (maks = %d). Brug BLOB i stedet", "Der kan kun specificeres eet AUTO_INCREMENT-felt, og det skal være indekseret", -"%s: klar til tilslutninger\n", +"%s: klar til tilslutninger", "%s: Normal nedlukning\n", "%s: Fangede signal %d. Afslutter!!\n", "%s: Server lukket\n", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 1b133ba6cf5..41678ae67aa 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -90,7 +90,7 @@ character-set=latin1 "BLOB kolom '%-.64s' kan niet gebruikt worden bij zoeksleutel specificatie", "Te grote kolomlengte voor '%-.64s' (max = %d). Maak hiervoor gebruik van het type BLOB", "Er kan slechts 1 autofield zijn en deze moet als zoeksleutel worden gedefinieerd.", -"%s: klaar voor verbindingen\n", +"%s: klaar voor verbindingen", "%s: Normaal afgesloten \n", "%s: Signaal %d. Systeem breekt af!\n", "%s: Afsluiten afgerond\n", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 40024bada59..c34bf1c0403 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -79,7 +79,7 @@ character-set=latin1 "BLOB column '%-.64s' can't be used in key specification with the used table type", "Column length too big for column '%-.64s' (max = %d); use BLOB instead", "Incorrect table definition; there can be only one auto column and it must be defined as a key", -"%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d\n", +"%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d", "%s: Normal shutdown\n", "%s: Got signal %d. Aborting!\n", "%s: Shutdown complete\n", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 9c983d261bd..d3bb306f00a 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -84,7 +84,7 @@ character-set=latin7 "BLOB-tüüpi tulpa '%-.64s' ei saa kasutada võtmena", "Tulba '%-.64s' pikkus on liiga pikk (maksimaalne pikkus: %d). Kasuta BLOB väljatüüpi", "Vigane tabelikirjeldus; Tabelis tohib olla üks auto_increment tüüpi tulp ning see peab olema defineeritud võtmena", -"%s: ootab ühendusi\n", +"%s: ootab ühendusi", "%s: MySQL lõpetas\n", "%s: sain signaali %d. Lõpetan!\n", "%s: Lõpp\n", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 3d770eaff71..49a1065a5ca 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -79,7 +79,7 @@ character-set=latin1 "Champ BLOB '%-.64s' ne peut être utilisé dans une clé", "Champ '%-.64s' trop long (max = %d). Utilisez un BLOB", "Un seul champ automatique est permis et il doit être indexé", -"%s: Prêt pour des connections\n", +"%s: Prêt pour des connections", "%s: Arrêt normal du serveur\n", "%s: Reçu le signal %d. Abandonne!\n", "%s: Arrêt du serveur terminé\n", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 63afe6f6e5d..56e6454ab29 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -91,7 +91,7 @@ character-set=latin1 "BLOB-Feld '%-.64s' kann beim verwendeten Tabellentyp nicht als Schlüssel verwendet werden", "Feldlänge für Feld '%-.64s' zu groß (maximal %d). BLOB-Feld verwenden!", "Falsche Tabellendefinition. Es darf nur ein Auto-Feld geben und dieses muss als Schlüssel definiert werden", -"%-.64s: Bereit für Verbindungen\n", +"%-.64s: Bereit für Verbindungen", "%-.64s: Normal heruntergefahren\n", "%-.64s: Signal %d erhalten. Abbruch!\n", "%-.64s: Heruntergefahren (shutdown)\n", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 58587a4ff38..dd83db9907c 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -79,7 +79,7 @@ character-set=greek "Ðåäßï ôýðïõ Blob '%-.64s' äåí ìðïñåß íá ÷ñçóéìïðïéçèåß óôïí ïñéóìü åíüò êëåéäéïý (key specification)", "Ðïëý ìåãÜëï ìÞêïò ãéá ôï ðåäßï '%-.64s' (max = %d). Ðáñáêáëþ ÷ñçóéìïðïéåßóôå ôïí ôýðï BLOB", "Ìðïñåß íá õðÜñ÷åé ìüíï Ýíá auto field êáé ðñÝðåé íá Ý÷åé ïñéóèåß óáí key", -"%s: óå áíáìïíÞ óõíäÝóåùí\n", +"%s: óå áíáìïíÞ óõíäÝóåùí", "%s: ÖõóéïëïãéêÞ äéáäéêáóßá shutdown\n", "%s: ÅëÞöèç ôï ìÞíõìá %d. Ç äéáäéêáóßá åãêáôáëåßðåôáé!\n", "%s: Ç äéáäéêáóßá Shutdown ïëïêëçñþèçêå\n", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 3d5284dfa1a..23c6cffbcb8 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -81,7 +81,7 @@ character-set=latin2 "Blob objektum '%-.64s' nem hasznalhato kulcskent", "A(z) '%-.64s' oszlop tul hosszu. (maximum = %d). Hasznaljon BLOB tipust inkabb.", "Csak egy auto mezo lehetseges, es azt kulcskent kell definialni.", -"%s: kapcsolatra kesz\n", +"%s: kapcsolatra kesz", "%s: Normal leallitas\n", "%s: %d jelzes. Megszakitva!\n", "%s: A leallitas kesz\n", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 012f6693e6f..fbdd63f1ede 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -81,7 +81,7 @@ character-set=ujis "BLOB column '%-.64s' can't be used in key specification with the used table type", "column '%-.64s' ¤Ï,³ÎÊݤ¹¤ë column ¤ÎÂ礤µ¤¬Â¿¤¹¤®¤Þ¤¹. (ºÇÂç %d ¤Þ¤Ç). BLOB ¤ò¤«¤ï¤ê¤Ë»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤.", "¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ¤¬°ã¤¤¤Þ¤¹; there can be only one auto column and it must be defined as a key", -"%s: ½àÈ÷´°Î»\n", +"%s: ½àÈ÷´°Î»", "%s: Normal shutdown\n", "%s: Got signal %d. ÃæÃÇ!\n", "%s: Shutdown ´°Î»\n", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 65146fb6578..6e98cd61541 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -79,7 +79,7 @@ character-set=euckr "BLOB Ä®·³ '%-.64s'´Â Å° Á¤ÀÇ¿¡¼ »ç¿ëµÉ ¼ö ¾ø½À´Ï´Ù.", "Ä®·³ '%-.64s'ÀÇ Ä®·³ ±æÀÌ°¡ ³Ê¹« ±é´Ï´Ù (ÃÖ´ë = %d). ´ë½Å¿¡ BLOB¸¦ »ç¿ëÇϼ¼¿ä.", "ºÎÁ¤È®ÇÑ Å×À̺í Á¤ÀÇ; Å×À̺íÀº ÇϳªÀÇ auto Ä®·³ÀÌ Á¸ÀçÇÏ°í Å°·Î Á¤ÀǵǾîÁ®¾ß ÇÕ´Ï´Ù.", -"%s: ¿¬°á ÁغñÁßÀÔ´Ï´Ù.\n", +"%s: ¿¬°á ÁغñÁßÀÔ´Ï´Ù", "%s: Á¤»óÀûÀÎ shutdown\n", "%s: %d ½ÅÈ£°¡ µé¾î¿ÔÀ½. ÁßÁö!\n", "%s: Shutdown ÀÌ ¿Ï·áµÊ!\n", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 3825b0c84a7..517c041a355 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -81,7 +81,7 @@ character-set=latin1 "Blob kolonne '%-.64s' kan ikkje brukast ved spesifikasjon av nyklar", "For stor nykkellengde for felt '%-.64s' (maks = %d). Bruk BLOB istadenfor", "Bare eitt auto felt kan være definert som nøkkel.", -"%s: klar for tilkoblingar\n", +"%s: klar for tilkoblingar", "%s: Normal nedkopling\n", "%s: Oppdaga signal %d. Avsluttar!\n", "%s: Nedkopling komplett\n", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index dd0f0a4c6cb..b5cf4a7df19 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -81,7 +81,7 @@ character-set=latin1 "Blob felt '%-.64s' kan ikke brukes ved spesifikasjon av nøkler", "For stor nøkkellengde for kolonne '%-.64s' (maks = %d). Bruk BLOB istedenfor", "Bare ett auto felt kan være definert som nøkkel.", -"%s: klar for tilkoblinger\n", +"%s: klar for tilkoblinger", "%s: Normal avslutning\n", "%s: Oppdaget signal %d. Avslutter!\n", "%s: Avslutning komplett\n", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 9d61a0efed5..be152eed9b2 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -83,7 +83,7 @@ character-set=latin2 "Kolumna typu Blob '%-.64s' nie mo¿e byæ u¿yta w specyfikacji klucza", "Zbyt du¿a d³ugo?æ kolumny '%-.64s' (maks. = %d). W zamian u¿yj typu BLOB", "W tabeli mo¿e byæ tylko jedno pole auto i musi ono byæ zdefiniowane jako klucz", -"%s: gotowe do po³?czenia\n", +"%s: gotowe do po³?czenia", "%s: Standardowe zakoñczenie dzia³ania\n", "%s: Otrzymano sygna³ %d. Koñczenie dzia³ania!\n", "%s: Zakoñczenie dzia³ania wykonane\n", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 68784bc7be8..729883c7a79 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -80,7 +80,7 @@ character-set=latin1 "Coluna BLOB '%-.64s' não pode ser utilizada na especificação de chave para o tipo de tabela usado", "Comprimento da coluna '%-.64s' grande demais (max = %d); use BLOB em seu lugar", "Definição incorreta de tabela. Somente é permitido um único campo auto-incrementado e ele tem que ser definido como chave", -"%s: Pronto para conexões\n", +"%s: Pronto para conexões", "%s: 'Shutdown' normal\n", "%s: Obteve sinal %d. Abortando!\n", "%s: 'Shutdown' completo\n", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 8272ada205b..c1f3abc9c3d 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -83,7 +83,7 @@ character-set=latin2 "Coloana de tip BLOB '%-.64s' nu poate fi folosita in specificarea cheii cu tipul de tabla folosit", "Lungimea coloanei '%-.64s' este prea lunga (maximum = %d). Foloseste BLOB mai bine", "Definitia tabelei este incorecta; Nu pot fi mai mult de o singura coloana de tip auto si aceasta trebuie definita ca cheie", -"%s: sint gata pentru conectii\n", +"%s: sint gata pentru conectii", "%s: Terminare normala\n", "%s: Semnal %d obtinut. Aborting!\n", "%s: Terminare completa\n", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 3f567f88c46..ecc8fc6e408 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -81,7 +81,7 @@ character-set=koi8r "óÔÏÌÂÅà ÔÉÐÁ BLOB '%-.64s' ÎÅ ÍÏÖÅÔ ÂÙÔØ ÉÓÐÏÌØÚÏ×ÁÎ ËÁË ÚÎÁÞÅÎÉÅ ËÌÀÞÁ × ÔÁÂÌÉÃÅ ÔÁËÏÇÏ ÔÉÐÁ", "óÌÉÛËÏÍ ÂÏÌØÛÁÑ ÄÌÉÎÁ ÓÔÏÌÂÃÁ '%-.64s' (ÍÁËÓÉÍÕÍ = %d). éÓÐÏÌØÚÕÊÔÅ ÔÉÐ BLOB ×ÍÅÓÔÏ ÔÅËÕÝÅÇÏ", "îÅËÏÒÒÅËÔÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÔÁÂÌÉÃÙ: ÍÏÖÅÔ ÓÕÝÅÓÔ×Ï×ÁÔØ ÔÏÌØËÏ ÏÄÉÎ Á×ÔÏÉÎËÒÅÍÅÎÔÎÙÊ ÓÔÏÌÂÅÃ, É ÏÎ ÄÏÌÖÅÎ ÂÙÔØ ÏÐÒÅÄÅÌÅÎ ËÁË ËÌÀÞ", -"%s: çÏÔÏ× ÐÒÉÎÉÍÁÔØ ÓÏÅÄÉÎÅÎÉÑ.\n÷ÅÒÓÉÑ: '%s' ÓÏËÅÔ: '%s' ÐÏÒÔ: %d\n", +"%s: çÏÔÏ× ÐÒÉÎÉÍÁÔØ ÓÏÅÄÉÎÅÎÉÑ.\n÷ÅÒÓÉÑ: '%s' ÓÏËÅÔ: '%s' ÐÏÒÔ: %d", "%s: ëÏÒÒÅËÔÎÁÑ ÏÓÔÁÎÏ×ËÁ\n", "%s: ðÏÌÕÞÅÎ ÓÉÇÎÁÌ %d. ðÒÅËÒÁÝÁÅÍ!\n", "%s: ïÓÔÁÎÏ×ËÁ ÚÁ×ÅÒÛÅÎÁ\n", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index fbcaeab526f..b616db6235c 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -87,7 +87,7 @@ character-set=latin2 "Blob pole '%-.64s' nemô¾e by» pou¾ité ako kµúè", "Príli¹ veµká då¾ka pre pole '%-.64s' (maximum = %d). Pou¾ite BLOB", "Mô¾ete ma» iba jedno AUTO pole a to musí by» definované ako kµúè", -"%s: pripravený na spojenie\n", +"%s: pripravený na spojenie", "%s: normálne ukonèenie\n", "%s: prijatý signál %d, ukonèenie (Abort)!\n", "%s: práca ukonèená\n", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index ebdfeba1be2..0231e83fbec 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -81,7 +81,7 @@ character-set=latin1 "La columna Blob '%-.64s' no puede ser usada en una declaracion de clave", "Longitud de columna demasiado grande para la columna '%-.64s' (maximo = %d).Usar BLOB en su lugar", "Puede ser solamente un campo automatico y este debe ser definido como una clave", -"%s: preparado para conexiones\n", +"%s: preparado para conexiones", "%s: Apagado normal\n", "%s: Recibiendo signal %d. Abortando!\n", "%s: Apagado completado\n", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 53abfb238c3..a227de3b991 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -79,7 +79,7 @@ character-set=latin1 "En BLOB '%-.64s' kan inte vara nyckel med den använda tabelltypen", "För stor kolumnlängd angiven för '%-.64s' (max= %d). Använd en BLOB instället", "Det får finnas endast ett AUTO_INCREMENT-fält och detta måste vara en nyckel", -"%s: klar att ta emot klienter\n", +"%s: klar att ta emot klienter", "%s: Normal avslutning\n", "%s: Fick signal %d. Avslutar!\n", "%s: Avslutning klar\n", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 2267b497673..f68e709471c 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -84,7 +84,7 @@ character-set=koi8u "BLOB ÓÔÏ×ÂÅÃØ '%-.64s' ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÒÉÓÔÁÎÉÊ Õ ×ÉÚÎÁÞÅÎΦ ËÌÀÞÁ × ÃØÏÍÕ ÔÉЦ ÔÁÂÌÉæ", "úÁÄÏ×ÇÁ ÄÏ×ÖÉÎÁ ÓÔÏ×ÂÃÑ '%-.64s' (max = %d). ÷ÉËÏÒÉÓÔÁÊÔÅ ÔÉÐ BLOB", "îÅצÒÎÅ ×ÉÚÎÁÞÅÎÎÑ ÔÁÂÌÉæ; íÏÖÅ ÂÕÔÉ ÌÉÛÅ ÏÄÉÎ Á×ÔÏÍÁÔÉÞÎÉÊ ÓÔÏ×ÂÅÃØ, ÝÏ ÐÏ×ÉÎÅÎ ÂÕÔÉ ×ÉÚÎÁÞÅÎÉÊ ÑË ËÌÀÞ", -"%s: çÏÔÏ×ÉÊ ÄÌÑ Ú'¤ÄÎÁÎØ!\n", +"%s: çÏÔÏ×ÉÊ ÄÌÑ Ú'¤ÄÎÁÎØ!", "%s: îÏÒÍÁÌØÎÅ ÚÁ×ÅÒÛÅÎÎÑ\n", "%s: ïÔÒÉÍÁÎÏ ÓÉÇÎÁÌ %d. ðÅÒÅÒÉ×ÁÀÓØ!\n", "%s: òÏÂÏÔÕ ÚÁ×ÅÒÛÅÎÏ\n", diff --git a/sql/slave.cc b/sql/slave.cc index 0fe525d766f..7fb7fbdade4 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -623,7 +623,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, pthread_mutex_unlock(start_lock); DBUG_RETURN(ER_SLAVE_THREAD); } - if (start_cond && cond_lock) + if (start_cond && cond_lock) // caller has cond_lock { THD* thd = current_thd; while (start_id == *slave_run_id) @@ -633,11 +633,9 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, "Waiting for slave thread to start"); pthread_cond_wait(start_cond,cond_lock); thd->exit_cond(old_msg); + pthread_mutex_lock(cond_lock); // re-acquire it as exit_cond() released if (thd->killed) - { - pthread_mutex_unlock(cond_lock); DBUG_RETURN(ER_SERVER_SHUTDOWN); - } } } if (start_lock) @@ -1705,7 +1703,6 @@ Waiting for the slave SQL thread to free enough relay log space"); !rli->ignore_log_space_limit) pthread_cond_wait(&rli->log_space_cond, &rli->log_space_lock); thd->exit_cond(save_proc_info); - pthread_mutex_unlock(&rli->log_space_lock); DBUG_RETURN(slave_killed); } @@ -2381,6 +2378,9 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, (long) timeout)); pthread_mutex_lock(&data_lock); + const char *msg= thd->enter_cond(&data_cond, &data_lock, + "Waiting for the slave SQL thread to " + "advance position"); /* This function will abort when it notices that some CHANGE MASTER or RESET MASTER has changed the master info. @@ -2482,9 +2482,6 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, //wait for master update, with optional timeout. DBUG_PRINT("info",("Waiting for master update")); - const char* msg = thd->enter_cond(&data_cond, &data_lock, - "Waiting for the slave SQL thread to \ -advance position"); /* We are going to pthread_cond_(timed)wait(); if the SQL thread stops it will wake us up. @@ -2506,8 +2503,7 @@ advance position"); } else pthread_cond_wait(&data_cond, &data_lock); - DBUG_PRINT("info",("Got signal of master update")); - thd->exit_cond(msg); + DBUG_PRINT("info",("Got signal of master update or timed out")); if (error == ETIMEDOUT || error == ETIME) { error= -1; @@ -2519,7 +2515,7 @@ advance position"); } err: - pthread_mutex_unlock(&data_lock); + thd->exit_cond(msg); DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d \ improper_arguments: %d timed_out: %d", (int) thd->killed, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 44fd5e9e94f..f60897bf62b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -542,22 +542,30 @@ static ulong get_sort(uint count,...) va_start(args,count); ulong sort=0; + /* Should not use this function with more than 4 arguments for compare. */ + DBUG_ASSERT(count <= 4); + while (count--) { - char *str=va_arg(args,char*); - uint chars=0,wild=0; + char *start, *str= va_arg(args,char*); + uint chars= 0; + uint wild_pos= 0; /* first wildcard position */ - if (str) + if (start= str) { for (; *str ; str++) { if (*str == wild_many || *str == wild_one || *str == wild_prefix) - wild++; + { + wild_pos= str - start + 1; + break; + } else chars++; } } - sort= (sort << 8) + (wild ? 1 : chars ? 2 : 0); + sort= (sort << 8) + (wild_pos ? (wild_pos > 127 ? 127 : wild_pos) : + (chars ? 128 : 0)); } va_end(args); return sort; diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 68f7d45e81c..3f75dadb6f0 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -34,9 +34,6 @@ #define MAX_TREEMEM 8192 #define MAX_TREE_ELEMENTS 256 -#define UINT_MAX16 0xffff -#define UINT_MAX24 0xffffff -#define UINT_MAX32 0xffffffff int sortcmp2(void* cmp_arg __attribute__((unused)), const String *a,const String *b) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ad4eb9f6801..73a180078cf 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -434,8 +434,18 @@ void THD::awake(bool prepare_to_die) exits the cond in the time between read and broadcast, but that is ok since all we want to do is to make the victim thread get out of waiting on current_cond. + If we see a non-zero current_cond: it cannot be an old value (because + then exit_cond() should have run and it can't because we have mutex); so + it is the true value but maybe current_mutex is not yet non-zero (we're + in the middle of enter_cond() and there is a "memory order + inversion"). So we test the mutex too to not lock 0. + Note that there is a small chance we fail to kill. If victim has locked + current_mutex, and hasn't entered enter_cond(), then we don't know it's + going to wait on cond. Then victim goes into its cond "forever" (until + we issue a second KILL). True we have set its thd->killed but it may not + see it immediately and so may have time to reach the cond_wait(). */ - if (mysys_var->current_cond) + if (mysys_var->current_cond && mysys_var->current_mutex) { pthread_mutex_lock(mysys_var->current_mutex); pthread_cond_broadcast(mysys_var->current_cond); diff --git a/sql/sql_class.h b/sql/sql_class.h index 64fed055c80..59ac8ff0483 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -885,6 +885,12 @@ public: void close_active_vio(); #endif void awake(bool prepare_to_die); + /* + For enter_cond() / exit_cond() to work the mutex must be got before + enter_cond() (in 4.1 an assertion will soon ensure this); this mutex is + then released by exit_cond(). Use must be: + lock mutex; enter_cond(); your code; exit_cond(). + */ inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, const char* msg) { @@ -896,6 +902,13 @@ public: } inline void exit_cond(const char* old_msg) { + /* + Putting the mutex unlock in exit_cond() ensures that + mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is + locked (if that would not be the case, you'll get a deadlock if someone + does a THD::awake() on you). + */ + pthread_mutex_unlock(mysys_var->current_mutex); pthread_mutex_lock(&mysys_var->mutex); mysys_var->current_mutex = 0; mysys_var->current_cond = 0; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 82fef3f7c7b..3b12cbe3422 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -560,7 +560,6 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) char path[FN_REFLEN+16], tmp_db[NAME_LEN+1]; MY_DIR *dirp; uint length; - my_dbopt_t *dbopt; DBUG_ENTER("mysql_rm_db"); VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 77ac730b6dc..57e4022719e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4319,8 +4319,12 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, case FIELD_TYPE_TIMESTAMP: if (!length) new_field->length= 14; // Full date YYYYMMDDHHMMSS - else + else if (new_field->length != 19) { + /* + We support only even TIMESTAMP lengths less or equal than 14 + and 19 as length of 4.1 compatible representation. + */ new_field->length=((new_field->length+1)/2)*2; /* purecov: inspected */ new_field->length= min(new_field->length,14); /* purecov: inspected */ } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f8bc6210a2f..c56645e06b9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5527,6 +5527,20 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, new_table.no_rows=1; } +#ifdef TO_BE_DONE_LATER_IN_4_1 + /* + To use start_bulk_insert() (which is new in 4.1) we need to find + all places where a corresponding end_bulk_insert() should be put. + */ + table->file->info(HA_STATUS_VARIABLE); /* update table->file->records */ + new_table.file->start_bulk_insert(table->file->records); +#else + /* + HA_EXTRA_WRITE_CACHE can stay until close, no need to disable it explicitly. + */ + new_table.file->extra(HA_EXTRA_WRITE_CACHE); +#endif + /* copy all old rows */ while (!table->file->rnd_next(new_table.record[1])) { @@ -8447,7 +8461,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, { if (!(pos= new Item_copy_string(pos))) goto err; - if (param->copy_funcs.push_back(pos)) + /* + Item_copy_string::copy for function can call + Item_copy_string::val_int for blob via Item_ref. + But if Item_copy_string::copy for blob isn't called before, + it's value will be wrong + so let's insert Item_copy_string for blobs in the beginning of + copy_funcs + (to see full test case look at having.test, BUG #4358) + */ + if (param->copy_funcs.push_front(pos)) goto err; } else diff --git a/sql/sql_string.h b/sql/sql_string.h index 0179b3ebadc..d8c4c3a87a1 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -95,6 +95,14 @@ public: Ptr[str_length]=0; return Ptr; } + inline char *c_ptr_safe() + { + if (Ptr && str_length < Alloced_length) + Ptr[str_length]=0; + else + (void) realloc(str_length); + return Ptr; + } void set(String &str,uint32 offset,uint32 arg_length) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 37e959d38a1..c82bff05412 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1816,7 +1816,6 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, dropping_tables--; } thd->exit_cond(old_message); - pthread_mutex_unlock(&LOCK_open); if (thd->killed) goto err; open_for_modify=0; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8e3fb0884a9..1b091c26a6d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1933,6 +1933,12 @@ alter_list_item: LEX *lex=Lex; lex->select_lex.db=$3->db.str; lex->name= $3->table.str; + if (check_table_name($3->table.str,$3->table.length) || + $3->db.str && check_db_name($3->db.str)) + { + net_printf(lex->thd,ER_WRONG_TABLE_NAME,$3->table.str); + YYABORT; + } lex->alter_info.flags|= ALTER_RENAME; } | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index ff53f61c053..0955372e8c0 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6347,7 +6347,7 @@ CHARSET_INFO my_charset_big5_bin= ctype_big5, to_lower_big5, to_upper_big5, - sort_order_big5, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index cc83471f264..e759a5654f1 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -68,11 +68,22 @@ static uchar bin_char_array[] = +static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, uint slen, + const uchar *t, uint tlen, + my_bool t_is_prefix) +{ + uint len=min(slen,tlen); + int cmp= memcmp(s,t,len); + return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); +} + + /* Compare two strings. Result is sign(first_argument - second_argument) SYNOPSIS - my_strnncoll_binary() + my_strnncollsp_binary() cs Chararacter set s String to compare slen Length of 's' @@ -80,8 +91,9 @@ static uchar bin_char_array[] = tlen Length of 't' NOTE - This is used also when comparing with end space removal, as end space - is significant for binary strings + This function is used for real binary strings, i.e. for + BLOB, BINARY(N) and VARBINARY(N). + It does not ignore trailing spaces. RETURN < 0 s < t @@ -89,10 +101,18 @@ static uchar bin_char_array[] = > 0 s > t */ -static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, - my_bool t_is_prefix) +static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + return my_strnncoll_binary(cs,s,slen,t,tlen,0); +} + + +static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, uint slen, + const uchar *t, uint tlen, + my_bool t_is_prefix) { uint len=min(slen,tlen); int cmp= memcmp(s,t,len); @@ -100,11 +120,61 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen) +/* + Compare two strings. Result is sign(first_argument - second_argument) + + SYNOPSIS + my_strnncollsp_8bit_bin() + cs Chararacter set + s String to compare + slen Length of 's' + t String to compare + tlen Length of 't' + + NOTE + This function is used for character strings with binary collations. + It ignores trailing spaces. + + RETURN + < 0 s < t + 0 s == t + > 0 s > t +*/ + +static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a, uint a_length, + const uchar *b, uint b_length) { - return my_strnncoll_binary(cs,s,slen,t,tlen,0); + const uchar *end; + uint length; + + end= a + (length= min(a_length, b_length)); + while (a < end) + { + if (*a++ != *b++) + return ((int) a[-1] - (int) b[-1]); + } + if (a_length != b_length) + { + int swap= 0; + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put shorter key in s */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + return ((int) *a - (int) ' ') ^ swap; + } + } + return 0; } @@ -344,6 +414,20 @@ skip: MY_COLLATION_HANDLER my_collation_8bit_bin_handler = { NULL, /* init */ + my_strnncoll_8bit_bin, + my_strnncollsp_8bit_bin, + my_strnxfrm_bin, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_bin +}; + + +static MY_COLLATION_HANDLER my_collation_binary_handler = +{ + NULL, /* init */ my_strnncoll_binary, my_strnncollsp_binary, my_strnxfrm_bin, @@ -407,5 +491,5 @@ CHARSET_INFO my_charset_bin = 0, /* min_sort_char */ 255, /* max_sort_char */ &my_charset_handler, - &my_collation_8bit_bin_handler + &my_collation_binary_handler }; diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index fd8659a181c..bcf66e2a828 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8715,7 +8715,7 @@ CHARSET_INFO my_charset_euckr_bin= ctype_euc_kr, to_lower_euc_kr, to_upper_euc_kr, - sort_order_euc_kr, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index b9f61256717..e4e14259620 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5765,7 +5765,7 @@ CHARSET_INFO my_charset_gb2312_bin= ctype_gb2312, to_lower_gb2312, to_upper_gb2312, - sort_order_gb2312, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 2ef75e27d9a..80876cac41f 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9996,7 +9996,7 @@ CHARSET_INFO my_charset_gbk_bin= ctype_gbk, to_lower_gbk, to_upper_gbk, - sort_order_gbk, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 652794fa84d..f4717c51a1e 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -728,7 +728,7 @@ CHARSET_INFO my_charset_latin1_bin= ctype_latin1, to_lower_latin1, to_upper_latin1, - sort_order_latin1_de, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ cs_to_uni, /* tab_to_uni */ diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 7b0dadcfa19..ecafa6356d5 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -360,11 +360,62 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), return cmp ? cmp : (int) ((t_is_prefix ? len : slen) - tlen); } + +/* + Compare two strings. + + SYNOPSIS + my_strnncollsp_mb_bin() + cs Chararacter set + s String to compare + slen Length of 's' + t String to compare + tlen Length of 't' + + NOTE + This function is used for character strings with binary collations. + It ignores trailing spaces. + + RETURN + A negative number if s < t + A positive number if s > t + 0 if strings are equal +*/ + static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen) + const uchar *a, uint a_length, + const uchar *b, uint b_length) { - return my_strnncoll_mb_bin(cs,s,slen,t,tlen,0); + const uchar *end; + uint length; + + end= a + (length= min(a_length, b_length)); + while (a < end) + { + if (*a++ != *b++) + return ((int) a[-1] - (int) b[-1]); + } + if (a_length != b_length) + { + int swap= 0; + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put shorter key in s */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + return ((int) *a - (int) ' ') ^ swap; + } + } + return 0; } diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 5fd005f842e..65d096b96fc 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4615,7 +4615,7 @@ CHARSET_INFO my_charset_sjis_bin= ctype_sjis, to_lower_sjis, to_upper_sjis, - sort_order_sjis, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index c7d859a6ead..60f02e3146d 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -988,7 +988,7 @@ CHARSET_INFO my_charset_tis620_bin= ctype_tis620, to_lower_tis620, to_upper_tis620, - sort_order_tis620, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 20a5ff58d3a..645e2e49fc1 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1480,7 +1480,7 @@ CHARSET_INFO my_charset_ucs2_bin= ctype_ucs2, /* ctype */ to_lower_ucs2, /* to_lower */ to_upper_ucs2, /* to_upper */ - to_upper_ucs2, /* sort_order */ + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 3f53a07f527..746c31f37a0 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8502,7 +8502,7 @@ CHARSET_INFO my_charset_ujis_bin= ctype_ujis, to_lower_ujis, to_upper_ujis, - sort_order_ujis, + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index bf2d8a17fb4..f7a70afcb92 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2125,7 +2125,7 @@ CHARSET_INFO my_charset_utf8_bin= ctype_utf8, /* ctype */ to_lower_utf8, /* to_lower */ to_upper_utf8, /* to_upper */ - to_upper_utf8, /* sort_order */ + NULL, /* sort_order */ NULL, /* contractions */ NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 784c4762724..71b5f345fda 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -27,7 +27,7 @@ %#[l]d %#[l]u %#[l]x - %#.#s Note #.# is skiped + %#.#s Note first # is ignored RETURN length of result string @@ -47,7 +47,7 @@ int my_snprintf(char* to, size_t n, const char* fmt, ...) int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; - uint length, num_state, pre_zero, have_long; + uint length, width, pre_zero, have_long; for (; *fmt ; fmt++) { @@ -62,23 +62,18 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) /* Read max fill size (only used with %d and %u) */ if (*fmt == '-') fmt++; - length= num_state= pre_zero= have_long= 0; - for (;; fmt++) + length= width= pre_zero= have_long= 0; + for (;my_isdigit(&my_charset_latin1,*fmt); fmt++) { - if (my_isdigit(&my_charset_latin1,*fmt)) - { - if (!num_state) - { - length=length*10+ (uint) (*fmt-'0'); - if (!length) - pre_zero= 1; /* first digit was 0 */ - } - continue; - } - if (*fmt != '.' || num_state) - break; - num_state= 1; + length=length*10+ (uint) (*fmt-'0'); + if (!length) + pre_zero= 1; /* first digit was 0 */ } + if (*fmt == '.') + for (fmt++;my_isdigit(&my_charset_latin1,*fmt); fmt++) + width=width*10+ (uint) (*fmt-'0'); + else + width= ~0; if (*fmt == 'l') { fmt++; @@ -90,6 +85,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) uint plen,left_len = (uint)(end-to)+1; if (!par) par = (char*)"(null)"; plen = (uint) strlen(par); + set_if_smaller(plen,width); if (left_len <= plen) plen = left_len - 1; to=strnmov(to,par,plen); diff --git a/support-files/MySQL-shared-compat.spec.sh b/support-files/MySQL-shared-compat.spec.sh index 2a257a601a1..068daadab58 100644 --- a/support-files/MySQL-shared-compat.spec.sh +++ b/support-files/MySQL-shared-compat.spec.sh @@ -26,8 +26,8 @@ # # Change this to match the version of the shared libs you want to include # -%define version4 @VERSION@ -%define version3 3.23.56 +%define version4 @MYSQL_NO_DASH_VERSION@ +%define version3 3.23.58 Name: MySQL-shared-compat Packager: Lenz Grimmer <build@mysql.com> diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 35e8b647522..c13ee6774e3 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -284,7 +284,18 @@ mv sql/mysqld sql/mysqld-max nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym # Install embedded server library in the build root -install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql +install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql/ + +# Include libgcc.a in the devel subpackage (BUG 4921) +if [ "$CC" = gcc ] +then + libgcc=`$CC --print-libgcc-file` + if [ -f $libgcc ] + then + %define have_libgcc 1 + install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a + fi +fi # Save libraries (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) @@ -448,7 +459,7 @@ fi %files server %defattr(-,root,root,0755) -%doc COPYING README +%doc COPYING README %doc Docs/manual.{html,ps,texi,txt} %doc Docs/manual_toc.html %doc support-files/my-*.cnf @@ -535,6 +546,7 @@ fi %files devel %defattr(-, root, root, 0755) +%doc EXCEPTIONS-CLIENT %attr(755, root, root) %{_bindir}/comp_err %attr(755, root, root) %{_bindir}/mysql_config %dir %attr(755, root, root) %{_includedir}/mysql @@ -543,6 +555,9 @@ fi %{_libdir}/mysql/libdbug.a %{_libdir}/mysql/libheap.a %{_libdir}/mysql/libmerge.a +%if %{have_libgcc} +%{_libdir}/mysql/libmygcc.a +%endif %{_libdir}/mysql/libmyisam.a %{_libdir}/mysql/libmyisammrg.a %{_libdir}/mysql/libmysqlclient.a @@ -579,6 +594,19 @@ fi # The spec file changelog only includes changes made to the spec file # itself %changelog +* Tue Aug 10 2004 Lenz Grimmer <lenz@mysql.com> + +- Added libmygcc.a to the devel subpackage (required to link applications + against the the embedded server libmysqld.a) (BUG 4921) + +* Mon Aug 09 2004 Lenz Grimmer <lenz@mysql.com> + +- Added EXCEPTIONS-CLIENT to the "devel" package + +* Mon Apr 05 2004 Lenz Grimmer <lenz@mysql.com> + +- added ncurses-devel to the build prerequisites (BUG 3377) + * Thu Jul 29 2004 Lenz Grimmer <lenz@mysql.com> - disabled OpenSSL in the Max binaries again (the RPM packages were the @@ -594,10 +622,6 @@ fi - added mysql_tzinfo_to_sql to the server subpackage - run "make clean" instead of "make distclean" -* Mon Apr 05 2004 Lenz Grimmer <lenz@mysql.com> - -- added ncurses-devel to the build prerequisites (BUG 3377) - * Thu Feb 12 2004 Lenz Grimmer <lenz@mysql.com> - when using gcc, _always_ use CXX=gcc |