Commit 97acb7b3 authored by unknown's avatar unknown

Added new tests to benchmark suite


Docs/manual.texi:
  Updated some typos in the innobase section
client/mysql.cc:
  Added print of field types (for debugging)
client/mysqladmin.c:
  Added timeout for shutdown
mysql-test/mysql-test-run.sh:
  Use timeout for shutdown
sql-bench/test-select.sh:
  Added test of query cache and new tests for count(distinct)
sql/ha_myisam.cc:
  Don't give warnings for RESTORE TABLE
sql/mysqld.cc:
  Added printing of innobase options
sql/sql_lex.cc:
  Fixed possible bug when OEM
sql/sql_table.cc:
  cleanup
parent 74ea7333
...@@ -23588,7 +23588,7 @@ The @code{GEMINI} table type is developed and supported by NuSphere Corporation ...@@ -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 (@uref{http://www.nusphere.com}). It features row-level locking, transaction
support (@code{COMMIT} and @code{ROLLBACK}), and automatic crash recovery. 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. distribution.
@node GEMINI start, GEMINI features, GEMINI overview, GEMINI @node GEMINI start, GEMINI features, GEMINI overview, GEMINI
...@@ -23669,7 +23669,7 @@ Innobase is included in the @strong{MySQL} source distribution starting ...@@ -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. 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 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}. installing a binary version of @strong{MySQL}. @xref{Installing binary}.
To compile @strong{MySQL} with Innobase support, download @strong{MySQL} To compile @strong{MySQL} with Innobase support, download @strong{MySQL}
...@@ -23678,7 +23678,7 @@ 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 @example
cd /path/to/source/of/mysql-3.23.34 cd /path/to/source/of/mysql-3.23.34
./configure --with-berkeley-db ./configure --with-innobase
@end example @end example
Innobase provides MySQL with a transaction safe table handler with Innobase provides MySQL with a transaction safe table handler with
...@@ -47192,6 +47192,11 @@ characters in database, table and column names. ...@@ -47192,6 +47192,11 @@ characters in database, table and column names.
@item @item
Add a portable interface over @code{gethostbyaddr_r()} so that we can change 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. @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 @end itemize
@node TODO future, TODO sometime, TODO MySQL 4.0, TODO @node TODO future, TODO sometime, TODO MySQL 4.0, TODO
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "my_readline.h" #include "my_readline.h"
#include <signal.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 */ /* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024 #define MAX_COLUMN_LENGTH 1024
...@@ -1518,6 +1518,22 @@ com_ego(String *buffer,char *line) ...@@ -1518,6 +1518,22 @@ com_ego(String *buffer,char *line)
return result; 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 static void
print_table_data(MYSQL_RES *result) print_table_data(MYSQL_RES *result)
...@@ -1528,6 +1544,11 @@ print_table_data(MYSQL_RES *result) ...@@ -1528,6 +1544,11 @@ print_table_data(MYSQL_RES *result)
bool *num_flag; bool *num_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); 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); separator.copy("+",1);
while ((field = mysql_fetch_field(result))) while ((field = mysql_fetch_field(result)))
{ {
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
#define ADMIN_VERSION "8.17" #define ADMIN_VERSION "8.18"
#define MAX_MYSQL_VAR 64 #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 #define MAX_TRUNC_LENGTH 3
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH]; char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
...@@ -40,7 +40,7 @@ static int interval=0; ...@@ -40,7 +40,7 @@ static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0, static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=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 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; static my_string unix_port=0;
/* When using extended-status relatively, ex_val_max_len is the estimated /* When using extended-status relatively, ex_val_max_len is the estimated
...@@ -134,6 +134,8 @@ static struct option long_options[] = { ...@@ -134,6 +134,8 @@ static struct option long_options[] = {
CHANGEABLE_VAR changeable_vars[] = { CHANGEABLE_VAR changeable_vars[] = {
{ "connect_timeout", (long*) &opt_connect_timeout, 0, 0, 3600*12, 0, 1}, { "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} { 0, 0, 0, 0, 0, 0, 0}
}; };
...@@ -148,6 +150,7 @@ int main(int argc,char *argv[]) ...@@ -148,6 +150,7 @@ int main(int argc,char *argv[])
MY_INIT(argv[0]); MY_INIT(argv[0]);
mysql_init(&mysql); mysql_init(&mysql);
load_defaults("my",load_default_groups,&argc,&argv); 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:", while ((c=getopt_long(argc,argv,"h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
...@@ -1125,7 +1128,7 @@ static void wait_pidfile(char *pidfile) ...@@ -1125,7 +1128,7 @@ static void wait_pidfile(char *pidfile)
uint count=0; uint count=0;
system_filename(buff,pidfile); 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); close(fd);
sleep(1); sleep(1);
......
...@@ -450,14 +450,14 @@ stop_slave () ...@@ -450,14 +450,14 @@ stop_slave ()
{ {
if [ x$SLAVE_RUNNING = x1 ] if [ x$SLAVE_RUNNING = x1 ]
then 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 ] if [ $? != 0 ] && [ -f $SLAVE_MYPID ]
then # try harder! then # try harder!
$ECHO "slave not cooperating with mysqladmin, will try manual kill" $ECHO "slave not cooperating with mysqladmin, will try manual kill"
kill `$CAT $SLAVE_MYPID` kill `$CAT $SLAVE_MYPID`
sleep $SLEEP_TIME sleep $SLEEP_TIME
if [ -f $SLAVE_MYPID ] ; then 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` kill -9 `$CAT $SLAVE_MYPID`
$RM -f $SLAVE_MYPID $RM -f $SLAVE_MYPID
else else
...@@ -472,14 +472,14 @@ stop_master () ...@@ -472,14 +472,14 @@ stop_master ()
{ {
if [ x$MASTER_RUNNING = x1 ] if [ x$MASTER_RUNNING = x1 ]
then 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 ] if [ $? != 0 ] && [ -f $MASTER_MYPID ]
then # try harder! then # try harder!
$ECHO "master not cooperating with mysqladmin, will try manual kill" $ECHO "master not cooperating with mysqladmin, will try manual kill"
kill `$CAT $MASTER_MYPID` kill `$CAT $MASTER_MYPID`
sleep $SLEEP_TIME sleep $SLEEP_TIME
if [ -f $MASTER_MYPID ] ; then 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` kill -9 `$CAT $MASTER_MYPID`
$RM -f $MASTER_MYPID $RM -f $MASTER_MYPID
else else
......
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|
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
# $server Object for current server # $server Object for current server
# $limits Hash reference to limits for benchmark # $limits Hash reference to limits for benchmark
$benchmark_version="2.11a"; $benchmark_version="2.12";
use Getopt::Long; use Getopt::Long;
require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n"; require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n";
......
...@@ -130,6 +130,37 @@ if ($opt_lock_tables) ...@@ -130,6 +130,37 @@ if ($opt_lock_tables)
select_test: 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"; print "Testing big selects on the table\n";
$loop_time=new Benchmark; $loop_time=new Benchmark;
$rows=0; $rows=0;
...@@ -288,8 +319,21 @@ if ($limits->{'group_distinct_functions'}) ...@@ -288,8 +319,21 @@ if ($limits->{'group_distinct_functions'})
$rows=$estimated=$count=0; $rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++) for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{ {
$count+=2; $count++;
$rows+=fetch_all_rows($dbh,"select count(distinct region) from bench1"); $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"); $rows+=fetch_all_rows($dbh,"select count(distinct grp) from bench1");
$end_time=new Benchmark; $end_time=new Benchmark;
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1, last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
...@@ -299,6 +343,20 @@ if ($limits->{'group_distinct_functions'}) ...@@ -299,6 +343,20 @@ if ($limits->{'group_distinct_functions'})
print " for count_distinct ($count:$rows): " . print " for count_distinct ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n"; 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; $loop_time=new Benchmark;
$rows=$estimated=$count=0; $rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++) for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
......
...@@ -484,7 +484,8 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -484,7 +484,8 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
} }
break; 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]; char llbuff[22],llbuff2[22];
sql_print_error("Warning: Found %s of %s rows when repairing '%s'", sql_print_error("Warning: Found %s of %s rows when repairing '%s'",
......
...@@ -2716,6 +2716,14 @@ struct show_var_st init_vars[]= { ...@@ -2716,6 +2716,14 @@ struct show_var_st init_vars[]= {
{"have_raid", (char*) &have_raid, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE},
{"have_ssl", (char*) &have_ssl, SHOW_HAVE}, {"have_ssl", (char*) &have_ssl, SHOW_HAVE},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"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}, {"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG}, {"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
{"key_buffer_size", (char*) &keybuff_size, SHOW_LONG}, {"key_buffer_size", (char*) &keybuff_size, SHOW_LONG},
...@@ -2961,12 +2969,19 @@ static void usage(void) ...@@ -2961,12 +2969,19 @@ static void usage(void)
--bdb-tmpdir=directory Berkeley DB tempfile name\n\ --bdb-tmpdir=directory Berkeley DB tempfile name\n\
--skip-bdb Don't use berkeley db (will save memory)\n\ --skip-bdb Don't use berkeley db (will save memory)\n\
"); ");
#endif #endif /* HAVE_BERKELEY_DB */
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
puts("\ puts("\
--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\ --skip-innobase Don't use innobase (will save memory)\n\
"); ");
#endif #endif /* HAVE_INNOBASE_DB */
print_defaults("my",load_default_groups); print_defaults("my",load_default_groups);
puts(""); puts("");
......
...@@ -250,7 +250,8 @@ static char *get_text(LEX *lex) ...@@ -250,7 +250,8 @@ static char *get_text(LEX *lex)
str=lex->tok_start+1; str=lex->tok_start+1;
end=lex->ptr-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) if (!found_escape)
{ {
lex->yytoklen=(uint) (end-str); lex->yytoklen=(uint) (end-str);
......
...@@ -1027,6 +1027,7 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list) ...@@ -1027,6 +1027,7 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list)
"backup", TL_READ, 0, 0, 0, "backup", TL_READ, 0, 0, 0,
&handler::backup)); &handler::backup));
} }
int mysql_restore_table(THD* thd, TABLE_LIST* table_list) int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
{ {
DBUG_ENTER("mysql_restore_table"); DBUG_ENTER("mysql_restore_table");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment