Commit 9612deef authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Merge

parents 2e453e7b 6d0e5290
...@@ -99,7 +99,7 @@ nusphere.pdf: manual.texi ...@@ -99,7 +99,7 @@ nusphere.pdf: manual.texi
manual_a4.ps: manual.texi include.texi manual_a4.ps: manual.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \ TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \ MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch --texinfo '@afourpaper' $< $(TEXI2DVI) --batch --texinfo --quiet '@afourpaper' $<
$(DVIPS) -t a4 manual.dvi -o $@ $(DVIPS) -t a4 manual.dvi -o $@
touch $@ touch $@
......
...@@ -713,7 +713,7 @@ Some Common Errors When Using MySQL ...@@ -713,7 +713,7 @@ Some Common Errors When Using MySQL
Solving Some Common Problems with MySQL Solving Some Common Problems with MySQL
* Log Replication:: Database replication with update log * Log Replication:: Database replication with update log
* Backup:: Database backups * Backup:: Database backups
* Update log:: The update log * Update log:: The update log
* Binary log:: The binary log * Binary log:: The binary log
...@@ -846,6 +846,7 @@ Changes in release 4.0.x (Development; Alpha) ...@@ -846,6 +846,7 @@ Changes in release 4.0.x (Development; Alpha)
Changes in release 3.23.x (Recommended; Gamma) Changes in release 3.23.x (Recommended; Gamma)
* News-3.23.31::
* News-3.23.30:: Changes in release 3.23.30 * News-3.23.30:: Changes in release 3.23.30
* News-3.23.29:: Changes in release 3.23.29 * News-3.23.29:: Changes in release 3.23.29
* News-3.23.28:: Changes in release 3.23.28 * News-3.23.28:: Changes in release 3.23.28
...@@ -9284,6 +9285,15 @@ The @code{mysql.server} script uses the following variables: ...@@ -9284,6 +9285,15 @@ The @code{mysql.server} script uses the following variables:
@code{user}, @code{datadir}, @code{basedir}, @code{bindir}, and @code{user}, @code{datadir}, @code{basedir}, @code{bindir}, and
@code{pid-file}. @code{pid-file}.
The following table shows which option sections each of the startup script
uses:
@multitable @columnfractions .20 .80
@item @code{mysqld} @tab @code{mysqld} and @code{server}
@item @code{mysql.server} @tab @code{mysql.server}, @code{mysqld} and @code{server}
@item @code{safe_mysqld} @tab @code{mysql.server}, @code{mysqld} and @code{server}
@end multitable
@xref{Option files}. @xref{Option files}.
@findex command-line options @findex command-line options
...@@ -20146,6 +20156,7 @@ below, though the format and numbers probably differ: ...@@ -20146,6 +20156,7 @@ below, though the format and numbers probably differ:
| Sort_scan | 5298 | | Sort_scan | 5298 |
| Threads_cached | 0 | | Threads_cached | 0 |
| Threads_connected | 1 | | Threads_connected | 1 |
| Threads_created | 30022 |
| Threads_running | 1 | | Threads_running | 1 |
| Uptime | 39613 | | Uptime | 39613 |
+--------------------------+------------+ +--------------------------+------------+
...@@ -20213,6 +20224,7 @@ open by the slave thread ...@@ -20213,6 +20224,7 @@ open by the slave thread
@item @code{Sort_scan} @tab Number of sorts that where done by scanning the table. @item @code{Sort_scan} @tab Number of sorts that where done by scanning the table.
@item @code{Threads_cached} @tab Number of threads in the thread cache. @item @code{Threads_cached} @tab Number of threads in the thread cache.
@item @code{Threads_connected} @tab Number of currently open connections. @item @code{Threads_connected} @tab Number of currently open connections.
@item @code{Threads_created} @tab Number of threads created to handle connections.
@item @code{Threads_running} @tab Number of threads that are not sleeping. @item @code{Threads_running} @tab Number of threads that are not sleeping.
@item @code{Uptime} @tab How many seconds the server has been up. @item @code{Uptime} @tab How many seconds the server has been up.
@end multitable @end multitable
...@@ -20237,6 +20249,9 @@ your @code{mysqld} @code{sort_buffer} variables is probably too small. ...@@ -20237,6 +20249,9 @@ your @code{mysqld} @code{sort_buffer} variables is probably too small.
@item @item
@code{Created_tmp_files} doesn't count the files needed to handle temporary @code{Created_tmp_files} doesn't count the files needed to handle temporary
tables. tables.
@item
If @code{Threads_created} is big, you may want to increase the
@code{thread_cache_size} variable.
@end itemize @end itemize
@node SHOW VARIABLES, SHOW LOGS, SHOW STATUS, SHOW @node SHOW VARIABLES, SHOW LOGS, SHOW STATUS, SHOW
...@@ -20706,7 +20721,9 @@ threads are first taken from the cache, and only when the cache is empty ...@@ -20706,7 +20721,9 @@ threads are first taken from the cache, and only when the cache is empty
is a new thread created. This variable can be increased to improve is a new thread created. This variable can be increased to improve
performance if you have a lot of new connections. (Normally this doesn't performance if you have a lot of new connections. (Normally this doesn't
give a notable performance improvement if you have a good give a notable performance improvement if you have a good
thread implementation.) thread implementation.) By examing the difference between
the @code{Connections} and @code{Threads_created} you can see how efficient
the current thread cache is for you.
@item @code{thread_concurrency} @item @code{thread_concurrency}
On Solaris, @code{mysqld} will call @code{thr_setconcurrency()} with On Solaris, @code{mysqld} will call @code{thr_setconcurrency()} with
...@@ -28438,8 +28455,8 @@ information to a log file. ...@@ -28438,8 +28455,8 @@ information to a log file.
Normally one should never edit the @code{safe_mysqld} script, but Normally one should never edit the @code{safe_mysqld} script, but
instead put the options to @code{safe_mysqld} in the instead put the options to @code{safe_mysqld} in the
@code{[safe_mysqld]} section in the @code{my.cnf} @code{[safe_mysqld]} section in the @code{my.cnf}
file. @code{safe_mysqld} will read all options from the @code{[mysqld]} file. @code{safe_mysqld} will read all options from the @code{[mysqld]},
and @code{[safe_mysqld]} sections from the option files. @code{[server]} and @code{[safe_mysqld]} sections from the option files.
@xref{Option files}. @xref{Option files}.
Note that all options on the command line to @code{safe_mysqld} are passed Note that all options on the command line to @code{safe_mysqld} are passed
...@@ -30801,10 +30818,13 @@ print some informational statistics, too. ...@@ -30801,10 +30818,13 @@ print some informational statistics, too.
@node Repair, Optimization, Check, Crash recovery @node Repair, Optimization, Check, Crash recovery
@subsection How to Repair Tables @subsection How to Repair Tables
In the following section we only talk about using @code{myisamchk} on @code{MyISAM} In the following section we only talk about using @code{myisamchk} on
tables (extensions @code{.MYI} and @code{.MYD}). If you are using @code{MyISAM} tables (extensions @code{.MYI} and @code{.MYD}). If you
@code{ISAM} tables (extensions @code{.ISM} and @code{.ISD}), you should use are using @code{ISAM} tables (extensions @code{.ISM} and @code{.ISD}),
@code{isamchk} instead. you should use @code{isamchk} instead.
Starting with @strong{MySQL} Version 3.23.14, you can repair MyISAM
tables with the @code{REPAIR TABLE} command. @xref{REPAIR TABLE}.
The symptoms of a corrupted table include queries that abort unexpectedly The symptoms of a corrupted table include queries that abort unexpectedly
and observable errors such as these: and observable errors such as these:
...@@ -30815,11 +30835,45 @@ and observable errors such as these: ...@@ -30815,11 +30835,45 @@ and observable errors such as these:
@item @item
Can't find file @file{tbl_name.MYI} (Errcode: ###) Can't find file @file{tbl_name.MYI} (Errcode: ###)
@item @item
Got error ### from table handler (Error 135 is an exception in this case)
@item
Unexpected end of file Unexpected end of file
@item @item
Record file is crashed Record file is crashed
@item
Got error ### from table handler
To get more information about the error you can do @code{perror
###}. Here is the most common errors that indicates a problem with the
table:
@example
shell> perror 126 127 132 134 135 136 141 144 145
126 = Index file is crashed / Wrong file format
127 = Record-file is crashed
132 = Old database file
134 = Record was already deleted (or record file crashed)
135 = No more room in record file
136 = No more room in index file
141 = Duplicate unique key or constraint on write or update
144 = Table is crashed and last repair failed
145 = Table was marked as crashed and should be repaired
@end example
Note that error 135, no more room in record file, is not a error that
can be fixed by a simple repair. In this case you have to do:
@itemize @bullet
@item
@code{CREATE TABLE ...} for the table with proper @code{MAX_ROWS} and
@code{AVG_ROW_LENGTH} values. @xref{CREATE TABLE}.
@item
Copy the data over from the old table with @code{INSERT INTO new_table
SELECT * from old_table}.
@item
Rename the old table to the new table:
@code{RENAME old_table to tmp_table, new_table to old_table}
@item
Delete the old table: @code{DROP TABLE tmp_table}.
@end itemize
@end itemize @end itemize
In these cases, you must repair your tables. @code{myisamchk} In these cases, you must repair your tables. @code{myisamchk}
...@@ -40045,6 +40099,7 @@ version. The replication and BerkeleyDB code is still under development, ...@@ -40045,6 +40099,7 @@ version. The replication and BerkeleyDB code is still under development,
though, so Version 3.23 is not released as a stable version yet. though, so Version 3.23 is not released as a stable version yet.
@menu @menu
* News-3.23.31:: Changes in release 3.23.31
* News-3.23.30:: Changes in release 3.23.30 * News-3.23.30:: Changes in release 3.23.30
* News-3.23.29:: Changes in release 3.23.29 * News-3.23.29:: Changes in release 3.23.29
* News-3.23.28:: Changes in release 3.23.28 * News-3.23.28:: Changes in release 3.23.28
...@@ -40078,7 +40133,23 @@ though, so Version 3.23 is not released as a stable version yet. ...@@ -40078,7 +40133,23 @@ though, so Version 3.23 is not released as a stable version yet.
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @end menu
@node News-3.23.30, News-3.23.29, News-3.23.x, News-3.23.x @node News-3.23.31, News-3.23.30, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.31
@itemize @bullet
@item
Fixed bug in @@code{MyISAM} when deleting keys with possible @code{NULL}
values, but the first key-column was not a prefix-compressed text column.
@item
Fixed that @code{mysql.server} reads the @code{mysql.server} option section
instead of @code{mysql_server}.
@item
Fixed that @code{safe_mysqld} and @code{mysql.server} also reads the
@code{server} option section.
@item
Added @code{Threads_created} status variable to @code{mysqld}.
@end itemize
@node News-3.23.30, News-3.23.29, News-3.23.31, News-3.23.x
@appendixsubsec Changes in release 3.23.30 @appendixsubsec Changes in release 3.23.30
@itemize @bullet @itemize @bullet
@item @item
...@@ -823,7 +823,7 @@ AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [ ...@@ -823,7 +823,7 @@ AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [
bdb_version_ok=yes bdb_version_ok=yes
# This is ugly, but about as good as it can get # This is ugly, but about as good as it can get
elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 3 &&\ elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 3 &&\
grep 'DB_VERSION_STRING\>.*g: (' [$1] > /dev/null grep 'DB_VERSION_STRING.*g: ' [$1] > /dev/null
then then
bdb_version_ok=yes bdb_version_ok=yes
else else
......
...@@ -23,16 +23,37 @@ ...@@ -23,16 +23,37 @@
* Monty * Monty
**/ **/
#define MTEST_VERSION "1.4" /**********************************************************************
TODO:
#include "global.h"
#include "my_sys.h" - Print also the queries that returns a result to the log file; This makes
#include "m_string.h" it much easier to find out what's wrong.
#include "mysql.h"
#include "mysql_version.h" - Do comparison line by line, instead of doing a full comparison of
#include "my_config.h" the text file. This will save space as we don't need to keep many
#include "my_dir.h" results in memory. It will also make it possible to do simple
#include "mysqld_error.h" 'comparison' fixes like accepting the result even if a float differed
in the last decimals.
- Don't buffer lines from the test that you don't expect to need
again.
- Change 'read_line' to be faster by using the readline.cc code;
We can do better than calling feof() for each character!
**********************************************************************/
#define MTEST_VERSION "1.5"
#include <global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <mysql_version.h>
#include <m_ctype.h>
#include <my_config.h>
#include <my_dir.h>
#include <mysqld_error.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <getopt.h> #include <getopt.h>
...@@ -56,6 +77,7 @@ const char* user = 0, *host = 0, *unix_sock = 0; ...@@ -56,6 +77,7 @@ const char* user = 0, *host = 0, *unix_sock = 0;
int port = 0; int port = 0;
static uint start_lineno, *lineno; static uint start_lineno, *lineno;
static char **default_argv;
static const char *load_default_groups[]= { "mysqltest","client",0 }; static const char *load_default_groups[]= { "mysqltest","client",0 };
FILE* file_stack[MAX_INCLUDE_DEPTH]; FILE* file_stack[MAX_INCLUDE_DEPTH];
...@@ -104,9 +126,9 @@ struct connection cons[MAX_CONS]; ...@@ -104,9 +126,9 @@ struct connection cons[MAX_CONS];
struct connection* cur_con, *next_con, *cons_end; struct connection* cur_con, *next_con, *cons_end;
/* this should really be called command */ /* this should really be called command */
struct query struct st_query
{ {
char q[MAX_QUERY]; char *query, *first_argument;
int first_word_len; int first_word_len;
my_bool abort_on_error, require_file; my_bool abort_on_error, require_file;
uint expected_errno; uint expected_errno;
...@@ -127,60 +149,83 @@ const char *command_names[] = { ...@@ -127,60 +149,83 @@ const char *command_names[] = {
TYPELIB command_typelib= {array_elements(command_names),"", TYPELIB command_typelib= {array_elements(command_names),"",
command_names}; command_names};
DYNAMIC_STRING ds_res;
#define DS_CHUNK 16384 int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname);
typedef struct dyn_string
{
char* str;
int len,max_len;
} DYN_STRING;
DYN_STRING ds_res;
void dyn_string_init(DYN_STRING* ds);
void dyn_string_end(DYN_STRING* ds);
void dyn_string_append(DYN_STRING* ds, const char* str, int len);
int dyn_string_cmp(DYN_STRING* ds, const char* fname);
void reject_dump(const char* record_file, char* buf, int size); void reject_dump(const char* record_file, char* buf, int size);
int close_connection(struct query* q); int close_connection(struct st_query* q);
VAR* var_get(char* var_name, char* var_name_end, int raw); VAR* var_get(char* var_name, char* var_name_end, int raw);
static void close_cons() static void close_cons()
{ {
for(--next_con; next_con >= cons; --next_con) DBUG_ENTER("close_cons");
{ for (--next_con; next_con >= cons; --next_con)
mysql_close(&next_con->mysql); {
my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR)); mysql_close(&next_con->mysql);
} my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
}
DBUG_VOID_RETURN;
}
static void close_files()
{
do
{
if (*cur_file != stdin)
my_fclose(*cur_file,MYF(0));
} while (cur_file-- != file_stack);
}
static void free_used_memory()
{
uint i;
DBUG_ENTER("free_used_memory");
close_cons();
close_files();
for (i=0 ; i < q_lines.elements ; i++)
{
struct st_query **q= dynamic_element(&q_lines, i, struct st_query**);
my_free((gptr) (*q)->query,MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) (*q),MYF(0));
}
delete_dynamic(&q_lines);
dynstr_free(&ds_res);
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv);
my_end(MY_CHECK_ERROR);
DBUG_VOID_RETURN;
} }
static void die(const char* fmt, ...) static void die(const char* fmt, ...)
{ {
va_list args; va_list args;
DBUG_ENTER("die");
va_start(args, fmt); va_start(args, fmt);
fprintf(stderr, "%s: ", my_progname); if (fmt)
vfprintf(stderr, fmt, args); {
fprintf(stderr, "\n"); fprintf(stderr, "%s: ", my_progname);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
va_end(args); va_end(args);
close_cons(); free_used_memory();
exit(1); exit(1);
} }
static void abort_not_supported_test() static void abort_not_supported_test()
{ {
DBUG_ENTER("abort_not_supported_test");
fprintf(stderr, "This test is not supported by this installation\n"); fprintf(stderr, "This test is not supported by this installation\n");
if (!silent) if (!silent)
printf("skipped\n"); printf("skipped\n");
close_cons(); free_used_memory();
exit(2); exit(2);
} }
static void verbose_msg(const char* fmt, ...) static void verbose_msg(const char* fmt, ...)
{ {
va_list args; va_list args;
if (!verbose) return; if (!verbose) return;
va_start(args, fmt); va_start(args, fmt);
...@@ -208,70 +253,32 @@ int hex_val(int c) ...@@ -208,70 +253,32 @@ int hex_val(int c)
return -1; return -1;
} }
void dyn_string_init(DYN_STRING* ds) int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname)
{
if (!(ds->str = (char*)my_malloc(DS_CHUNK, MYF(0))))
die("Out of memory");
ds->len = 0;
ds->max_len = DS_CHUNK;
}
void dyn_string_end(DYN_STRING* ds)
{
my_free(ds->str, MYF(0));
memset(ds, 0, sizeof(*ds)); /* safety */
}
void dyn_string_append(DYN_STRING* ds, const char* str, int len)
{
int new_len;
if (!len)
len = strlen(str);
new_len = ds->len + len;
if (new_len > ds->max_len)
{
int new_alloc_len = (new_len & ~(DS_CHUNK-1)) + DS_CHUNK;
char* tmp = (char*) my_malloc(new_alloc_len, MYF(0));
if (!tmp)
die("Out of memory");
memcpy(tmp, ds->str, ds->len);
memcpy(tmp + ds->len, str, len);
my_free((gptr)ds->str, MYF(0));
ds->str = tmp;
ds->len = new_len;
ds->max_len = new_alloc_len;
}
else
{
memcpy(ds->str + ds->len, str, len);
ds->len += len;
}
}
int dyn_string_cmp(DYN_STRING* ds, const char* fname)
{ {
MY_STAT stat_info; MY_STAT stat_info;
char *tmp; char *tmp;
int res; int res;
int fd; int fd;
DBUG_ENTER("dyn_string_cmp");
if (!my_stat(fname, &stat_info, MYF(MY_WME))) if (!my_stat(fname, &stat_info, MYF(MY_WME)))
die("Could not stat %s: errno =%d", fname, errno); die(NullS);
if (stat_info.st_size != ds->len) if (stat_info.st_size != ds->length)
return 2; DBUG_RETURN(2);
if (!(tmp = (char*) my_malloc(ds->len, MYF(0)))) if (!(tmp = (char*) my_malloc(ds->length, MYF(MY_WME))))
die("Out of memory"); die(NullS);
if ((fd = my_open(fname, O_RDONLY, MYF(MY_WME))) < 0) if ((fd = my_open(fname, O_RDONLY, MYF(MY_WME))) < 0)
die("Could not open %s: errno = %d", fname, errno); die(NullS);
if (my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP))) if (my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
die("read failed"); die(NullS);
res = (memcmp(tmp, ds->str, stat_info.st_size)) ? 1 : 0; res = (memcmp(tmp, ds->str, stat_info.st_size)) ? 1 : 0;
my_free((gptr)tmp, MYF(0)); my_free((gptr) tmp, MYF(0));
my_close(fd, MYF(0)); my_close(fd, MYF(MY_WME));
return res;
DBUG_RETURN(res);
} }
static int check_result(DYN_STRING* ds, const char* fname, static int check_result(DYNAMIC_STRING* ds, const char* fname,
my_bool require_option) my_bool require_option)
{ {
int error = 0; int error = 0;
...@@ -295,7 +302,7 @@ static int check_result(DYN_STRING* ds, const char* fname, ...@@ -295,7 +302,7 @@ static int check_result(DYN_STRING* ds, const char* fname,
die("Unknown error code from dyn_string_cmp()"); die("Unknown error code from dyn_string_cmp()");
} }
if (error) if (error)
reject_dump(fname, ds->str, ds->len); reject_dump(fname, ds->str, ds->length);
return error; return error;
} }
...@@ -364,24 +371,23 @@ int var_set(char* var_name, char* var_name_end, char* var_val, ...@@ -364,24 +371,23 @@ int var_set(char* var_name, char* var_name_end, char* var_val,
int open_file(const char* name) int open_file(const char* name)
{ {
if (*cur_file && ++cur_file == file_stack_end) if (*cur_file && cur_file == file_stack_end)
die("Source directives are nesting too deep"); die("Source directives are nesting too deep");
if (!(*cur_file = my_fopen(name, O_RDONLY, MYF(MY_WME)))) if (!(*(cur_file+1) = my_fopen(name, O_RDONLY, MYF(MY_WME))))
die("Could not read '%s': errno %d\n", name, errno); die(NullS);
cur_file++;
*++lineno=1; *++lineno=1;
return 0; return 0;
} }
int do_source(struct query* q) int do_source(struct st_query* q)
{ {
char* p, *name; char* p=q->first_argument, *name;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
if (!*p) if (!*p)
die("Missing file name in source\n"); die("Missing file name in source\n");
name = p; name = p;
while(*p && !isspace(*p)) while (*p && !isspace(*p))
p++; p++;
*p = 0; *p = 0;
...@@ -413,36 +419,30 @@ int eval_expr(VAR* v, char* p, char* p_end) ...@@ -413,36 +419,30 @@ int eval_expr(VAR* v, char* p, char* p_end)
return 1; return 1;
} }
int do_inc(struct query* q) int do_inc(struct st_query* q)
{ {
char* p; char* p=q->first_argument;
VAR* v; VAR* v;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
v = var_get(p, 0, 1); v = var_get(p, 0, 1);
v->int_val++; v->int_val++;
v->int_dirty = 1; v->int_dirty = 1;
return 0; return 0;
} }
int do_dec(struct query* q) int do_dec(struct st_query* q)
{ {
char* p; char* p=q->first_argument;
VAR* v; VAR* v;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
v = var_get(p, 0, 1); v = var_get(p, 0, 1);
v->int_val--; v->int_val--;
v->int_dirty = 1; v->int_dirty = 1;
return 0; return 0;
} }
int do_system(struct query* q) int do_system(struct st_query* q)
{ {
char* p; char* p=q->first_argument;
VAR v; VAR v;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
eval_expr(&v, p, 0); /* NULL terminated */ eval_expr(&v, p, 0); /* NULL terminated */
if (v.str_val_len > 1) if (v.str_val_len > 1)
{ {
...@@ -457,12 +457,10 @@ int do_system(struct query* q) ...@@ -457,12 +457,10 @@ int do_system(struct query* q)
return 0; return 0;
} }
int do_echo(struct query* q) int do_echo(struct st_query* q)
{ {
char* p; char* p=q->first_argument;
VAR v; VAR v;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
eval_expr(&v, p, 0); /* NULL terminated */ eval_expr(&v, p, 0); /* NULL terminated */
if (v.str_val_len > 1) if (v.str_val_len > 1)
{ {
...@@ -473,11 +471,10 @@ int do_echo(struct query* q) ...@@ -473,11 +471,10 @@ int do_echo(struct query* q)
return 0; return 0;
} }
int do_let(struct query* q) int do_let(struct st_query* q)
{ {
char* p, *var_name, *var_name_end, *var_val_start; char* p=q->first_argument;
p = (char*)q->q + q->first_word_len; char *var_name, *var_name_end, *var_val_start;
while(*p && isspace(*p)) p++;
if (!*p) if (!*p)
die("Missing variable name in let\n"); die("Missing variable name in let\n");
var_name = p; var_name = p;
...@@ -493,12 +490,11 @@ int do_let(struct query* q) ...@@ -493,12 +490,11 @@ int do_let(struct query* q)
return var_set(var_name, var_name_end, var_val_start, p); return var_set(var_name, var_name_end, var_val_start, p);
} }
int do_sleep(struct query* q) int do_sleep(struct st_query* q)
{ {
char *p; char* p=q->first_argument;
struct timeval t; struct timeval t;
int dec_mul = 1000000; int dec_mul = 1000000;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++; while(*p && isspace(*p)) p++;
if (!*p) if (!*p)
die("Missing argument in sleep\n"); die("Missing argument in sleep\n");
...@@ -534,10 +530,9 @@ int do_sleep(struct query* q) ...@@ -534,10 +530,9 @@ int do_sleep(struct query* q)
return select(0,0,0,0, &t); return select(0,0,0,0, &t);
} }
static void get_file_name(char *filename, struct query* q) static void get_file_name(char *filename, struct st_query* q)
{ {
char *p = (char*) q->q + q->first_word_len; char* p=q->first_argument;
while(*p && isspace(*p)) p++;
strnmov(filename, p, FN_REFLEN); strnmov(filename, p, FN_REFLEN);
/* Remove end space */ /* Remove end space */
while (p > filename && isspace(p[-1])) while (p > filename && isspace(p[-1]))
...@@ -546,12 +541,13 @@ static void get_file_name(char *filename, struct query* q) ...@@ -546,12 +541,13 @@ static void get_file_name(char *filename, struct query* q)
} }
int select_connection(struct query* q) int select_connection(struct st_query* q)
{ {
char* p, *name; char* p=q->first_argument, *name;
struct connection *con; struct connection *con;
p = (char*)q->q + q->first_word_len; DBUG_ENTER("select_connection");
while(*p && isspace(*p)) p++; DBUG_PRINT("enter",("name: '%s'",p));
if (!*p) if (!*p)
die("Missing connection name in connect\n"); die("Missing connection name in connect\n");
name = p; name = p;
...@@ -559,23 +555,25 @@ int select_connection(struct query* q) ...@@ -559,23 +555,25 @@ int select_connection(struct query* q)
p++; p++;
*p = 0; *p = 0;
for(con = cons; con < next_con; con++) for (con = cons; con < next_con; con++)
{
if (!strcmp(con->name, name)) if (!strcmp(con->name, name))
{ {
cur_con = con; cur_con = con;
return 0; DBUG_RETURN(0);
} }
}
die("connection '%s' not found in connection pool", name); die("connection '%s' not found in connection pool", name);
return 1; DBUG_RETURN(1); /* Never reached */
} }
int close_connection(struct query* q) int close_connection(struct st_query* q)
{ {
char* p, *name; char* p=q->first_argument, *name;
struct connection *con; struct connection *con;
p = (char*)q->q + q->first_word_len; DBUG_ENTER("close_connection");
while(*p && isspace(*p)) p++; DBUG_PRINT("enter",("name: '%s'",p));
if (!*p) if (!*p)
die("Missing connection name in connect\n"); die("Missing connection name in connect\n");
name = p; name = p;
...@@ -584,14 +582,15 @@ int close_connection(struct query* q) ...@@ -584,14 +582,15 @@ int close_connection(struct query* q)
*p = 0; *p = 0;
for(con = cons; con < next_con; con++) for(con = cons; con < next_con; con++)
{
if (!strcmp(con->name, name)) if (!strcmp(con->name, name))
{ {
mysql_close(&con->mysql); mysql_close(&con->mysql);
return 0; DBUG_RETURN(0);
} }
}
die("connection '%s' not found in connection pool", name); die("connection '%s' not found in connection pool", name);
return 1; DBUG_RETURN(1); /* Never reached */
} }
...@@ -600,8 +599,10 @@ int close_connection(struct query* q) ...@@ -600,8 +599,10 @@ int close_connection(struct query* q)
a comma, a space or ) belongs to the argument. space is a chopper, comma or a comma, a space or ) belongs to the argument. space is a chopper, comma or
) are delimiters/terminators ) are delimiters/terminators
*/ */
char* safe_get_param(char* str, char** arg, const char* msg) char* safe_get_param(char* str, char** arg, const char* msg)
{ {
DBUG_ENTER("safe_get_param");
while(*str && isspace(*str)) str++; while(*str && isspace(*str)) str++;
*arg = str; *arg = str;
while(*str && *str != ',' && *str != ')') while(*str && *str != ',' && *str != ')')
...@@ -613,21 +614,21 @@ char* safe_get_param(char* str, char** arg, const char* msg) ...@@ -613,21 +614,21 @@ char* safe_get_param(char* str, char** arg, const char* msg)
die(msg); die(msg);
*str++ = 0; *str++ = 0;
return str; DBUG_RETURN(str);
} }
int do_connect(struct query* q)
int do_connect(struct st_query* q)
{ {
char* con_name, *con_user,*con_pass, *con_host, *con_port_str, char* con_name, *con_user,*con_pass, *con_host, *con_port_str,
*con_db, *con_sock; *con_db, *con_sock;
char* p; char* p=q->first_argument;
char buff[FN_REFLEN]; char buff[FN_REFLEN];
DBUG_ENTER("do_connect");
DBUG_PRINT("enter",("connect: %s",p));
p = q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
if (*p != '(') if (*p != '(')
die("Syntax error in connect - expeected '(' found '%c'", *p); die("Syntax error in connect - expected '(' found '%c'", *p);
p++; p++;
p = safe_get_param(p, &con_name, "missing connection name"); p = safe_get_param(p, &con_name, "missing connection name");
p = safe_get_param(p, &con_host, "missing connection host"); p = safe_get_param(p, &con_host, "missing connection host");
...@@ -648,13 +649,13 @@ int do_connect(struct query* q) ...@@ -648,13 +649,13 @@ int do_connect(struct query* q)
mysql_error(&next_con->mysql)); mysql_error(&next_con->mysql));
if (!(next_con->name = my_strdup(con_name, MYF(MY_WME)))) if (!(next_con->name = my_strdup(con_name, MYF(MY_WME))))
die("Out of memory"); die(NullS);
cur_con = next_con++; cur_con = next_con++;
return 0; DBUG_RETURN(0);
} }
int do_done(struct query* q) int do_done(struct st_query* q)
{ {
q->type = Q_END_BLOCK; q->type = Q_END_BLOCK;
if (cur_block == block_stack) if (cur_block == block_stack)
...@@ -670,9 +671,9 @@ int do_done(struct query* q) ...@@ -670,9 +671,9 @@ int do_done(struct query* q)
return 0; return 0;
} }
int do_while(struct query* q) int do_while(struct st_query* q)
{ {
char *p = q->q + q->first_word_len; char* p=q->first_argument;
char* expr_start, *expr_end; char* expr_start, *expr_end;
VAR v; VAR v;
if (cur_block == block_stack_end) if (cur_block == block_stack_end)
...@@ -767,7 +768,8 @@ int read_line(char* buf, int size) ...@@ -767,7 +768,8 @@ int read_line(char* buf, int size)
c = fgetc(*cur_file); c = fgetc(*cur_file);
if (feof(*cur_file)) if (feof(*cur_file))
{ {
my_fclose(*cur_file,MYF(0)); if ((*cur_file) != stdin)
my_fclose(*cur_file,MYF(0));
if (cur_file == file_stack) if (cur_file == file_stack)
return 1; return 1;
...@@ -883,19 +885,19 @@ int read_line(char* buf, int size) ...@@ -883,19 +885,19 @@ int read_line(char* buf, int size)
static char read_query_buf[MAX_QUERY]; static char read_query_buf[MAX_QUERY];
int read_query(struct query** q_ptr) int read_query(struct st_query** q_ptr)
{ {
char* p = read_query_buf, * p1 ; char *p = read_query_buf, * p1 ;
int c, expected_errno; int c, expected_errno;
struct query* q; struct st_query* q;
if (parser.current_line < parser.read_lines) if (parser.current_line < parser.read_lines)
{ {
get_dynamic(&q_lines, (gptr)q_ptr, parser.current_line) ; get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ;
return 0; return 0;
} }
if (!(*q_ptr=q=(struct query*)my_malloc(sizeof(*q), MYF(MY_WME))) if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME)))
|| insert_dynamic(&q_lines, (gptr)&q) || insert_dynamic(&q_lines, (gptr) &q)
) )
die("Out of memory"); die("Out of memory");
...@@ -905,6 +907,7 @@ int read_query(struct query** q_ptr) ...@@ -905,6 +907,7 @@ int read_query(struct query** q_ptr)
q->first_word_len = 0; q->first_word_len = 0;
q->expected_errno = 0; q->expected_errno = 0;
q->type = Q_UNKNOWN; q->type = Q_UNKNOWN;
q->query=0;
if (read_line(read_query_buf, sizeof(read_query_buf))) if (read_line(read_query_buf, sizeof(read_query_buf)))
return 1; return 1;
...@@ -944,20 +947,24 @@ int read_query(struct query** q_ptr) ...@@ -944,20 +947,24 @@ int read_query(struct query** q_ptr)
*p1 = 0; *p1 = 0;
} }
} }
while(*p && isspace(*p)) p++; while (*p && isspace(*p)) p++;
/* Calculate first word */ if (!(q->query=my_strdup(p,MYF(MY_WME))))
p1 = q->q; die(NullS);
while(*p && !isspace(*p))
*p1++ = *p++; /* Calculate first word and first argument */
for (p=q->query; *p && !isspace(*p) ; p++) ;
q->first_word_len = (uint) (p - q->query);
while (*p && isspace(*p)) p++;
q->first_argument=p;
q->first_word_len = p1 - q->q;
strmov(p1, p);
parser.read_lines++; parser.read_lines++;
return 0; return 0;
} }
struct option long_options[] = struct option long_options[] =
{ {
{"debug", optional_argument, 0, '#'},
{"database", required_argument, 0, 'D'}, {"database", required_argument, 0, 'D'},
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
{"host", required_argument, 0, 'h'}, {"host", required_argument, 0, 'h'},
...@@ -991,7 +998,12 @@ void usage() ...@@ -991,7 +998,12 @@ void usage()
printf("Runs a test against the mysql server and compares output with a results file.\n\n"); printf("Runs a test against the mysql server and compares output with a results file.\n\n");
printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
printf("\n\ printf("\n\
-?, --help Display this help and exit.\n\ -?, --help Display this help and exit.\n");
#ifndef DBUG_OFF
puts("\
-#, --debug=[...] Output debug log. Often this is 'd:t:o,filename`");
#endif
printf("\
-h, --host=... Connect to host.\n\ -h, --host=... Connect to host.\n\
-u, --user=... User for login.\n\ -u, --user=... User for login.\n\
-p[password], --password[=...]\n\ -p[password], --password[=...]\n\
...@@ -1015,65 +1027,68 @@ int parse_args(int argc, char **argv) ...@@ -1015,65 +1027,68 @@ int parse_args(int argc, char **argv)
my_bool tty_password=0; my_bool tty_password=0;
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
while((c = getopt_long(argc, argv, "h:p::u:P:D:S:R:t:T:?rvVq", while((c = getopt_long(argc, argv, "h:p::u:P:D:S:R:t:T:#:?rvVq",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
{ {
switch(c) switch(c) {
case '#':
DBUG_PUSH(optarg ? optarg : "d:t:o,/tmp/mysqltest.trace");
break;
case 'v':
verbose = 1;
break;
case 'r':
record = 1;
break;
case 'u':
user = optarg;
break;
case 'R':
result_file = optarg;
break;
case 'p':
if (optarg)
{ {
case 'v': my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
verbose = 1; pass=my_strdup(optarg,MYF(MY_FAE));
break; while (*optarg) *optarg++= 'x'; /* Destroy argument */
case 'r':
record = 1;
break;
case 'u':
user = optarg;
break;
case 'R':
result_file = optarg;
break;
case 'p':
if (optarg)
{
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
pass=my_strdup(optarg,MYF(MY_FAE));
while (*optarg) *optarg++= 'x'; /* Destroy argument */
}
else
tty_password=1;
break;
case 'P':
port = atoi(optarg);
break;
case 'S':
unix_sock = optarg;
break;
case 'D':
db = optarg;
break;
case 'h':
host = optarg;
break;
case 'q':
silent = 1;
break;
case 't':
strnmov(TMPDIR,optarg,sizeof(TMPDIR));
break;
case 'T':
opt_sleep=atoi(optarg);
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
default:
usage();
exit(1);
} }
else
tty_password=1;
break;
case 'P':
port = atoi(optarg);
break;
case 'S':
unix_sock = optarg;
break;
case 'D':
db = optarg;
break;
case 'h':
host = optarg;
break;
case 'q':
silent = 1;
break;
case 't':
strnmov(TMPDIR,optarg,sizeof(TMPDIR));
break;
case 'T':
opt_sleep=atoi(optarg);
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(1); /* Unknown option */
default:
usage();
exit(1);
}
} }
argc-=optind; argc-=optind;
...@@ -1118,7 +1133,7 @@ void reject_dump(const char* record_file, char* buf, int size) ...@@ -1118,7 +1133,7 @@ void reject_dump(const char* record_file, char* buf, int size)
} }
int run_query(MYSQL* mysql, struct query* q) int run_query(MYSQL* mysql, struct st_query* q)
{ {
MYSQL_RES* res = 0; MYSQL_RES* res = 0;
MYSQL_FIELD* fields; MYSQL_FIELD* fields;
...@@ -1127,21 +1142,24 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1127,21 +1142,24 @@ int run_query(MYSQL* mysql, struct query* q)
unsigned long* lengths; unsigned long* lengths;
char* val; char* val;
int len; int len;
DYN_STRING *ds = &ds_res; DYNAMIC_STRING *ds;
DYN_STRING ds_tmp; DYNAMIC_STRING ds_tmp;
dyn_string_init(&ds_tmp); DBUG_ENTER("run_query");
if ( q->record_file[0]) if ( q->record_file[0])
{ {
init_dynamic_string(&ds_tmp, "", 16384, 65536);
ds = &ds_tmp; ds = &ds_tmp;
} }
else
ds= &ds_res;
if (mysql_query(mysql, q->q)) if (mysql_query(mysql, q->query))
{ {
if (q->require_file) if (q->require_file)
abort_not_supported_test(); abort_not_supported_test();
if (q->abort_on_error) if (q->abort_on_error)
die("At line %u: query '%s' failed: %d: %s", start_lineno, q->q, die("At line %u: query '%s' failed: %d: %s", start_lineno, q->query,
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
else else
{ {
...@@ -1150,11 +1168,11 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1150,11 +1168,11 @@ int run_query(MYSQL* mysql, struct query* q)
error = (q->expected_errno != mysql_errno(mysql)); error = (q->expected_errno != mysql_errno(mysql));
if (error) if (error)
verbose_msg("query '%s' failed with wrong errno\ verbose_msg("query '%s' failed with wrong errno\
%d instead of %d", q->q, mysql_errno(mysql), q->expected_errno); %d instead of %d", q->query, mysql_errno(mysql), q->expected_errno);
goto end; goto end;
} }
verbose_msg("query '%s' failed: %d: %s", q->q, mysql_errno(mysql), verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql),
mysql_error(mysql)); mysql_error(mysql));
/* if we do not abort on error, failure to run the query does /* if we do not abort on error, failure to run the query does
not fail the whole test case not fail the whole test case
...@@ -1167,7 +1185,7 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1167,7 +1185,7 @@ int run_query(MYSQL* mysql, struct query* q)
{ {
error = 1; error = 1;
verbose_msg("query '%s' succeeded - should have failed with errno %d", verbose_msg("query '%s' succeeded - should have failed with errno %d",
q->q, q->expected_errno); q->query, q->expected_errno);
goto end; goto end;
} }
...@@ -1178,10 +1196,10 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1178,10 +1196,10 @@ int run_query(MYSQL* mysql, struct query* q)
abort_not_supported_test(); abort_not_supported_test();
if (q->abort_on_error) if (q->abort_on_error)
die("At line %u: Failed in mysql_store_result for query '%s' (%d)", die("At line %u: Failed in mysql_store_result for query '%s' (%d)",
start_lineno, q->q, mysql_errno(mysql)); start_lineno, q->query, mysql_errno(mysql));
else else
{ {
verbose_msg("failed in mysql_store_result for query '%s' (%d)", q->q, verbose_msg("failed in mysql_store_result for query '%s' (%d)", q->query,
mysql_errno(mysql)); mysql_errno(mysql));
error = 1; error = 1;
goto end; goto end;
...@@ -1195,11 +1213,11 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1195,11 +1213,11 @@ int run_query(MYSQL* mysql, struct query* q)
for( i = 0; i < num_fields; i++) for( i = 0; i < num_fields; i++)
{ {
if (i) if (i)
dyn_string_append(ds, "\t", 1); dynstr_append_mem(ds, "\t", 1);
dyn_string_append(ds, fields[i].name, 0); dynstr_append(ds, fields[i].name);
} }
dyn_string_append(ds, "\n", 1); dynstr_append_mem(ds, "\n", 1);
while((row = mysql_fetch_row(res))) while((row = mysql_fetch_row(res)))
...@@ -1217,11 +1235,11 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1217,11 +1235,11 @@ int run_query(MYSQL* mysql, struct query* q)
} }
if (i) if (i)
dyn_string_append(ds, "\t", 1); dynstr_append_mem(ds, "\t", 1);
dyn_string_append(ds, val, len); dynstr_append_mem(ds, val, len);
} }
dyn_string_append(ds, "\n", 1); dynstr_append_mem(ds, "\n", 1);
} }
if (record) if (record)
...@@ -1229,7 +1247,7 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1229,7 +1247,7 @@ int run_query(MYSQL* mysql, struct query* q)
if (!q->record_file[0] && !result_file) if (!q->record_file[0] && !result_file)
die("At line %u: Missing result file", start_lineno); die("At line %u: Missing result file", start_lineno);
if (!result_file) if (!result_file)
str_to_file(q->record_file, ds->str, ds->len); str_to_file(q->record_file, ds->str, ds->length);
} }
else if (q->record_file[0]) else if (q->record_file[0])
{ {
...@@ -1238,15 +1256,17 @@ int run_query(MYSQL* mysql, struct query* q) ...@@ -1238,15 +1256,17 @@ int run_query(MYSQL* mysql, struct query* q)
end: end:
if (res) mysql_free_result(res); if (res) mysql_free_result(res);
return error; if (ds == &ds_tmp)
dynstr_free(&ds_tmp);
DBUG_RETURN(error);
} }
void get_query_type(struct query* q) void get_query_type(struct st_query* q)
{ {
char save; char save;
uint type; uint type;
if (*q->q == '}') if (*q->query == '}')
{ {
q->type = Q_END_BLOCK; q->type = Q_END_BLOCK;
return; return;
...@@ -1254,26 +1274,25 @@ void get_query_type(struct query* q) ...@@ -1254,26 +1274,25 @@ void get_query_type(struct query* q)
if (q->type != Q_COMMENT_WITH_COMMAND) if (q->type != Q_COMMENT_WITH_COMMAND)
q->type = Q_QUERY; q->type = Q_QUERY;
save=q->q[q->first_word_len]; save=q->query[q->first_word_len];
q->q[q->first_word_len]=0; q->query[q->first_word_len]=0;
type=find_type(q->q, &command_typelib, 0); type=find_type(q->query, &command_typelib, 1);
q->q[q->first_word_len]=save; q->query[q->first_word_len]=save;
if (type > 0) if (type > 0)
q->type=type; /* Found command */ q->type=type; /* Found command */
} }
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int error = 0; int error = 0;
struct query* q; struct st_query* q;
my_bool require_file=0; my_bool require_file=0;
char save_file[FN_REFLEN]; char save_file[FN_REFLEN];
MY_INIT(argv[0]);
save_file[0]=0; save_file[0]=0;
TMPDIR[0]=0; TMPDIR[0]=0;
MY_INIT(argv[0]);
memset(cons, 0, sizeof(cons)); memset(cons, 0, sizeof(cons));
cons_end = cons + MAX_CONS; cons_end = cons + MAX_CONS;
next_con = cons + 1; next_con = cons + 1;
...@@ -1283,12 +1302,12 @@ int main(int argc, char** argv) ...@@ -1283,12 +1302,12 @@ int main(int argc, char** argv)
file_stack_end = file_stack + MAX_INCLUDE_DEPTH; file_stack_end = file_stack + MAX_INCLUDE_DEPTH;
cur_file = file_stack; cur_file = file_stack;
lineno = lineno_stack; lineno = lineno_stack;
init_dynamic_array(&q_lines, sizeof(struct query*), INIT_Q_LINES, init_dynamic_array(&q_lines, sizeof(struct st_query*), INIT_Q_LINES,
INIT_Q_LINES); INIT_Q_LINES);
memset(block_stack, 0, sizeof(block_stack)); memset(block_stack, 0, sizeof(block_stack));
block_stack_end = block_stack + BLOCK_STACK_DEPTH; block_stack_end = block_stack + BLOCK_STACK_DEPTH;
cur_block = block_stack; cur_block = block_stack;
dyn_string_init(&ds_res); init_dynamic_string(&ds_res, "", 0, 65536);
parse_args(argc, argv); parse_args(argc, argv);
if (!*cur_file) if (!*cur_file)
*cur_file = stdin; *cur_file = stdin;
...@@ -1362,16 +1381,14 @@ int main(int argc, char** argv) ...@@ -1362,16 +1381,14 @@ int main(int argc, char** argv)
parser.current_line += current_line_inc; parser.current_line += current_line_inc;
} }
close_cons(); if (result_file && ds_res.length)
if (result_file && ds_res.len)
{ {
if(!record) if (!record)
error |= check_result(&ds_res, result_file, q->require_file); error |= check_result(&ds_res, result_file, q->require_file);
else else
str_to_file(result_file, ds_res.str, ds_res.len); str_to_file(result_file, ds_res.str, ds_res.length);
} }
dyn_string_end(&ds_res); dynstr_free(&ds_res);
if (!silent) { if (!silent) {
if(error) if(error)
...@@ -1380,6 +1397,7 @@ int main(int argc, char** argv) ...@@ -1380,6 +1397,7 @@ int main(int argc, char** argv)
printf("ok\n"); printf("ok\n");
} }
free_used_memory();
exit(error); exit(error);
return error; return error;
} }
...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. ...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 3.23.30-gamma) AM_INIT_AUTOMAKE(mysql, 3.23.31)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -551,6 +551,8 @@ extern const char *get_type(TYPELIB *typelib,uint nr); ...@@ -551,6 +551,8 @@ extern const char *get_type(TYPELIB *typelib,uint nr);
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
uint init_alloc,uint alloc_increment); uint init_alloc,uint alloc_increment);
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
uint length);
extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size); extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
extern void dynstr_free(DYNAMIC_STRING *str); extern void dynstr_free(DYNAMIC_STRING *str);
......
...@@ -274,86 +274,86 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -274,86 +274,86 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
} }
else else
{ {
/* Test if prefix compression */ /* Test if prefix compression */
if (keydef->flag & HA_PACK_KEY) if (keydef->flag & HA_PACK_KEY)
{
/* Can't use space_compression on number keys */
if ((keydef->seg[0].flag & HA_SPACE_PACK) &&
keydef->seg[0].type == (int) HA_KEYTYPE_NUM)
keydef->seg[0].flag&= ~HA_SPACE_PACK;
/* Only use HA_PACK_KEY if the first segment is a variable length key */
if (!(keydef->seg[0].flag & (HA_SPACE_PACK | HA_BLOB_PART |
HA_VAR_LENGTH)))
{ {
/* pack relative to previous key */ /* Can't use space_compression on number keys */
keydef->flag&= ~HA_PACK_KEY; if ((keydef->seg[0].flag & HA_SPACE_PACK) &&
keydef->flag|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; keydef->seg[0].type == (int) HA_KEYTYPE_NUM)
keydef->seg[0].flag&= ~HA_SPACE_PACK;
/* Only use HA_PACK_KEY if the first segment is a variable length key */
if (!(keydef->seg[0].flag & (HA_SPACE_PACK | HA_BLOB_PART |
HA_VAR_LENGTH)))
{
/* pack relative to previous key */
keydef->flag&= ~HA_PACK_KEY;
keydef->flag|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
}
else
{
keydef->seg[0].flag|=HA_PACK_KEY; /* for easyer intern test */
keydef->flag|=HA_VAR_LENGTH_KEY;
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
}
} }
else if (keydef->flag & HA_BINARY_PACK_KEY)
{
keydef->seg[0].flag|=HA_PACK_KEY; /* for easyer intern test */
keydef->flag|=HA_VAR_LENGTH_KEY;
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */ options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
}
}
if (keydef->flag & HA_BINARY_PACK_KEY)
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
if (keydef->flag & HA_AUTO_KEY) if (keydef->flag & HA_AUTO_KEY)
share.base.auto_key=i+1; share.base.auto_key=i+1;
for (j=0, keyseg=keydef->seg ; j < keydef->keysegs ; j++, keyseg++) for (j=0, keyseg=keydef->seg ; j < keydef->keysegs ; j++, keyseg++)
{
/* numbers are stored with high by first to make compression easier */
switch (keyseg->type) {
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
case HA_KEYTYPE_USHORT_INT:
case HA_KEYTYPE_ULONG_INT:
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
case HA_KEYTYPE_INT8:
keyseg->flag|= HA_SWAP_KEY;
/* fall through */
default:
break;
}
if (keyseg->flag & HA_SPACE_PACK)
{ {
keydef->flag |= HA_SPACE_PACK_USED | HA_VAR_LENGTH_KEY; /* numbers are stored with high by first to make compression easier */
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */ switch (keyseg->type) {
length++; /* At least one length byte */ case HA_KEYTYPE_SHORT_INT:
min_key_length_skipp+=keyseg->length; case HA_KEYTYPE_LONG_INT:
if (keyseg->length >= 255) case HA_KEYTYPE_FLOAT:
{ /* prefix may be 3 bytes */ case HA_KEYTYPE_DOUBLE:
min_key_length_skipp+=2; case HA_KEYTYPE_USHORT_INT:
length+=2; case HA_KEYTYPE_ULONG_INT:
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
case HA_KEYTYPE_INT8:
keyseg->flag|= HA_SWAP_KEY;
/* fall through */
default:
break;
} }
} if (keyseg->flag & HA_SPACE_PACK)
if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART)) {
{ keydef->flag |= HA_SPACE_PACK_USED | HA_VAR_LENGTH_KEY;
keydef->flag|=HA_VAR_LENGTH_KEY; options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
length++; /* At least one length byte */ length++; /* At least one length byte */
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */ min_key_length_skipp+=keyseg->length;
min_key_length_skipp+=keyseg->length; if (keyseg->length >= 255)
if (keyseg->length >= 255) { /* prefix may be 3 bytes */
{ /* prefix may be 3 bytes */ min_key_length_skipp+=2;
min_key_length_skipp+=2; length+=2;
length+=2; }
}
if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART))
{
keydef->flag|=HA_VAR_LENGTH_KEY;
length++; /* At least one length byte */
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
min_key_length_skipp+=keyseg->length;
if (keyseg->length >= 255)
{ /* prefix may be 3 bytes */
min_key_length_skipp+=2;
length+=2;
}
}
key_length+= keyseg->length;
if (keyseg->null_bit)
{
key_length++;
options|=HA_OPTION_PACK_KEYS;
keyseg->flag|=HA_NULL_PART;
keydef->flag|=HA_VAR_LENGTH_KEY | HA_NULL_PART_KEY;
} }
}
key_length+= keyseg->length;
if (keyseg->null_bit)
{
key_length++;
options|=HA_OPTION_PACK_KEYS;
keyseg->flag|=HA_NULL_PART;
keydef->flag|=HA_VAR_LENGTH_KEY | HA_NULL_PART_KEY;
}
} }
} /* if HA_FULLTEXT */ } /* if HA_FULLTEXT */
key_segs+=keydef->keysegs; key_segs+=keydef->keysegs;
......
...@@ -707,9 +707,10 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -707,9 +707,10 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
} }
else else
{ {
/* A variable length first key part */ /* Check if a variable length first key part */
if (*keypos & 128) /* Next key is packed */ if ((keyinfo->seg->flag & HA_PACK_KEY) && *keypos & 128)
{ {
/* Next key is packed against the current one */
uint next_length,prev_length,prev_pack_length,lastkey_length, uint next_length,prev_length,prev_pack_length,lastkey_length,
rest_length; rest_length;
if (keyinfo->seg[0].length >= 127) if (keyinfo->seg[0].length >= 127)
......
...@@ -830,6 +830,7 @@ uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -830,6 +830,7 @@ uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag,
} /* _mi_get_static_key */ } /* _mi_get_static_key */
/* Key with is packed against previous key or key with a NULL column */
uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page_pos, register uchar *key) register uchar **page_pos, register uchar *key)
...@@ -841,7 +842,6 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -841,7 +842,6 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
start_key=key; start_key=key;
for (keyseg=keyinfo->seg ; keyseg->type ;keyseg++) for (keyseg=keyinfo->seg ; keyseg->type ;keyseg++)
{ {
/* First key part is always packed !*/
if (keyseg->flag & HA_PACK_KEY) if (keyseg->flag & HA_PACK_KEY)
{ {
/* key with length, packed to previous key */ /* key with length, packed to previous key */
......
...@@ -200,7 +200,7 @@ static struct option long_options[] = ...@@ -200,7 +200,7 @@ static struct option long_options[] =
static void print_version(void) static void print_version(void)
{ {
printf("%s Ver 1.39 for %s at %s\n",my_progname,SYSTEM_TYPE, printf("%s Ver 1.40 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE); MACHINE_TYPE);
} }
...@@ -995,6 +995,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) ...@@ -995,6 +995,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
{ {
keyseg=keyinfo->seg; keyseg=keyinfo->seg;
if (keyinfo->flag & HA_NOSAME) text="unique "; if (keyinfo->flag & HA_NOSAME) text="unique ";
else if (keyinfo->flag & HA_FULLTEXT) text="fulltext ";
else text="multip."; else text="multip.";
pos=buff; pos=buff;
......
...@@ -138,6 +138,7 @@ while test $# -gt 0; do ...@@ -138,6 +138,7 @@ while test $# -gt 0; do
--debug) --debug)
EXTRA_MASTER_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/master.trace EXTRA_MASTER_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/master.trace
EXTRA_SLAVE_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace EXTRA_SLAVE_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug"
;; ;;
-- ) shift; break ;; -- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;; --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
...@@ -163,6 +164,8 @@ SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid" ...@@ -163,6 +164,8 @@ SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid"
SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld-slave.log" SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld-slave.log"
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/mysqld-slave.err" SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/mysqld-slave.err"
SMALL_SERVER="-O key_buffer_size=1M -O sort_buffer=256K -O max_heap_table_size=1M"
if [ x$SOURCE_DIST = x1 ] ; then if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR MY_BASEDIR=$MYSQL_TEST_DIR
else else
...@@ -335,7 +338,9 @@ start_master() ...@@ -335,7 +338,9 @@ start_master()
--log=$MASTER_MYLOG --default-character-set=latin1 \ --log=$MASTER_MYLOG --default-character-set=latin1 \
--core \ --core \
--tmpdir=$MYSQL_TMP_DIR \ --tmpdir=$MYSQL_TMP_DIR \
--language=english $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" --language=english \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
if [ x$DO_DDD = x1 ] if [ x$DO_DDD = x1 ]
then then
$ECHO "set args $master_args" > $GDB_MASTER_INIT $ECHO "set args $master_args" > $GDB_MASTER_INIT
...@@ -378,7 +383,9 @@ start_slave() ...@@ -378,7 +383,9 @@ start_slave()
--log=$SLAVE_MYLOG --default-character-set=latin1 \ --log=$SLAVE_MYLOG --default-character-set=latin1 \
--core \ --core \
--tmpdir=$MYSQL_TMP_DIR \ --tmpdir=$MYSQL_TMP_DIR \
--language=english $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" --language=english \
$SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
if [ x$DO_DDD = x1 ] if [ x$DO_DDD = x1 ]
then then
$ECHO "set args $master_args" > $GDB_SLAVE_INIT $ECHO "set args $master_args" > $GDB_SLAVE_INIT
...@@ -606,21 +613,23 @@ run_testcase () ...@@ -606,21 +613,23 @@ run_testcase ()
[ "$DO_GCOV" ] && gcov_prepare [ "$DO_GCOV" ] && gcov_prepare
# Ensure that no old mysqld test servers are running # Ensure that no old mysqld test servers are running
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 shutdown > /dev/null 2>&1 if [ -z "$USE_RUNNING_SERVER" ]
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 shutdown > /dev/null 2>&1 then
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 shutdown > /dev/null 2>&1
$ECHO "Installing Test Databases" $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 shutdown > /dev/null 2>&1
mysql_install_db $ECHO "Installing Test Databases"
mysql_install_db
#do not automagically start deamons if we are in gdb or running only one test #do not automagically start deamons if we are in gdb or running only one test
#case #case
if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ] if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ]
then then
mysql_start mysql_start
fi
$ECHO "Loading Standard Test Databases"
mysql_loadstd
fi fi
$ECHO "Loading Standard Test Databases"
mysql_loadstd
$ECHO "Starting Tests" $ECHO "Starting Tests"
...@@ -637,6 +646,7 @@ then ...@@ -637,6 +646,7 @@ then
do do
run_testcase $tf run_testcase $tf
done done
$RM -f $TIMEFILE # Remove for full test
fi fi
else else
tname=`$BASENAME $1 .test` tname=`$BASENAME $1 .test`
...@@ -651,8 +661,6 @@ fi ...@@ -651,8 +661,6 @@ fi
$ECHO $DASH72 $ECHO $DASH72
$ECHO $ECHO
$RM -f $TIMEFILE
if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ] if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
then then
mysql_stop mysql_stop
......
...@@ -6,3 +6,17 @@ Full-text indexes are called collections ...@@ -6,3 +6,17 @@ Full-text indexes are called collections
a b a b
Full-text indexes are called collections Full-text indexes are called collections
Only MyISAM tables support collections Only MyISAM tables support collections
id
id
id
3
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t2 1 tig 1 ticket A NULL NULL NULL
t2 1 tix 1 inhalt A NULL 1 NULL FULLTEXT
Table Create Table
t2 CREATE TABLE `t2` (
`ticket` int(11) default NULL,
`inhalt` text,
KEY `tig`(`ticket`),
FULLTEXT KEY `tix`(`inhalt`)
) TYPE=MyISAM
...@@ -16,7 +16,7 @@ pow(10,log10(10)) power(2,4) ...@@ -16,7 +16,7 @@ pow(10,log10(10)) power(2,4)
10.000000 16.000000 10.000000 16.000000
rand(999999) rand() rand(999999) rand()
0.18435012473199 0.76373626176616 0.18435012473199 0.76373626176616
PI() sin(pi()/2) cos(pi()/2) 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 3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
degrees(pi()) radians(360) degrees(pi()) radians(360)
180 6.2831853071796 180 6.2831853071796
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Test of fulltext index # Test of fulltext index
# #
drop table if exists t1,t2;
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),('Full-text indexes', 'are called collections'),('Only MyISAM tables','support collections'),('Function MATCH ... AGAINST()','is used to do a search'),('Full-text search in MySQL', 'implements vector space model'); INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),('Full-text indexes', 'are called collections'),('Only MyISAM tables','support collections'),('Function MATCH ... AGAINST()','is used to do a search'),('Full-text search in MySQL', 'implements vector space model');
select * from t1 where MATCH(a,b) AGAINST ("collections"); select * from t1 where MATCH(a,b) AGAINST ("collections");
...@@ -9,3 +11,37 @@ select * from t1 where MATCH(a,b) AGAINST ("indexes"); ...@@ -9,3 +11,37 @@ select * from t1 where MATCH(a,b) AGAINST ("indexes");
select * from t1 where MATCH(a,b) AGAINST ("indexes collections"); select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
delete from t1 where a like "MySQL%"; delete from t1 where a like "MySQL%";
drop table t1; drop table t1;
#
# Check bug reported by Matthias Urlichs
#
CREATE TABLE t1 (
id int(11),
ticket int(11),
KEY ti (id),
KEY tit (ticket)
)/*! type=MyISAM */;
INSERT INTO t1 VALUES (2,3),(1,2);
CREATE TABLE t2 (
ticket int(11),
inhalt text,
KEY tig (ticket),
fulltext index tix (inhalt(1)) /* this line modified by hand */
)/*! type=MyISAM */;
INSERT INTO t2 VALUES (1,'foo'),(2,'bar'),(3,'foobar');
select t1.id FROM t2 as ttxt,t1,t1 as ticket2 WHERE ticket2.id = ttxt.ticket AND t1.id = ticket2.ticket and match(ttxt.inhalt) against ('foobar');
# In the following query MySQL didn't use the fulltext index
select t1.id FROM t2 as ttxt,t1 INNER JOIN t1 as ticket2 ON ticket2.id = ttxt.ticket WHERE t1.id = ticket2.ticket and match(ttxt.inhalt) against ('foobar');
INSERT INTO t1 VALUES (3,3);
select t1.id FROM t2 as ttxt,t1 INNER JOIN t1 as ticket2 ON ticket2.id = ttxt.ticket WHERE t1.id = ticket2.ticket and match(ttxt.inhalt) against ('foobar');
# Check that we get 'fulltext' index in SHOW CREATE
show keys from t2;
show create table t2;
drop table t1,t2;
...@@ -11,5 +11,5 @@ select abs(-10), sign(-5), sign(5), sign(0); ...@@ -11,5 +11,5 @@ select abs(-10), sign(-5), sign(5), sign(0);
select log(exp(10)),exp(log(sqrt(10))*2); select log(exp(10)),exp(log(sqrt(10))*2);
select pow(10,log10(10)),power(2,4); select pow(10,log10(10)),power(2,4);
select rand(999999),rand(); select rand(999999),rand();
select pi(),sin(pi()/2),cos(pi()/2),tan(pi()),cot(1),asin(1),acos(0),atan(1); select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
select degrees(pi()),radians(360); select degrees(pi()),radians(360);
...@@ -100,6 +100,7 @@ uint my_b_fill(IO_CACHE *info) ...@@ -100,6 +100,7 @@ uint my_b_fill(IO_CACHE *info)
uint my_b_gets(IO_CACHE *info, char *to, uint max_length) uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
{ {
char *start = to;
uint length; uint length;
max_length--; /* Save place for end \0 */ max_length--; /* Save place for end \0 */
/* Calculate number of characters in buffer */ /* Calculate number of characters in buffer */
...@@ -115,10 +116,9 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length) ...@@ -115,10 +116,9 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
{ {
if ((*to++ = *pos++) == '\n') if ((*to++ = *pos++) == '\n')
{ {
length= (uint) (pos-info->rc_pos);
info->rc_pos=pos; info->rc_pos=pos;
*to='\0'; *to='\0';
return length; return (uint) (to-start);
} }
} }
if (!(max_length-=length)) if (!(max_length-=length))
...@@ -126,7 +126,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length) ...@@ -126,7 +126,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
/* Found enough charcters; Return found string */ /* Found enough charcters; Return found string */
info->rc_pos=pos; info->rc_pos=pos;
*to='\0'; *to='\0';
return length; return (uint) (to-start);
} }
if (!(length=my_b_fill(info))) if (!(length=my_b_fill(info)))
return 0; return 0;
......
...@@ -48,6 +48,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, ...@@ -48,6 +48,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str) my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
{ {
uint length; uint length;
...@@ -72,6 +73,7 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str) ...@@ -72,6 +73,7 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size) my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size)
{ {
DBUG_ENTER("dynstr_realloc"); DBUG_ENTER("dynstr_realloc");
...@@ -89,12 +91,18 @@ my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size) ...@@ -89,12 +91,18 @@ my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size)
my_bool dynstr_append(DYNAMIC_STRING *str, const char *append) my_bool dynstr_append(DYNAMIC_STRING *str, const char *append)
{
return dynstr_append_mem(str,append,strlen(append));
}
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
uint length)
{ {
char *new_ptr; char *new_ptr;
uint length=(uint) strlen(append)+1; if (str->length+length >= str->max_length)
if (str->length+length > str->max_length)
{ {
uint new_length=(str->length+length+str->alloc_increment-1)/ uint new_length=(str->length+length+str->alloc_increment)/
str->alloc_increment; str->alloc_increment;
new_length*=str->alloc_increment; new_length*=str->alloc_increment;
if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME)))) if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME))))
...@@ -103,10 +111,12 @@ my_bool dynstr_append(DYNAMIC_STRING *str, const char *append) ...@@ -103,10 +111,12 @@ my_bool dynstr_append(DYNAMIC_STRING *str, const char *append)
str->max_length=new_length; str->max_length=new_length;
} }
memcpy(str->str + str->length,append,length); memcpy(str->str + str->length,append,length);
str->length+=length-1; str->length+=length;
str->str[str->length]=0; /* Safety for C programs */
return FALSE; return FALSE;
} }
void dynstr_free(DYNAMIC_STRING *str) void dynstr_free(DYNAMIC_STRING *str)
{ {
if (str->str) if (str->str)
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
** If part, uniq field is found and full_name == 0 then x is expanded ** If part, uniq field is found and full_name == 0 then x is expanded
** to full field. ** to full field.
** full_name has the following bit values: ** full_name has the following bit values:
** If & 1 accept only hole names ** If & 1 accept only whole names
** If & 2 don't expand if half field ** If & 2 don't expand if half field
** If & 4 allow #number# as type ** If & 4 allow #number# as type
****************************************************************************/ ****************************************************************************/
......
...@@ -18,6 +18,14 @@ then ...@@ -18,6 +18,14 @@ then
shift 1 shift 1
fi fi
# Get optional suffix for distribution
SUFFIX=""
if test $# -gt 0 -a x$1 != x"-debug"
then
SUFFIX=$1
shift 1
fi
if test x$1 = x"-debug" if test x$1 = x"-debug"
then then
DEBUG=1 DEBUG=1
...@@ -33,7 +41,7 @@ fi ...@@ -33,7 +41,7 @@ fi
BASE=$TMP/my_dist BASE=$TMP/my_dist
if [ -d $BASE ] ; then if [ -d $BASE ] ; then
rm -rf $BASE rm -r -f $BASE
fi fi
mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \
...@@ -56,7 +64,10 @@ for i in extra/comp_err extra/replace extra/perror extra/resolveip \ ...@@ -56,7 +64,10 @@ for i in extra/comp_err extra/replace extra/perror extra/resolveip \
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \ client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest
do do
cp -p $i $BASE/bin if [ -f $i ]
then
cp -p $i $BASE/bin
fi
done done
cp -p config.h include/* $BASE/include cp -p config.h include/* $BASE/include
...@@ -67,10 +78,8 @@ cp -p support-files/* $BASE/support-files ...@@ -67,10 +78,8 @@ cp -p support-files/* $BASE/support-files
cp -p libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib cp -p libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib
cp -r -p sql/share/* $BASE/share/mysql cp -r -p sql/share/* $BASE/share/mysql
rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD
rm -rf $BASE/share/SCCS $BASE/share/*/SCCS
cp -p mysql-test/mysql-test-run mysql-test/install_test_db $BASE/mysql-test/ cp -p mysql-test/mysql-test-run mysql-test/install_test_db $BASE/mysql-test/
cp -p mysql-test/create-test-result $BASE/mysql-test
cp -p mysql-test/README $BASE/mysql-test/README cp -p mysql-test/README $BASE/mysql-test/README
cp -p mysql-test/include/*.inc $BASE/mysql-test/include cp -p mysql-test/include/*.inc $BASE/mysql-test/include
cp -p mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ cp -p mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
...@@ -89,13 +98,17 @@ mv $BASE/support-files/binary-configure $BASE/configure ...@@ -89,13 +98,17 @@ mv $BASE/support-files/binary-configure $BASE/configure
chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/configure chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/configure
cp -r -p sql-bench/* $BASE/sql-bench cp -r -p sql-bench/* $BASE/sql-bench
rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
rm -rf `find $BASE/sql-bench -name SCCS`
rm -rf `find $BASE/share -name SCCS`
# Change the distribution to a long descreptive name # Clean up if we did this from a bk tree
NEW_NAME=mysql-$version-$system-$machine if [ -d $BASE/sql-bench/SCCS ] ; then
find $BASE/share -name SCCS -print | xargs rm -r -f
find $BASE/sql-bench -name SCCS -print | xargs rm -r -f
fi
# Change the distribution to a long descriptive name
NEW_NAME=mysql-$version-$system-$machine$SUFFIX
BASE2=$TMP/$NEW_NAME BASE2=$TMP/$NEW_NAME
rm -rf $BASE2 rm -r -f $BASE2
mv $BASE $BASE2 mv $BASE $BASE2
BASE=$BASE2 BASE=$BASE2
# #
...@@ -160,6 +173,6 @@ cd $SOURCE ...@@ -160,6 +173,6 @@ cd $SOURCE
echo "Compressing archive" echo "Compressing archive"
gzip -9 $NEW_NAME.tar gzip -9 $NEW_NAME.tar
echo "Removing temporary directory" echo "Removing temporary directory"
rm -rf $BASE rm -r -f $BASE
echo "$NEW_NAME.tar.gz created" echo "$NEW_NAME.tar.gz created"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
IN_RPM=0 IN_RPM=0
case "$1" in case "$1" in
-IN-RPM) -IN-RPM)
IN_RPM="$1"; shift IN_RPM="1"; shift
;; ;;
esac esac
defaults= defaults=
......
...@@ -110,7 +110,7 @@ else ...@@ -110,7 +110,7 @@ else
fi fi
args= args=
parse_arguments `$print_defaults $defaults mysqld safe_mysqld` parse_arguments `$print_defaults $defaults mysqld server safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test ! -x $ledir/$MYSQLD if test ! -x $ledir/$MYSQLD
......
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:29:27 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 18:34:25
ATIS table test ATIS table test
...@@ -6,15 +6,15 @@ Creating tables ...@@ -6,15 +6,15 @@ Creating tables
Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data Inserting data
Time to insert (9768): 3 wallclock secs ( 0.64 usr 0.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert (9768): 3 wallclock secs ( 0.63 usr 0.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data Retrieving data
Time for select_simple_join (500): 2 wallclock secs ( 0.62 usr 0.39 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_simple_join (500): 2 wallclock secs ( 0.61 usr 0.39 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_join (100): 2 wallclock secs ( 0.47 usr 0.35 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_join (100): 1 wallclock secs ( 0.48 usr 0.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix_join (100): 10 wallclock secs ( 3.80 usr 2.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key_prefix_join (100): 11 wallclock secs ( 3.75 usr 2.76 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_distinct (800): 11 wallclock secs ( 1.63 usr 1.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_distinct (800): 11 wallclock secs ( 1.72 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (2800): 10 wallclock secs ( 1.48 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_group (2800): 10 wallclock secs ( 1.55 usr 0.68 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Removing tables Removing tables
Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 38 wallclock secs ( 8.65 usr 5.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 38 wallclock secs ( 8.76 usr 5.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Benchmark DBD suite: 2.11 Benchmark DBD suite: 2.11
Date of test: 2000-12-28 17:09:41 Date of test: 2001-01-03 18:34:24
Running tests on: Linux 2.2.13-SMP alpha Running tests on: Linux 2.2.13-SMP alpha
Arguments: Arguments:
Comments: Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; cxx 6.3 + ccc 6.2.9 Comments: Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; cxx 6.3 + ccc 6.2.9
Limits from: Limits from:
Server version: MySQL 3.23.30 gamma Server version: MySQL 3.23.30 gamma
ATIS: Total time: 38 wallclock secs ( 8.65 usr 5.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU) ATIS: Total time: 38 wallclock secs ( 8.76 usr 5.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
alter-table: Total time: 396 wallclock secs ( 0.30 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU) alter-table: Total time: 392 wallclock secs ( 0.29 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
big-tables: Total time: 41 wallclock secs ( 8.30 usr 10.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU) big-tables: Total time: 41 wallclock secs ( 8.53 usr 10.35 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
connect: Total time: 74 wallclock secs (32.31 usr 18.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU) connect: Total time: 75 wallclock secs (31.88 usr 18.52 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
create: Total time: 207 wallclock secs (10.36 usr 4.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU) create: Total time: 134 wallclock secs (10.30 usr 4.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
insert: Total time: 1932 wallclock secs (465.91 usr 251.37 sys + 0.00 cusr 0.00 csys = 0.00 CPU) insert: Total time: 1914 wallclock secs (453.84 usr 255.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
select: Total time: 1127 wallclock secs (61.16 usr 29.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) select: Total time: 1144 wallclock secs (59.15 usr 27.51 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
wisconsin: Total time: 18 wallclock secs ( 3.58 usr 2.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU) wisconsin: Total time: 18 wallclock secs ( 3.58 usr 2.87 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
All 8 test executed successfully All 8 test executed successfully
Totals per operation: Totals per operation:
Operation seconds usr sys cpu tests Operation seconds usr sys cpu tests
alter_table_add 213.00 0.17 0.06 0.00 992 alter_table_add 213.00 0.18 0.06 0.00 992
alter_table_drop 175.00 0.06 0.04 0.00 496 alter_table_drop 170.00 0.05 0.04 0.00 496
connect 13.00 7.51 2.43 0.00 10000 connect 14.00 7.52 2.57 0.00 10000
connect+select_1_row 17.00 7.95 3.44 0.00 10000 connect+select_1_row 17.00 7.74 3.33 0.00 10000
connect+select_simple 16.00 7.69 3.23 0.00 10000 connect+select_simple 16.00 7.76 3.27 0.00 10000
count 50.00 0.04 0.01 0.00 100 count 51.00 0.05 0.01 0.00 100
count_distinct 102.00 0.71 0.21 0.00 2000 count_distinct 99.00 0.70 0.22 0.00 2000
count_distinct_big 133.00 8.01 9.25 0.00 120 count_distinct_big 131.00 7.32 8.60 0.00 120
count_distinct_group 63.00 1.16 0.69 0.00 1000 count_distinct_group 63.00 1.11 0.59 0.00 1000
count_distinct_group_on_key 42.00 0.45 0.16 0.00 1000 count_distinct_group_on_key 43.00 0.46 0.15 0.00 1000
count_distinct_group_on_key_parts 62.00 1.20 0.66 0.00 1000 count_distinct_group_on_key_parts 63.00 1.12 0.57 0.00 1000
count_group_on_key_parts 38.00 1.16 0.66 0.00 1000 count_group_on_key_parts 39.00 1.03 0.61 0.00 1000
count_on_key 395.00 16.46 4.54 0.00 50100 count_on_key 405.00 16.37 4.36 0.00 50100
create+drop 13.00 2.77 1.02 0.00 10000 create+drop 12.00 2.63 0.97 0.00 10000
create_MANY_tables 164.00 1.93 0.57 0.00 10000 create_MANY_tables 92.00 1.81 0.60 0.00 10000
create_index 4.00 0.00 0.00 0.00 8 create_index 4.00 0.00 0.00 0.00 8
create_key+drop 17.00 4.14 1.36 0.00 10000 create_key+drop 17.00 4.27 1.28 0.00 10000
create_table 0.00 0.00 0.00 0.00 31 create_table 0.00 0.00 0.00 0.00 31
delete_all 11.00 0.00 0.00 0.00 12 delete_all 12.00 0.00 0.00 0.00 12
delete_all_many_keys 50.00 0.01 0.01 0.00 1 delete_all_many_keys 49.00 0.01 0.01 0.00 1
delete_big 0.00 0.00 0.00 0.00 1 delete_big 0.00 0.00 0.00 0.00 1
delete_big_many_keys 50.00 0.01 0.01 0.00 128 delete_big_many_keys 49.00 0.01 0.01 0.00 128
delete_key 5.00 0.60 0.53 0.00 10000 delete_key 5.00 0.75 0.63 0.00 10000
drop_index 4.00 0.00 0.00 0.00 8 drop_index 4.00 0.00 0.00 0.00 8
drop_table 0.00 0.00 0.00 0.00 28 drop_table 0.00 0.00 0.00 0.00 28
drop_table_when_MANY_tables 7.00 0.68 0.64 0.00 10000 drop_table_when_MANY_tables 7.00 0.71 0.58 0.00 10000
insert 133.00 23.24 21.08 0.00 350768 insert 136.00 24.25 21.36 0.00 350768
insert_duplicates 38.00 5.55 6.19 0.00 100000 insert_duplicates 37.00 5.54 6.23 0.00 100000
insert_key 96.00 8.23 5.98 0.00 100000 insert_key 94.00 8.92 5.51 0.00 100000
insert_many_fields 14.00 0.35 0.12 0.00 2000 insert_many_fields 14.00 0.35 0.12 0.00 2000
insert_select_1_key 6.00 0.00 0.00 0.00 1 insert_select_1_key 5.00 0.00 0.00 0.00 1
insert_select_2_keys 6.00 0.00 0.00 0.00 1 insert_select_2_keys 7.00 0.00 0.00 0.00 1
min_max 22.00 0.02 0.01 0.00 60 min_max 22.00 0.02 0.01 0.00 60
min_max_on_key 162.00 26.32 7.66 0.00 85000 min_max_on_key 166.00 26.17 7.53 0.00 85000
multiple_value_insert 7.00 2.08 0.05 0.00 100000 multiple_value_insert 7.00 2.10 0.06 0.00 100000
order_by_big 53.00 20.57 21.79 0.00 10 order_by_big 52.00 20.66 21.59 0.00 10
order_by_big_key 38.00 22.77 15.36 0.00 10 order_by_big_key 38.00 22.00 15.43 0.00 10
order_by_big_key2 35.00 19.87 14.91 0.00 10 order_by_big_key2 35.00 19.97 14.93 0.00 10
order_by_big_key_desc 38.00 22.72 15.24 0.00 10 order_by_big_key_desc 37.00 21.90 15.47 0.00 10
order_by_big_key_diff 49.00 20.43 21.94 0.00 10 order_by_big_key_diff 50.00 20.51 21.78 0.00 10
order_by_big_key_prefix 35.00 19.98 14.81 0.00 10 order_by_big_key_prefix 35.00 19.88 14.96 0.00 10
order_by_key2_diff 5.00 1.81 1.27 0.00 500 order_by_key2_diff 5.00 1.89 1.22 0.00 500
order_by_key_prefix 3.00 1.07 0.64 0.00 500 order_by_key_prefix 3.00 1.07 0.65 0.00 500
order_by_range 4.00 1.09 0.62 0.00 500 order_by_range 4.00 1.05 0.68 0.00 500
outer_join 60.00 0.00 0.00 0.00 10 outer_join 61.00 0.00 0.00 0.00 10
outer_join_found 56.00 0.00 0.00 0.00 10 outer_join_found 56.00 0.00 0.00 0.00 10
outer_join_not_found 37.00 0.00 0.00 0.00 500 outer_join_not_found 38.00 0.00 0.00 0.00 500
outer_join_on_key 44.00 0.00 0.00 0.00 10 outer_join_on_key 44.00 0.00 0.00 0.00 10
select_1_row 2.00 0.46 1.12 0.00 10000 select_1_row 2.00 0.39 0.97 0.00 10000
select_2_rows 3.00 0.36 1.00 0.00 10000 select_2_rows 3.00 0.36 0.97 0.00 10000
select_big 56.00 28.42 21.18 0.00 10080 select_big 55.00 27.62 21.08 0.00 10080
select_column+column 3.00 0.28 0.76 0.00 10000 select_column+column 3.00 0.31 0.72 0.00 10000
select_diff_key 151.00 0.25 0.04 0.00 500 select_diff_key 154.00 0.22 0.07 0.00 500
select_distinct 11.00 1.63 1.04 0.00 800 select_distinct 11.00 1.72 0.97 0.00 800
select_group 50.00 1.52 0.68 0.00 2911 select_group 50.00 1.61 0.69 0.00 2911
select_group_when_MANY_tables 6.00 0.84 0.83 0.00 10000 select_group_when_MANY_tables 6.00 0.88 0.86 0.00 10000
select_join 2.00 0.47 0.35 0.00 100 select_join 1.00 0.48 0.34 0.00 100
select_key 141.00 75.34 22.71 0.00 200000 select_key 137.00 73.11 21.92 0.00 200000
select_key2 146.00 75.75 22.08 0.00 200000 select_key2 141.00 71.45 23.77 0.00 200000
select_key_prefix 147.00 76.05 21.66 0.00 200000 select_key_prefix 142.00 71.84 23.50 0.00 200000
select_key_prefix_join 10.00 3.80 2.75 0.00 100 select_key_prefix_join 11.00 3.75 2.76 0.00 100
select_many_fields 26.00 7.94 10.60 0.00 2000 select_many_fields 26.00 8.17 10.23 0.00 2000
select_range 227.00 9.67 5.91 0.00 410 select_range 227.00 8.60 5.58 0.00 410
select_range_key2 19.00 6.72 2.30 0.00 25010 select_range_key2 18.00 6.51 2.11 0.00 25010
select_range_prefix 19.00 6.65 2.24 0.00 25010 select_range_prefix 20.00 6.30 2.34 0.00 25010
select_simple 1.00 0.31 0.80 0.00 10000 select_simple 1.00 0.29 0.79 0.00 10000
select_simple_join 2.00 0.62 0.39 0.00 500 select_simple_join 2.00 0.61 0.39 0.00 500
update_big 26.00 0.00 0.00 0.00 10 update_big 28.00 0.00 0.00 0.00 10
update_of_key 27.00 3.58 3.11 0.00 50000 update_of_key 26.00 3.42 2.98 0.00 50000
update_of_key_big 19.00 0.04 0.03 0.00 501 update_of_key_big 19.00 0.04 0.03 0.00 501
update_of_primary_key_many_keys 21.00 0.02 0.01 0.00 256 update_of_primary_key_many_keys 22.00 0.02 0.01 0.00 256
update_with_key 135.00 21.98 17.77 0.00 300000 update_with_key 131.00 21.64 18.34 0.00 300000
update_with_key_prefix 42.00 7.22 5.96 0.00 100000 update_with_key_prefix 40.00 7.20 6.06 0.00 100000
wisc_benchmark 4.00 1.71 0.98 0.00 114 wisc_benchmark 4.00 1.77 0.99 0.00 114
TOTALS 3881.00 590.44 323.49 0.00 2046247 TOTALS 3801.00 576.19 324.46 0.00 2046247
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:30:07 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 18:35:03
Testing of ALTER TABLE Testing of ALTER TABLE
Testing with 1000 columns and 1000 rows in 20 steps Testing with 1000 columns and 1000 rows in 20 steps
Insert data into the table Insert data into the table
Time for insert (1000) 0 wallclock secs ( 0.06 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert (1000) 1 wallclock secs ( 0.06 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_add (992): 213 wallclock secs ( 0.17 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for alter_table_add (992): 213 wallclock secs ( 0.18 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for drop_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_drop (496): 175 wallclock secs ( 0.06 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for alter_table_drop (496): 170 wallclock secs ( 0.05 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 396 wallclock secs ( 0.30 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 392 wallclock secs ( 0.29 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:36:43 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 18:41:35
Testing of some unusual tables Testing of some unusual tables
All tests are done 1000 times with 1000 fields All tests are done 1000 times with 1000 fields
Testing table with 1000 fields Testing table with 1000 fields
Testing select * from table with 1 record Testing select * from table with 1 record
Time to select_many_fields(1000): 10 wallclock secs ( 3.89 usr 5.32 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_many_fields(1000): 10 wallclock secs ( 4.03 usr 5.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select all_fields from table with 1 record Testing select all_fields from table with 1 record
Time to select_many_fields(1000): 16 wallclock secs ( 4.05 usr 5.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_many_fields(1000): 16 wallclock secs ( 4.14 usr 5.10 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert VALUES() Testing insert VALUES()
Time to insert_many_fields(1000): 5 wallclock secs ( 0.32 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert_many_fields(1000): 5 wallclock secs ( 0.32 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert (all_fields) VALUES() Testing insert (all_fields) VALUES()
Time to insert_many_fields(1000): 9 wallclock secs ( 0.03 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert_many_fields(1000): 9 wallclock secs ( 0.03 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 41 wallclock secs ( 8.30 usr 10.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 41 wallclock secs ( 8.53 usr 10.35 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:37:25 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 18:42:16
Testing the speed of connecting to the server and sending of data Testing the speed of connecting to the server and sending of data
All tests are done 10000 times All tests are done 10000 times
Testing connection/disconnect Testing connection/disconnect
Time to connect (10000): 13 wallclock secs ( 7.51 usr 2.43 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to connect (10000): 14 wallclock secs ( 7.52 usr 2.57 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test connect/simple select/disconnect Test connect/simple select/disconnect
Time for connect+select_simple (10000): 16 wallclock secs ( 7.69 usr 3.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for connect+select_simple (10000): 16 wallclock secs ( 7.76 usr 3.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test simple select Test simple select
Time for select_simple (10000): 1 wallclock secs ( 0.31 usr 0.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_simple (10000): 1 wallclock secs ( 0.29 usr 0.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing connect/select 1 row from table/disconnect Testing connect/select 1 row from table/disconnect
Time to connect+select_1_row (10000): 17 wallclock secs ( 7.95 usr 3.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to connect+select_1_row (10000): 17 wallclock secs ( 7.74 usr 3.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 1 row from table Testing select 1 row from table
Time to select_1_row (10000): 2 wallclock secs ( 0.46 usr 1.12 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_1_row (10000): 2 wallclock secs ( 0.39 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 2 rows from table Testing select 2 rows from table
Time to select_2_rows (10000): 3 wallclock secs ( 0.36 usr 1.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_2_rows (10000): 3 wallclock secs ( 0.36 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test select with aritmetic (+) Test select with aritmetic (+)
Time for select_column+column (10000): 3 wallclock secs ( 0.28 usr 0.76 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_column+column (10000): 3 wallclock secs ( 0.31 usr 0.72 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing retrieval of big records (65000 bytes) Testing retrieval of big records (65000 bytes)
Time to select_big (10000): 19 wallclock secs ( 7.75 usr 6.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_big (10000): 19 wallclock secs ( 7.50 usr 5.90 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 74 wallclock secs (32.31 usr 18.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 75 wallclock secs (31.88 usr 18.52 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:38:39 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 18:43:31
Testing the speed of creating and droping tables Testing the speed of creating and droping tables
Testing with 10000 tables and 10000 loop count Testing with 10000 tables and 10000 loop count
Testing create of tables Testing create of tables
Time for create_MANY_tables (10000): 164 wallclock secs ( 1.93 usr 0.57 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_MANY_tables (10000): 92 wallclock secs ( 1.81 usr 0.60 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Accessing tables Accessing tables
Time to select_group_when_MANY_tables (10000): 6 wallclock secs ( 0.84 usr 0.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_group_when_MANY_tables (10000): 6 wallclock secs ( 0.88 usr 0.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing drop Testing drop
Time for drop_table_when_MANY_tables (10000): 7 wallclock secs ( 0.68 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for drop_table_when_MANY_tables (10000): 7 wallclock secs ( 0.71 usr 0.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing create+drop Testing create+drop
Time for create+drop (10000): 13 wallclock secs ( 2.77 usr 1.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create+drop (10000): 12 wallclock secs ( 2.63 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_key+drop (10000): 17 wallclock secs ( 4.14 usr 1.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_key+drop (10000): 17 wallclock secs ( 4.27 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 207 wallclock secs (10.36 usr 4.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 134 wallclock secs (10.30 usr 4.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:42:07 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 18:45:45
Testing the speed of inserting data into 1 table and do some selects on it. Testing the speed of inserting data into 1 table and do some selects on it.
The tests are done with a table that has 100000 rows. The tests are done with a table that has 100000 rows.
...@@ -8,80 +8,80 @@ Creating tables ...@@ -8,80 +8,80 @@ Creating tables
Inserting 100000 rows in order Inserting 100000 rows in order
Inserting 100000 rows in reverse order Inserting 100000 rows in reverse order
Inserting 100000 rows in random order Inserting 100000 rows in random order
Time for insert (300000): 113 wallclock secs (20.01 usr 17.88 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert (300000): 115 wallclock secs (21.05 usr 18.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert of duplicates Testing insert of duplicates
Time for insert_duplicates (100000): 38 wallclock secs ( 5.55 usr 6.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert_duplicates (100000): 37 wallclock secs ( 5.54 usr 6.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data from the table Retrieving data from the table
Time for select_big (10:3000000): 36 wallclock secs (20.53 usr 14.90 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_big (10:3000000): 35 wallclock secs (19.98 usr 15.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key (10:3000000): 38 wallclock secs (22.77 usr 15.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_big_key (10:3000000): 38 wallclock secs (22.00 usr 15.43 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_desc (10:3000000): 38 wallclock secs (22.72 usr 15.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_big_key_desc (10:3000000): 37 wallclock secs (21.90 usr 15.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_prefix (10:3000000): 35 wallclock secs (19.98 usr 14.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_big_key_prefix (10:3000000): 35 wallclock secs (19.88 usr 14.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key2 (10:3000000): 35 wallclock secs (19.87 usr 14.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_big_key2 (10:3000000): 35 wallclock secs (19.97 usr 14.93 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_diff (10:3000000): 49 wallclock secs (20.43 usr 21.94 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_big_key_diff (10:3000000): 50 wallclock secs (20.51 usr 21.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big (10:3000000): 53 wallclock secs (20.57 usr 21.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_big (10:3000000): 52 wallclock secs (20.66 usr 21.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_range (500:125750): 4 wallclock secs ( 1.09 usr 0.62 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_range (500:125750): 4 wallclock secs ( 1.05 usr 0.68 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key_prefix (500:125750): 3 wallclock secs ( 1.07 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_key_prefix (500:125750): 3 wallclock secs ( 1.07 usr 0.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key2_diff (500:250500): 5 wallclock secs ( 1.81 usr 1.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_key2_diff (500:250500): 5 wallclock secs ( 1.89 usr 1.22 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_diff_key (500:1000): 151 wallclock secs ( 0.25 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_diff_key (500:1000): 154 wallclock secs ( 0.22 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_prefix (5010:42084): 10 wallclock secs ( 2.87 usr 0.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_prefix (5010:42084): 11 wallclock secs ( 2.69 usr 1.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (5010:42084): 11 wallclock secs ( 2.92 usr 1.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_key2 (5010:42084): 10 wallclock secs ( 2.88 usr 0.84 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix (200000): 147 wallclock secs (76.05 usr 21.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key_prefix (200000): 142 wallclock secs (71.84 usr 23.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key (200000): 141 wallclock secs (75.34 usr 22.71 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key (200000): 137 wallclock secs (73.11 usr 21.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2 (200000): 146 wallclock secs (75.75 usr 22.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key2 (200000): 141 wallclock secs (71.45 usr 23.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test of compares with simple ranges Test of compares with simple ranges
Time for select_range_prefix (20000:43500): 9 wallclock secs ( 3.78 usr 1.32 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_prefix (20000:43500): 9 wallclock secs ( 3.61 usr 1.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (20000:43500): 8 wallclock secs ( 3.80 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_key2 (20000:43500): 8 wallclock secs ( 3.63 usr 1.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (111): 40 wallclock secs ( 0.04 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_group (111): 40 wallclock secs ( 0.06 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (15000): 9 wallclock secs ( 4.77 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for min_max_on_key (15000): 9 wallclock secs ( 4.57 usr 1.41 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max (60): 22 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for min_max (60): 22 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (100): 40 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_on_key (100): 36 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count (100): 50 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count (100): 51 wallclock secs ( 0.05 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (20): 52 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_big (20): 52 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys with functions Testing update of keys with functions
Time for update_of_key (50000): 27 wallclock secs ( 3.58 usr 3.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_of_key (50000): 26 wallclock secs ( 3.42 usr 2.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_key_big (501): 19 wallclock secs ( 0.04 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_of_key_big (501): 19 wallclock secs ( 0.04 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update with key Testing update with key
Time for update_with_key (300000): 135 wallclock secs (21.98 usr 17.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_with_key (300000): 131 wallclock secs (21.64 usr 18.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_with_key_prefix (100000): 42 wallclock secs ( 7.22 usr 5.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_with_key_prefix (100000): 40 wallclock secs ( 7.20 usr 6.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of all rows Testing update of all rows
Time for update_big (10): 26 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_big (10): 28 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing left outer join Testing left outer join
Time for outer_join_on_key (10:10): 44 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join_on_key (10:10): 44 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join (10:10): 60 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join (10:10): 61 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_found (10:10): 56 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join_found (10:10): 56 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_not_found (500:10): 37 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join_not_found (500:10): 38 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing INSERT INTO ... SELECT Testing INSERT INTO ... SELECT
Time for insert_select_1_key (1): 6 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert_select_1_key (1): 5 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert_select_2_keys (1): 6 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert_select_2_keys (1): 7 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(2): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for drop table(2): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing delete Testing delete
Time for delete_key (10000): 5 wallclock secs ( 0.60 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_key (10000): 5 wallclock secs ( 0.75 usr 0.63 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all (12): 11 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_all (12): 12 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Insert into table with 16 keys and with a primary key with 16 parts Insert into table with 16 keys and with a primary key with 16 parts
Time for insert_key (100000): 96 wallclock secs ( 8.23 usr 5.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert_key (100000): 94 wallclock secs ( 8.92 usr 5.51 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys Testing update of keys
Time for update_of_primary_key_many_keys (256): 21 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_of_primary_key_many_keys (256): 22 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting rows from the table Deleting rows from the table
Time for delete_big_many_keys (128): 50 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_big_many_keys (128): 49 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting everything from table Deleting everything from table
Time for delete_all_many_keys (1): 50 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_all_many_keys (1): 49 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting 100000 rows with multiple values Inserting 100000 rows with multiple values
Time for multiple_value_insert (100000): 7 wallclock secs ( 2.08 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for multiple_value_insert (100000): 7 wallclock secs ( 2.10 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 1932 wallclock secs (465.91 usr 251.37 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 1914 wallclock secs (453.84 usr 255.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 16:14:21 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 19:17:40
Testing the speed of selecting on keys that consist of many parts Testing the speed of selecting on keys that consist of many parts
The test-table has 10000 rows and the test is done with 500 ranges. The test-table has 10000 rows and the test is done with 500 ranges.
Creating table Creating table
Inserting 10000 rows Inserting 10000 rows
Time to insert (10000): 3 wallclock secs ( 0.72 usr 0.71 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert (10000): 4 wallclock secs ( 0.75 usr 0.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing big selects on the table Testing big selects on the table
Time for select_big (70:17207): 1 wallclock secs ( 0.14 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_big (70:17207): 1 wallclock secs ( 0.14 usr 0.10 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range (410:1057904): 227 wallclock secs ( 9.67 usr 5.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range (410:1057904): 227 wallclock secs ( 8.60 usr 5.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (70000): 153 wallclock secs (21.55 usr 6.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for min_max_on_key (70000): 157 wallclock secs (21.60 usr 6.12 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (50000): 355 wallclock secs (16.42 usr 4.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_on_key (50000): 369 wallclock secs (16.33 usr 4.35 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_group_on_key_parts (1000:100000): 38 wallclock secs ( 1.16 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_group_on_key_parts (1000:100000): 39 wallclock secs ( 1.03 usr 0.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing count(distinct) on the table Testing count(distinct) on the table
Time for count_distinct (2000:2000): 102 wallclock secs ( 0.71 usr 0.21 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct (2000:2000): 99 wallclock secs ( 0.70 usr 0.22 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key (1000:6000): 42 wallclock secs ( 0.45 usr 0.16 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_group_on_key (1000:6000): 43 wallclock secs ( 0.46 usr 0.15 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key_parts (1000:100000): 62 wallclock secs ( 1.20 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_group_on_key_parts (1000:100000): 63 wallclock secs ( 1.12 usr 0.57 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group (1000:100000): 63 wallclock secs ( 1.16 usr 0.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_group (1000:100000): 63 wallclock secs ( 1.11 usr 0.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (100:1000000): 81 wallclock secs ( 8.00 usr 9.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_big (100:1000000): 79 wallclock secs ( 7.31 usr 8.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 1127 wallclock secs (61.16 usr 29.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 1144 wallclock secs (59.15 usr 27.51 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 16:33:09 Testing server 'MySQL 3.23.30 gamma' at 2001-01-03 19:36:45
Wisconsin benchmark test Wisconsin benchmark test
Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data Inserting data
Time to insert (31000): 14 wallclock secs ( 1.87 usr 1.88 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert (31000): 14 wallclock secs ( 1.82 usr 1.87 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Running actual benchmark Running actual benchmark
Time for wisc_benchmark (114): 4 wallclock secs ( 1.71 usr 0.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for wisc_benchmark (114): 4 wallclock secs ( 1.77 usr 0.99 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 18 wallclock secs ( 3.58 usr 2.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 18 wallclock secs ( 3.58 usr 2.87 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
...@@ -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.11"; $benchmark_version="2.11a";
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";
...@@ -51,7 +51,7 @@ $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server", ...@@ -51,7 +51,7 @@ $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server",
"user", "host", "database", "password", "user", "host", "database", "password",
"use-old-results","skip-test", "use-old-results","skip-test",
"machine", "dir", "suffix", "log")); "machine", "dir", "suffix", "log"));
GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","old-headers","die-on-errors","create-options=s","hires","tcpip") || usage(); GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","old-headers","die-on-errors","create-options=s","hires","tcpip","silent") || usage();
usage() if ($opt_help); usage() if ($opt_help);
$server=get_server($opt_server,$opt_host,$opt_database,$opt_odbc, $server=get_server($opt_server,$opt_host,$opt_database,$opt_odbc,
...@@ -495,12 +495,15 @@ All benchmarks takes the following options: ...@@ -495,12 +495,15 @@ All benchmarks takes the following options:
Known servers names are: Access, Adabas, AdabasD, Empress, Oracle, Known servers names are: Access, Adabas, AdabasD, Empress, Oracle,
Informix, DB2, mSQL, MS-SQL, MySQL, Pg, Solid and Sybase Informix, DB2, mSQL, MS-SQL, MySQL, Pg, Solid and Sybase
--silent
Don't print info about the server when starting test.
--skip-delete --skip-delete
This is a test specific option that is only used when debugging a test. This is a test specific option that is only used when debugging a test.
This will keep the test tables after the test is run. This will keep the test tables after the test is run.
--skip-test=test1[,test2,...] --skip-test=test1[,test2,...]
For run-all-programs; Don\'t execute the named tests For run-all-programs; Don\'t execute the named tests.
--small-test --small-test
This runs some tests with smaller limits to get a faster test. This runs some tests with smaller limits to get a faster test.
......
...@@ -258,7 +258,7 @@ ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ ...@@ -258,7 +258,7 @@ ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */
ulong query_id=1L,long_query_count,long_query_time,aborted_threads, ulong query_id=1L,long_query_count,long_query_time,aborted_threads,
aborted_connects,delayed_insert_timeout,delayed_insert_limit, aborted_connects,delayed_insert_timeout,delayed_insert_limit,
delayed_queue_size,delayed_insert_threads,delayed_insert_writes, delayed_queue_size,delayed_insert_threads,delayed_insert_writes,
delayed_rows_in_use,delayed_insert_errors,flush_time; delayed_rows_in_use,delayed_insert_errors,flush_time, thread_created;
ulong filesort_rows, filesort_range_count, filesort_scan_count; ulong filesort_rows, filesort_range_count, filesort_scan_count;
ulong filesort_merge_passes; ulong filesort_merge_passes;
ulong select_range_check_count, select_range_count, select_scan_count; ulong select_range_check_count, select_range_count, select_scan_count;
...@@ -801,7 +801,9 @@ static void server_init(void) ...@@ -801,7 +801,9 @@ static void server_init(void)
sql_print_error("Do you already have another mysqld server running on port: %d ?",mysql_port); sql_print_error("Do you already have another mysqld server running on port: %d ?",mysql_port);
unireg_abort(1); unireg_abort(1);
} }
(void) listen(ip_sock,(int) back_log); if (listen(ip_sock,(int) back_log) < 0)
sql_print_error("Warning: listen() on TCP/IP failed with error %d",
errno);
} }
if (mysqld_chroot) if (mysqld_chroot)
...@@ -886,7 +888,9 @@ static void server_init(void) ...@@ -886,7 +888,9 @@ static void server_init(void)
#if defined(S_IFSOCK) && defined(SECURE_SOCKETS) #if defined(S_IFSOCK) && defined(SECURE_SOCKETS)
(void) chmod(mysql_unix_port,S_IFSOCK); /* Fix solaris 2.6 bug */ (void) chmod(mysql_unix_port,S_IFSOCK); /* Fix solaris 2.6 bug */
#endif #endif
(void) listen(unix_sock,(int) back_log); if (listen(unix_sock,(int) back_log) < 0)
sql_print_error("Warning: listen() on Unix socket failed with error %d",
errno);
} }
#endif #endif
DBUG_PRINT("info",("server started")); DBUG_PRINT("info",("server started"));
...@@ -1082,6 +1086,8 @@ inline static __volatile__ void trace_stack() ...@@ -1082,6 +1086,8 @@ inline static __volatile__ void trace_stack()
uchar **stack_bottom; uchar **stack_bottom;
uchar** ebp; uchar** ebp;
LINT_INIT(ebp); LINT_INIT(ebp);
LINT_INIT(stack_bottom);
fprintf(stderr, fprintf(stderr,
"Attemping backtrace. You can use the following information to find out\n\ "Attemping backtrace. You can use the following information to find out\n\
where mysqld died. If you see no messages after this, something went\n\ where mysqld died. If you see no messages after this, something went\n\
...@@ -1099,12 +1105,15 @@ terribly wrong\n"); ...@@ -1099,12 +1105,15 @@ terribly wrong\n");
} }
if (!thd) if (!thd)
{ {
fprintf(stderr, "Cannot determine thread, ebp=%p, aborting backtrace\n", fprintf(stderr, "Cannot determine thread, ebp=%p, backtrace may not be correct\n", ebp);
ebp); /* Assume that the stack starts at the previous even 65K */
return; ulong tmp= min(0x10000,thread_stack);
stack_bottom= (uchar**) (((ulong) &stack_bottom + tmp) &
~(ulong) 0xFFFF);
} }
stack_bottom = (uchar**)thd->thread_stack; else
if(ebp > stack_bottom || ebp < stack_bottom - thread_stack) stack_bottom = (uchar**) thd->thread_stack;
if (ebp > stack_bottom || ebp < stack_bottom - thread_stack)
{ {
fprintf(stderr, fprintf(stderr,
"Bogus stack limit or frame pointer, aborting backtrace\n"); "Bogus stack limit or frame pointer, aborting backtrace\n");
...@@ -2010,6 +2019,7 @@ static void create_new_thread(THD *thd) ...@@ -2010,6 +2019,7 @@ static void create_new_thread(THD *thd)
{ {
int error; int error;
thread_count++; thread_count++;
thread_created++;
threads.append(thd); threads.append(thd);
DBUG_PRINT("info",(("creating thread %d"), thd->thread_id)); DBUG_PRINT("info",(("creating thread %d"), thd->thread_id));
thd->connect_time = time(NULL); thd->connect_time = time(NULL);
...@@ -2595,7 +2605,7 @@ CHANGEABLE_VAR changeable_vars[] = { ...@@ -2595,7 +2605,7 @@ CHANGEABLE_VAR changeable_vars[] = {
{ "thread_concurrency", (long*) &concurrency, { "thread_concurrency", (long*) &concurrency,
DEFAULT_CONCURRENCY, 1, 512, 0, 1 }, DEFAULT_CONCURRENCY, 1, 512, 0, 1 },
{ "thread_cache_size", (long*) &thread_cache_size, { "thread_cache_size", (long*) &thread_cache_size,
0, 1, 16384, 0, 1 }, 0, 0, 16384, 0, 1 },
{ "tmp_table_size", (long*) &tmp_table_size, { "tmp_table_size", (long*) &tmp_table_size,
1024*1024L, 1024, ~0L, MALLOC_OVERHEAD, 1 }, 1024*1024L, 1024, ~0L, MALLOC_OVERHEAD, 1 },
{ "thread_stack", (long*) &thread_stack, { "thread_stack", (long*) &thread_stack,
...@@ -2748,6 +2758,7 @@ struct show_var_st status_vars[]= { ...@@ -2748,6 +2758,7 @@ struct show_var_st status_vars[]= {
{"Sort_rows", (char*) &filesort_rows, SHOW_LONG}, {"Sort_rows", (char*) &filesort_rows, SHOW_LONG},
{"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG}, {"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG},
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST}, {"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST},
{"Threads_created", (char*) &thread_created, SHOW_LONG_CONST},
{"Threads_connected", (char*) &thread_count, SHOW_INT_CONST}, {"Threads_connected", (char*) &thread_count, SHOW_INT_CONST},
{"Threads_running", (char*) &thread_running, SHOW_INT_CONST}, {"Threads_running", (char*) &thread_running, SHOW_INT_CONST},
{"Uptime", (char*) 0, SHOW_STARTTIME}, {"Uptime", (char*) 0, SHOW_STARTTIME},
......
...@@ -302,7 +302,6 @@ fi ...@@ -302,7 +302,6 @@ fi
%attr(755, root, root) /usr/bin/mysql_fix_privilege_tables %attr(755, root, root) /usr/bin/mysql_fix_privilege_tables
%attr(755, root, root) /usr/bin/mysql_convert_table_format %attr(755, root, root) /usr/bin/mysql_convert_table_format
%attr(755, root, root) /usr/bin/mysql_install_db %attr(755, root, root) /usr/bin/mysql_install_db
%attr(755, root, root) /usr/bin/mysql_config
%attr(755, root, root) /usr/bin/mysql_setpermission %attr(755, root, root) /usr/bin/mysql_setpermission
%attr(755, root, root) /usr/bin/mysql_zap %attr(755, root, root) /usr/bin/mysql_zap
%attr(755, root, root) /usr/bin/mysqlbug %attr(755, root, root) /usr/bin/mysqlbug
......
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