diff options
-rw-r--r-- | Docs/manual.texi | 11 | ||||
-rw-r--r-- | client/mysql.cc | 23 | ||||
-rw-r--r-- | client/mysqladmin.c | 11 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 8 | ||||
-rw-r--r-- | sql-bench/TODO | 21 | ||||
-rw-r--r-- | sql-bench/bench-init.pl.sh | 2 | ||||
-rw-r--r-- | sql-bench/test-select.sh | 60 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 21 | ||||
-rw-r--r-- | sql/sql_lex.cc | 3 | ||||
-rw-r--r-- | sql/sql_table.cc | 1 |
11 files changed, 145 insertions, 19 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 11e7908e232..7e4e734e687 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -23588,7 +23588,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 @@ -23669,7 +23669,7 @@ Innobase is included in the @strong{MySQL} source distribution starting from 3.23.34 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} @@ -23678,7 +23678,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 @@ -47192,6 +47192,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 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 <signal.h> -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 <my_pthread.h> /* 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/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/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/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, @@ -304,6 +348,20 @@ if ($limits->{'group_distinct_functions'}) 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++) + { + $count++; $rows+=fetch_all_rows($dbh,"select region,count(distinct idn) from bench1 group by region"); $end_time=new Benchmark; last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1, 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/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/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"); |