diff --git a/.bzrignore b/.bzrignore index 9eae1ed2545..e9e207dc35c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -197,3 +197,4 @@ bdb/build_win32/db.h bdb/dist/configure bdb/dist/tags bdb/build_unix/* +sql/.gdbinit diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium index 4ece8b1f321..aa013c85d30 100755 --- a/BUILD/compile-pentium +++ b/BUILD/compile-pentium @@ -7,11 +7,6 @@ extra_flags="$pentium_cflags $fast_cflags" extra_configs="$pentium_configs" strip=yes -# Use the optimized version if it exists -if test -d /usr/local/BerkeleyDB-opt/ -then - extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-opt/" -fi -extra_configs="$extra_configs --with-innobase" +extra_configs="$extra_configs --with-berkeley-db --with-innobase" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug index 2c5e867471b..2800ace97c5 100755 --- a/BUILD/compile-pentium-debug +++ b/BUILD/compile-pentium-debug @@ -8,11 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings" extra_configs="$pentium_configs $debug_configs" -# Use the debug version if it exists -if test -d /usr/local/BerkeleyDB-dbug/ -then - extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-dbug/" -fi -extra_configs="$extra_configs --with-innobase" +extra_configs="$extra_configs --with-berkeley-db --with-innobase" . "$path/FINISH.sh" diff --git a/Docs/manual.texi b/Docs/manual.texi index 07a4f2ef431..a63c0dfb7c6 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -595,7 +595,7 @@ Replication in MySQL * Replication Options:: Replication Options in my.cnf * Replication SQL:: SQL Commands related to replication * Replication FAQ:: Frequently Asked Questions about replication -* Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication +* Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication Getting Maximum Performance from MySQL @@ -895,6 +895,7 @@ Changes in release 4.0.x (Development; Alpha) Changes in release 3.23.x (Stable) +* News-3.23.34a:: * News-3.23.34:: Changes in release 3.23.34 * News-3.23.33:: Changes in release 3.23.33 * News-3.23.32:: Changes in release 3.23.32 @@ -5679,7 +5680,7 @@ To install the HP-UX tar.gz distribution, you must have a copy of GNU @cindex installing, source distribution -@cindex source distribtuion, installing +@cindex source distribution, installing @cindex installation overview @node Installing source, Installing source tree, Installing binary, Installing @section Installing a MySQL Source Distribution @@ -23596,7 +23597,7 @@ The @code{GEMINI} table type is developed and supported by NuSphere Corporation (@uref{http://www.nusphere.com}). It features row-level locking, transaction support (@code{COMMIT} and @code{ROLLBACK}), and automatic crash recovery. -@code{GEMINI} tables will be included in the @strong{MySQL} 4.0 source +@code{GEMINI} tables will be included in the @strong{MySQL} 3.23.35 source distribution. @node GEMINI start, GEMINI features, GEMINI overview, GEMINI @@ -23674,10 +23675,10 @@ NuSphere is working on removing these limitations. @subsection INNOBASE Tables overview Innobase is included in the @strong{MySQL} source distribution starting -from 3.23.34 and will be activated in the @strong{MySQL}-max binary. +from 3.23.34a and will be activated in the @strong{MySQL}-max binary. If you have downloaded a binary version of @strong{MySQL} that includes -support for Berkeley DB, simply follow the instructions for +support for Innobase, simply follow the instructions for installing a binary version of @strong{MySQL}. @xref{Installing binary}. To compile @strong{MySQL} with Innobase support, download @strong{MySQL} @@ -23686,7 +23687,7 @@ To compile @strong{MySQL} with Innobase support, download @strong{MySQL} @example cd /path/to/source/of/mysql-3.23.34 -./configure --with-berkeley-db +./configure --with-innobase @end example Innobase provides MySQL with a transaction safe table handler with @@ -26624,7 +26625,7 @@ tables}. * Replication Options:: Replication Options in my.cnf * Replication SQL:: SQL Commands related to replication * Replication FAQ:: Frequently Asked Questions about replication -* Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication +* Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication @end menu @node Replication Intro, Replication Implementation, Replication, Replication @@ -40254,6 +40255,12 @@ If a test fails totally, you should check the logs file in the @item If you have compiled @strong{MySQL} with debugging you can try to debug this with the @code{--gdb} and @code{--debug} options to @code{mysql-test-run}. +@xref{Making trace files}. + +If you have not compiled @strong{MySQL} for debugging you should probably +do that. Just specify the @code{--with-debug} options to @code{configure}! +@xref{Installing source}. + @end itemize @page @@ -42049,6 +42056,7 @@ users uses this code as the rest of the code and because of this we are not yet 100 % confident in this code. @menu +* News-3.23.34a:: * News-3.23.34:: Changes in release 3.23.34 * News-3.23.33:: Changes in release 3.23.33 * News-3.23.32:: Changes in release 3.23.32 @@ -42086,7 +42094,13 @@ not yet 100 % confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.34, News-3.23.33, News-3.23.x, News-3.23.x +@node News-3.23.34a, News-3.23.34, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.34a +@itemize @bullet +Add extra files to distribution to allow one to compile Innobase. +@end itemize + +@node News-3.23.34, News-3.23.33, News-3.23.34a, News-3.23.x @appendixsubsec Changes in release 3.23.34 @itemize @bullet @item @@ -42133,6 +42147,8 @@ Fixed bug in bi-directonal replication. Fixed bug in @code{BDB} tables when using index on multi-part key where a key part may be @code{NULL}. @item +Fixed @code{MAX()} optimization on sub-key for @code{BDB} tables. +@item Fixed problem with 'garbage results' when using @code{BDB} tables and @code{BLOB} or @code{TEXT} fields when joining many tables. @item @@ -47046,6 +47062,12 @@ in some cases the @code{PROCEDURE} will not transform the columns. @item Creation of a table of type @code{MERGE} doesn't check if the underlying tables are of compatible types. +@item +@strong{MySQL} can't yet handle @code{NaN}, @code{-Inf} and @code{Inf} +values in double. Using these will cause problems when trying to export +and import data. We should as a intermediate solution change @code{NaN} to +@code{NULL} (if possible) and @code{-Inf} and @code{Inf} to the +Minimum respective maximum possible @code{double} value. @end itemize The following are known bugs in earlier versions of @strong{MySQL}: @@ -47186,6 +47208,11 @@ characters in database, table and column names. @item Add a portable interface over @code{gethostbyaddr_r()} so that we can change @code{ip_to_hostname()} to not block other threads while doing DNS lookups. +@item +Add @code{record_in_range()} method to @code{MERGE} tables to be +able to choose the right index when there is many to choose from. We should +also extend the info interface to get the key distribution for each index, +of @code{analyze} is run on all sub tables. @end itemize @node TODO future, TODO sometime, TODO MySQL 4.0, TODO @@ -47677,7 +47704,7 @@ send mail to @email{mysql@@lists.mysql.com} and ask for help. Please use the If you can cause the @code{mysqld} server to crash quickly, you can try to create a trace file of this: -Start the @code{mysqld} server with a trace log in @file{/tmp/mysql.trace}. +Start the @code{mysqld} server with a trace log in @file{/tmp/mysqld.trace}. The log file will get very @emph{BIG}. @code{mysqld --debug --log} diff --git a/client/mysql.cc b/client/mysql.cc index d140e524094..8935e459f68 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -39,7 +39,7 @@ #include "my_readline.h" #include -const char *VER="11.12"; +const char *VER="11.13"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -1518,6 +1518,22 @@ com_ego(String *buffer,char *line) return result; } +static void +print_field_types(MYSQL_RES *result) +{ + MYSQL_FIELD *field; + while ((field = mysql_fetch_field(result))) + { + tee_fprintf(PAGER,"%s '%s' %d %d %d %d %d\n", + field->name, + field->table ? "" : field->table, + (int) field->type, + field->length, field->max_length, + field->flags, field->decimals); + } + tee_puts("", PAGER); +} + static void print_table_data(MYSQL_RES *result) @@ -1528,6 +1544,11 @@ print_table_data(MYSQL_RES *result) bool *num_flag; num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); + if (info_flag) + { + print_field_types(result); + mysql_field_seek(result,0); + } separator.copy("+",1); while ((field = mysql_fetch_field(result))) { diff --git a/client/mysqladmin.c b/client/mysqladmin.c index a8bda38d8cc..b09f799c683 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -28,9 +28,9 @@ #include /* because of signal() */ #endif -#define ADMIN_VERSION "8.17" +#define ADMIN_VERSION "8.18" #define MAX_MYSQL_VAR 64 -#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */ +#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH]; @@ -40,7 +40,7 @@ static int interval=0; static my_bool option_force=0,interrupted=0,new_line=0, opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0; static uint tcp_port = 0, option_wait = 0, option_silent=0; -static ulong opt_connect_timeout; +static ulong opt_connect_timeout, opt_shutdown_timeout; static my_string unix_port=0; /* When using extended-status relatively, ex_val_max_len is the estimated @@ -134,6 +134,8 @@ static struct option long_options[] = { CHANGEABLE_VAR changeable_vars[] = { { "connect_timeout", (long*) &opt_connect_timeout, 0, 0, 3600*12, 0, 1}, + { "shutdown_timeout", (long*) &opt_shutdown_timeout, SHUTDOWN_DEF_TIMEOUT, 0, + 3600*12, 0, 1}, { 0, 0, 0, 0, 0, 0, 0} }; @@ -148,6 +150,7 @@ int main(int argc,char *argv[]) MY_INIT(argv[0]); mysql_init(&mysql); load_defaults("my",load_default_groups,&argc,&argv); + set_all_changeable_vars( changeable_vars ); while ((c=getopt_long(argc,argv,"h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:", long_options, &option_index)) != EOF) @@ -1125,7 +1128,7 @@ static void wait_pidfile(char *pidfile) uint count=0; system_filename(buff,pidfile); - while ((fd = open(buff, O_RDONLY)) >= 0 && count++ < MAX_TIME_TO_WAIT) + while ((fd = open(buff, O_RDONLY)) >= 0 && count++ < opt_shutdown_timeout) { close(fd); sleep(1); diff --git a/configure.in b/configure.in index 908cfcd67a9..05392da9a61 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.34) +AM_INIT_AUTOMAKE(mysql, 3.23.34a) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/innobase/mem/Makefile.am b/innobase/mem/Makefile.am index 89076f76f3b..84f642e4469 100644 --- a/innobase/mem/Makefile.am +++ b/innobase/mem/Makefile.am @@ -21,4 +21,6 @@ libs_LIBRARIES = libmem.a libmem_a_SOURCES = mem0mem.c mem0pool.c +EXTRA_DIST = mem0dbg.c + EXTRA_PROGRAMS = diff --git a/innobase/pars/Makefile.am b/innobase/pars/Makefile.am index d39430862a7..e5611f9dfc6 100644 --- a/innobase/pars/Makefile.am +++ b/innobase/pars/Makefile.am @@ -19,6 +19,8 @@ include ../include/Makefile.i libs_LIBRARIES = libpars.a +noinst_HEADERS = pars0grm.h + libpars_a_SOURCES = pars0grm.c lexyy.c pars0opt.c pars0pars.c pars0sym.c EXTRA_PROGRAMS = diff --git a/mysql-test/README b/mysql-test/README index 6ad59ea6a8b..c5dc3e219de 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -6,7 +6,10 @@ actually have a co-existing MySQL installation - the tests will not conflict with it. All tests must pass. If one or more of them fail on your system, please -report the details to bugs@lists.mysql.com +read the following manual section of how to report the problem: + +http://www.mysql.com/doc/M/y/MySQL_test_suite.html + You can create your own test cases. To create a test case: diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index fb247000be7..1b7d1c26f30 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -450,14 +450,14 @@ stop_slave () { if [ x$SLAVE_RUNNING = x1 ] then - $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root shutdown + $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O shutdown_timeout=10 shutdown if [ $? != 0 ] && [ -f $SLAVE_MYPID ] then # try harder! $ECHO "slave not cooperating with mysqladmin, will try manual kill" kill `$CAT $SLAVE_MYPID` sleep $SLEEP_TIME if [ -f $SLAVE_MYPID ] ; then - $ECHO "slave refused to die, resorting to SIGKILL murder" + $ECHO "slave refused to die. Sending SIGKILL" kill -9 `$CAT $SLAVE_MYPID` $RM -f $SLAVE_MYPID else @@ -472,14 +472,14 @@ stop_master () { if [ x$MASTER_RUNNING = x1 ] then - $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root shutdown + $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O shutdown_timeout=10 shutdown if [ $? != 0 ] && [ -f $MASTER_MYPID ] then # try harder! $ECHO "master not cooperating with mysqladmin, will try manual kill" kill `$CAT $MASTER_MYPID` sleep $SLEEP_TIME if [ -f $MASTER_MYPID ] ; then - $ECHO "master refused to die, resorting to SIGKILL murder" + $ECHO "master refused to die. Sending SIGKILL" kill -9 `$CAT $MASTER_MYPID` $RM -f $MASTER_MYPID else diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index 42d14e1c34f..2e760ae5b75 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -490,3 +490,5 @@ a 2 a b a 1 a 2 +MIN(B) MAX(b) +1 1 diff --git a/mysql-test/r/innobase.result b/mysql-test/r/innobase.result index 577bfcbf5b2..6c45bfd810d 100644 --- a/mysql-test/r/innobase.result +++ b/mysql-test/r/innobase.result @@ -443,3 +443,5 @@ i j 1 2 i j 1 2 +MIN(B) MAX(b) +1 1 diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 900260217d5..564491fc520 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -664,3 +664,17 @@ SELECT * FROM t1 WHERE a='a' AND b=2; SELECT * FROM t1 WHERE a='a' AND b in (2); SELECT * FROM t1 WHERE a='a' AND b in (1,2); drop table t1; + +# +# Test min-max optimization +# + +CREATE TABLE t1 ( + a int3 unsigned NOT NULL, + b int1 unsigned NOT NULL, + UNIQUE (a, b) +) TYPE = BDB; + +INSERT INTO t1 VALUES (1, 1); +SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; +drop table t1; diff --git a/mysql-test/t/innobase.test b/mysql-test/t/innobase.test index bca10751c13..4fa8d07bd52 100644 --- a/mysql-test/t/innobase.test +++ b/mysql-test/t/innobase.test @@ -394,3 +394,17 @@ select * from t1 where i=1 and j=2; create index ax1 on t1 (i,j); select * from t1 where i=1 and j=2; drop table t1; + +# +# Test min-max optimization +# + +CREATE TABLE t1 ( + a int3 unsigned NOT NULL, + b int1 unsigned NOT NULL, + UNIQUE (a, b) +) TYPE = innobase; + +INSERT INTO t1 VALUES (1, 1); +SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; +drop table t1; diff --git a/sql-bench/TODO b/sql-bench/TODO new file mode 100644 index 00000000000..8a103e89199 --- /dev/null +++ b/sql-bench/TODO @@ -0,0 +1,21 @@ +When comparing with ms-sql: + +Check how to get MySQL faster mysql ms-sql + +count_distinct (2000) | 89.00| 39.00| +count_distinct_big (120) | 324.00| 121.00| +count_distinct_group (1000) | 158.00| 107.00| +count_distinct_group_on_key (1000) | 49.00| 17.00| +count_distinct_group_on_key_parts (1| 157.00| 108.00| +order_by_big (10) | 197.00| 89.00| +order_by_big_key (10) | 170.00| 82.00| +order_by_big_key2 (10) | 163.00| 73.00| +order_by_big_key_desc (10) | 172.00| 84.00| +order_by_big_key_diff (10) | 193.00| 89.00| +order_by_big_key_prefix (10) | 165.00| 72.00| + + +Why is the following slow on NT: + NT Linux +update_of_primary_key_many_keys (256| 560.00| 65.00| + diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh index d18d2c79ced..165b15a0ede 100644 --- a/sql-bench/bench-init.pl.sh +++ b/sql-bench/bench-init.pl.sh @@ -31,7 +31,7 @@ # $server Object for current server # $limits Hash reference to limits for benchmark -$benchmark_version="2.11a"; +$benchmark_version="2.12"; use Getopt::Long; require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n"; diff --git a/sql-bench/run-all-tests.sh b/sql-bench/run-all-tests.sh index cbcafce3117..31d48c837df 100644 --- a/sql-bench/run-all-tests.sh +++ b/sql-bench/run-all-tests.sh @@ -36,11 +36,6 @@ use DBI; $opt_silent=1; # Don't write header -$prog_args=""; -foreach $arg (@ARGV) -{ - $prog_args.="'" . $arg . "' "; -} chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; @@ -50,6 +45,20 @@ $machine=machine(); $redirect= !($machine =~ /windows/i || $machine =~ "^NT\s") ? "2>&1" : ""; $dir= ($pwd =~ /\\/) ? '\\' : '/'; # directory symbol for shell +$prog_args=""; +foreach $arg (@ARGV) +{ + if ($redirect) + { + $prog_args.="'" . $arg . "' "; + } + else + { + # Windows/NT can't handle ' around arguments + $prog_args.=$arg . " "; + } +} + $prog_count=$errors=0; if ($opt_cmp) { diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 8ede6022cfc..bfd9d7ce758 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -194,6 +194,11 @@ sub new { $limits{'working_blobs'} = 0; # HEAP tables can't handle BLOB's } + if (defined($main::opt_create_options) && + $main::opt_create_options =~ /type=innobase/i) + { + $limits{'max_text_size'} = 8000; # Limit in Innobase + } return $self; } diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh index e75ee26fff8..3c7efe3c5c2 100644 --- a/sql-bench/test-select.sh +++ b/sql-bench/test-select.sh @@ -130,6 +130,37 @@ if ($opt_lock_tables) select_test: +if ($limits->{'group_functions'}) +{ + my ($tmp); $tmp=1000; + print "Test if the database has a query cache\n"; + + # First ensure that the table is read into memory + fetch_all_rows($dbh,"select sum(idn+$tmp),sum(rev_idn+$tmp) from bench1"); + + $loop_time=new Benchmark; + for ($tests=0 ; $tests < $opt_loop_count ; $tests++) + { + fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1"); + } + $end_time=new Benchmark; + print "Time for select_query_cache ($opt_loop_count): " . + timestr(timediff($end_time, $loop_time),"all") . "\n\n"; + + # If the database has a query cache, the following loop should be much + # slower than the previous loop + + $loop_time=new Benchmark; + for ($tests=0 ; $tests < $opt_loop_count ; $tests++) + { + fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1"); + } + $end_time=new Benchmark; + print "Time for select_query_cache2 ($opt_loop_count): " . + timestr(timediff($end_time, $loop_time),"all") . "\n\n"; +} + + print "Testing big selects on the table\n"; $loop_time=new Benchmark; $rows=0; @@ -288,8 +319,21 @@ if ($limits->{'group_distinct_functions'}) $rows=$estimated=$count=0; for ($i=0 ; $i < $opt_medium_loop_count ; $i++) { - $count+=2; + $count++; $rows+=fetch_all_rows($dbh,"select count(distinct region) from bench1"); + $end_time=new Benchmark; + last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1, + $opt_medium_loop_count)); + } + print_time($estimated); + print " for count_distinct_key_prefix ($count:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + + $loop_time=new Benchmark; + $rows=$estimated=$count=0; + for ($i=0 ; $i < $opt_medium_loop_count ; $i++) + { + $count++; $rows+=fetch_all_rows($dbh,"select count(distinct grp) from bench1"); $end_time=new Benchmark; last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1, @@ -299,6 +343,20 @@ if ($limits->{'group_distinct_functions'}) print " for count_distinct ($count:$rows): " . timestr(timediff($end_time, $loop_time),"all") . "\n"; + $loop_time=new Benchmark; + $rows=$estimated=$count=0; + for ($i=0 ; $i < $opt_medium_loop_count ; $i++) + { + $count++; + $rows+=fetch_all_rows($dbh,"select count(distinct grp),count(distinct rev_idn) from bench1"); + $end_time=new Benchmark; + last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1, + $opt_medium_loop_count)); + } + print_time($estimated); + print " for count_distinct_2 ($count:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + $loop_time=new Benchmark; $rows=$estimated=$count=0; for ($i=0 ; $i < $opt_medium_loop_count ; $i++) diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 3f6b2629e16..10ff4dcc260 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1429,7 +1429,12 @@ int ha_berkeley::index_read(byte * buf, const byte * key, pack_key(&last_key, active_index, key_buff, key, key_len); /* Store for compare */ memcpy(key_buff2, key_buff, (key_len=last_key.size)); - key_info->handler.bdb_return_if_eq= -1; + /* + If HA_READ_AFTER_KEY is set, return next key, else return first + matching key. + */ + key_info->handler.bdb_return_if_eq= (find_flag == HA_READ_AFTER_KEY ? + 1 : -1); error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE), (char*) buf, active_index, &row, (DBT*) 0, 0); key_info->handler.bdb_return_if_eq= 0; diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 73991be208d..7ce22e70dcb 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -72,16 +72,18 @@ class ha_innobase: public handler /* Init values for the class: */ public: ha_innobase(TABLE *table): handler(table), - int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | - HA_REC_NOT_IN_SEQ | - HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER | - HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY | - HA_LONGLONG_KEYS | HA_NULL_KEY | - HA_NOT_EXACT_COUNT | - HA_NO_WRITE_DELAYED | - HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE), - last_dup_key((uint) -1), - start_of_scan(0) + int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | + HA_REC_NOT_IN_SEQ | + HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER | + HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY | + HA_LONGLONG_KEYS | HA_NULL_KEY | + HA_NOT_EXACT_COUNT | + HA_NO_WRITE_DELAYED | + HA_PRIMARY_KEY_IN_READ_INDEX | + HA_DROP_BEFORE_CREATE | + HA_NOT_READ_AFTER_KEY), + last_dup_key((uint) -1), + start_of_scan(0) { } ~ha_innobase() {} diff --git a/sql/ha_isam.h b/sql/ha_isam.h index c8305c655ef..b255e8ba87f 100644 --- a/sql/ha_isam.h +++ b/sql/ha_isam.h @@ -33,7 +33,8 @@ class ha_isam: public handler int_option_flag(HA_READ_NEXT+HA_READ_PREV+HA_READ_RND_SAME+ HA_KEYPOS_TO_RNDPOS+ HA_READ_ORDER+ HA_LASTKEY_ORDER+ HA_HAVE_KEY_READ_ONLY+HA_READ_NOT_EXACT_KEY+ - HA_LONGLONG_KEYS+HA_KEY_READ_WRONG_STR + HA_DUPP_POS) + HA_LONGLONG_KEYS+HA_KEY_READ_WRONG_STR + HA_DUPP_POS + + HA_NOT_DELETE_WITH_CACHE) {} ~ha_isam() {} const char *table_type() const { return "ISAM"; } diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index c4393ea8c5d..af35c0269c4 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -484,7 +484,8 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) } break; } - if (!error && start_records != file->state->records) + if (!error && start_records != file->state->records && + !(check_opt->flags & T_VERY_SILENT)) { char llbuff[22],llbuff2[22]; sql_print_error("Warning: Found %s of %s rows when repairing '%s'", diff --git a/sql/handler.h b/sql/handler.h index 8cecd1fe171..1c8a83ac9ed 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -70,6 +70,8 @@ #define HA_NO_WRITE_DELAYED (HA_NOT_EXACT_COUNT*2) #define HA_PRIMARY_KEY_IN_READ_INDEX (HA_NO_WRITE_DELAYED*2) #define HA_DROP_BEFORE_CREATE (HA_PRIMARY_KEY_IN_READ_INDEX*2) +#define HA_NOT_READ_AFTER_KEY (HA_DROP_BEFORE_CREATE*2) +#define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2) /* Parameters for open() (in register form->filestat) */ /* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */ diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 7348563cee6..a975cab3c7c 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -595,7 +595,7 @@ void change_byte(byte *,uint,char,char); void unireg_abort(int exit_code); void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, SQL_SELECT *select, - bool use_record_cache, bool print_errors); + int use_record_cache, bool print_errors); void end_read_record(READ_RECORD *info); ha_rows filesort(TABLE **form,struct st_sort_field *sortorder, uint s_length, SQL_SELECT *select, ha_rows special,ha_rows max_rows); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a25ac8bdbfb..2f672c6f409 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2716,6 +2716,14 @@ struct show_var_st init_vars[]= { {"have_raid", (char*) &have_raid, SHOW_HAVE}, {"have_ssl", (char*) &have_ssl, SHOW_HAVE}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, +#ifdef HAVE_INNOBASE_DB + {"innobase_data_file_path", innobase_data_file_path, SHOW_CHAR}, + {"innobase_data_home_dir", innobase_data_home_dir, SHOW_CHAR}, + {"innobase_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_MY_BOOL}, + {"innobase_log_arch_dir", innobase_log_arch_dir, SHOW_CHAR}, + {"innobase_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, + {"innobase_log_group_home_dir", innobase_log_group_home_dir, SHOW_CHAR}, +#endif {"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG}, {"join_buffer_size", (char*) &join_buff_size, SHOW_LONG}, {"key_buffer_size", (char*) &keybuff_size, SHOW_LONG}, @@ -2961,12 +2969,19 @@ static void usage(void) --bdb-tmpdir=directory Berkeley DB tempfile name\n\ --skip-bdb Don't use berkeley db (will save memory)\n\ "); -#endif +#endif /* HAVE_BERKELEY_DB */ #ifdef HAVE_INNOBASE_DB puts("\ - --skip-innobase Don't use innobase (will save memory)\n\ + --innobase_data_home_dir=dir The common part for innobase table spaces\n + --innobase_data_file_path=dir Path to individual files and their sizes\n + --innobase_flush_log_at_trx_commit[=#] + Set to 0 if you don't want to flush logs\n\ + --innobase_log_arch_dir=dir Where full logs should be archived\n\ + --innobase_log_archive[=#] Set to 1 if you want to have logs archived\n\ + --innobase_log_group_home_dir=dir Path to Innobase log files. + --skip-innobase Don't use innobase (will save memory)\n\ "); -#endif +#endif /* HAVE_INNOBASE_DB */ print_defaults("my",load_default_groups); puts(""); diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index d56bf68db62..df49d52d54a 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -141,6 +141,11 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) break; } TABLE *table=((Item_field*) expr)->field->table; + if ((table->file->option_flag() & HA_NOT_READ_AFTER_KEY)) + { + const_result=0; + break; + } bool error=table->file->index_init((uint) ref.key); if (!ref.key_length) diff --git a/sql/records.cc b/sql/records.cc index 89eae81fe27..e6f76e7fec6 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -31,7 +31,7 @@ static int rr_cmp(uchar *a,uchar *b); void init_read_record(READ_RECORD *info,THD *thd, TABLE *table, SQL_SELECT *select, - bool use_record_cache, bool print_error) + int use_record_cache, bool print_error) { IO_CACHE *tempfile; DBUG_ENTER("init_read_record"); @@ -97,9 +97,11 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table, info->read_record=rr_sequential; table->file->rnd_init(); /* We can use record cache if we don't update dynamic length tables */ - if (use_record_cache || + if (use_record_cache > 0 || (int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY || - !(table->db_options_in_use & HA_OPTION_PACK_RECORD)) + !(table->db_options_in_use & HA_OPTION_PACK_RECORD) || + (use_record_cache < 0 && + !(table->file->option_flag() & HA_NOT_DELETE_WITH_CACHE))) VOID(table->file->extra(HA_EXTRA_CACHE)); // Cache reads } DBUG_VOID_RETURN; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index fc150b08a69..c20a656c547 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -192,7 +192,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, (void) table->file->extra(HA_EXTRA_NO_READCHECK); if (options & OPTION_QUICK) (void) table->file->extra(HA_EXTRA_QUICK); - init_read_record(&info,thd,table,select,0,1); + init_read_record(&info,thd,table,select,-1,1); ulong deleted=0L; thd->proc_info="updating"; while (!(error=info.read_record(&info)) && !thd->killed) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ca36cb9f205..b8d2ee13b0e 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -250,7 +250,8 @@ static char *get_text(LEX *lex) str=lex->tok_start+1; end=lex->ptr-1; - start=(uchar*) sql_alloc((uint) (end-str)+1); + if (!(start=(uchar*) sql_alloc((uint) (end-str)+1))) + return (char*) ""; // Sql_alloc has set error flag if (!found_escape) { lex->yytoklen=(uint) (end-str); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 4d6a2e79fc3..ed109127e30 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1027,6 +1027,7 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list) "backup", TL_READ, 0, 0, 0, &handler::backup)); } + int mysql_restore_table(THD* thd, TABLE_LIST* table_list) { DBUG_ENTER("mysql_restore_table");