Commit 07b1f0dc authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Fixed --no-defaults in mysqltest

parent 38cd62e8
...@@ -184,3 +184,4 @@ mysqld.sym ...@@ -184,3 +184,4 @@ mysqld.sym
.snprj/* .snprj/*
sql-bench/output/* sql-bench/output/*
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686 sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
Docs/my_sys.doc
...@@ -7,4 +7,10 @@ extra_flags="$pentium_cflags $fast_cflags" ...@@ -7,4 +7,10 @@ extra_flags="$pentium_cflags $fast_cflags"
extra_configs="$pentium_configs" extra_configs="$pentium_configs"
strip=yes strip=yes
# Use the optimized version if it exists
if test -d /usr/local/BerkeleyDB-opt/
then
extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-opt/"
fi
. "$path/FINISH.sh" . "$path/FINISH.sh"
...@@ -8,4 +8,10 @@ c_warnings="$c_warnings $debug_extra_warnings" ...@@ -8,4 +8,10 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs" extra_configs="$pentium_configs $debug_configs"
# Use the debug version if it exists
if test -d /usr/local/BerkeleyDB-dbug/
then
extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-dbug/"
fi
. "$path/FINISH.sh" . "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags -g"
extra_configs="$pentium_configs"
# Use the optimized version if it exists
if test -d /usr/local/BerkeleyDB-opt/
then
extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-opt/"
fi
. "$path/FINISH.sh"
...@@ -289,6 +289,151 @@ Use pointers rather than array indexing when operating on strings. ...@@ -289,6 +289,151 @@ Use pointers rather than array indexing when operating on strings.
@end itemize @end itemize
@node mysys functions
@chapter mysys functions
Functions i mysys: (For flags se my_sys.h)
int my_copy _A((const char *from,const char *to,myf MyFlags));
- Copy file
int my_delete _A((const char *name,myf MyFlags));
- Delete file
int my_getwd _A((string buf,uint size,myf MyFlags));
int my_setwd _A((const char *dir,myf MyFlags));
- Get and set working directory
string my_tempnam _A((const char *pfx,myf MyFlags));
- Make a uniq temp file name by using dir and adding something after
pfx to make name uniq. Name is made by adding a uniq 6 length-string
and TMP_EXT after pfx.
Returns pointer to malloced area for filename. Should be freed by
free().
File my_open _A((const char *FileName,int Flags,myf MyFlags));
File my_create _A((const char *FileName,int CreateFlags,
int AccsesFlags, myf MyFlags));
int my_close _A((File Filedes,myf MyFlags));
uint my_read _A((File Filedes,byte *Buffer,uint Count,myf MyFlags));
uint my_write _A((File Filedes,const byte *Buffer,uint Count,
myf MyFlags));
ulong my_seek _A((File fd,ulong pos,int whence,myf MyFlags));
ulong my_tell _A((File fd,myf MyFlags));
- Use instead of open,open-with-create-flag, close read and write
to get automatic error-messages (flag: MYF_WME) and only have
to test for != 0 if error (flag: MY_NABP).
int my_rename _A((const char *from,const char *to,myf MyFlags));
- Rename file
FILE *my_fopen _A((const char *FileName,int Flags,myf MyFlags));
FILE *my_fdopen _A((File Filedes,int Flags,myf MyFlags));
int my_fclose _A((FILE *fd,myf MyFlags));
uint my_fread _A((FILE *stream,byte *Buffer,uint Count,myf MyFlags));
uint my_fwrite _A((FILE *stream,const byte *Buffer,uint Count,
myf MyFlags));
ulong my_fseek _A((FILE *stream,ulong pos,int whence,myf MyFlags));
ulong my_ftell _A((FILE *stream,myf MyFlags));
- Same read-interface for streams as for files
gptr _mymalloc _A((uint uSize,const char *sFile,
uint uLine, myf MyFlag));
gptr _myrealloc _A((string pPtr,uint uSize,const char *sFile,
uint uLine, myf MyFlag));
void _myfree _A((gptr pPtr,const char *sFile,uint uLine));
int _sanity _A((const char *sFile,unsigned int uLine));
gptr _myget_copy_of_memory _A((const byte *from,uint length,
const char *sFile, uint uLine,
myf MyFlag));
- malloc(size,myflag) is mapped to this functions if not compiled
with -DSAFEMALLOC
void TERMINATE _A((void));
- Writes malloc-info on stdout if compiled with -DSAFEMALLOC.
int my_chsize _A((File fd,ulong newlength,myf MyFlags));
- Change size of file
void my_error _D((int nr,myf MyFlags, ...));
- Writes message using error number (se mysys/errors.h) on
stdout or curses if MYSYS_PROGRAM_USES_CURSES() is called.
void my_message _A((const char *str,myf MyFlags));
- Writes message-string on
stdout or curses if MYSYS_PROGRAM_USES_CURSES() is called.
void my_init _A((void ));
- Start each program (in main) with this.
void my_end _A((int infoflag));
- Gives info about program.
- If infoflag & MY_CHECK_ERROR prints if some files are left open
- If infoflag & MY_GIVE_INFO prints timing info and malloc info
about prog.
int my_redel _A((const char *from, const char *to, int MyFlags));
- Delete from before rename of to to from. Copyes state from old
file to new file. If MY_COPY_TIME is set sets old time.
int my_copystat _A((const char *from, const char *to, int MyFlags));
- Copye state from old file to new file.
If MY_COPY_TIME is set sets copy also time.
string my_filename _A((File fd));
- Give filename of open file.
int dirname _A((string to,const char *name));
- Copy name of directory from filename.
int test_if_hard_path _A((const char *dir_name));
- Test if dirname is a hard path (Starts from root)
void convert_dirname _A((string name));
- Convert dirname acording to system.
- In MSDOS changes all caracters to capitals and changes '/' to
'\'
string fn_ext _A((const char *name));
- Returns pointer to extension in filename
string fn_format _A((string to,const char *name,const char *dsk,
const char *form,int flag));
format a filename with replace of library and extension and
converts between different systems.
params to and name may be identicall
function dosn't change name if name != to
Flag may be: 1 force replace filnames library with 'dsk'
2 force replace extension with 'form' */
4 force Unpack filename (replace ~ with home)
8 Pack filename as short as possibly for output to
user.
All open requests should allways use at least:
"open(fn_format(temp_buffe,name,"","",4),...)" to unpack home and
convert filename to system-form.
string fn_same _A((string toname,const char *name,int flag));
- Copys directory and extension from name to toname if neaded.
copy can be forced by same flags that in fn_format.
int wild_compare _A((const char *str,const char *wildstr));
- Compare if str matches wildstr. Wildstr can contain "*" and "?"
as match-characters.
Returns 0 if match.
void get_date _A((string to,int timeflag));
- Get current date in a form ready for printing.
void soundex _A((string out_pntr, string in_pntr))
- Makes in_pntr to a 5 chars long string. All words that sounds
alike have the same string.
int init_key_cache _A((ulong use_mem,ulong leave_this_much_mem));
- Use cacheing of keys in MISAM, PISAM, and ISAM.
KEY_CACHE_SIZE is a good size.
- Remember to lock databases for optimal cacheing
void end_key_cache _A((void));
- End key-cacheing.
@c The Index was empty, and ugly, so I removed it. (jcole, Sep 7, 2000) @c The Index was empty, and ugly, so I removed it. (jcole, Sep 7, 2000)
@c @node Index @c @node Index
......
...@@ -28445,20 +28445,20 @@ Most of the options to @code{safe_mysqld} are the same as the options to ...@@ -28445,20 +28445,20 @@ Most of the options to @code{safe_mysqld} are the same as the options to
@table @code @table @code
@item --basedir=path @item --basedir=path
@item --core-file-size=# @item --core-file-size=#
@item --datadir=path
@item --defaults-extra-file=path @item --defaults-extra-file=path
@item --defaults-file=path @item --defaults-file=path
@item --open-files=#
Size of the core file @code{mysqld} should be able to create. Passed to
@code{ulimit -c}.
@item --datadir=path
@item --err-log=path @item --err-log=path
@item --ledir=path @item --ledir=path
Path to @code{mysqld} Path to @code{mysqld}
@item --log=path @item --log=path
@item --mysqld=mysqld-version
Name of the mysqld version in the @code{ledir} directory you want to start.
@item --no-defaults @item --no-defaults
@item --open-files=# @item --open-files=#
Number of files @code{mysqld} should be able to open. Passed to Number of files @code{mysqld} should be able to open. Passed to @code{ulimit -n}.
@code{ulimit -n}. @item --open-files=#
Size of the core file @code{mysqld} should be able to create. Passed to @code{ulimit -c}.
@item --pid-file=path @item --pid-file=path
@item --port=# @item --port=#
@item --socket=path @item --socket=path
...@@ -40057,6 +40057,8 @@ though, so Version 3.23 is not released as a stable version yet. ...@@ -40057,6 +40057,8 @@ though, so Version 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.30 @appendixsubsec Changes in release 3.23.30
@itemize @bullet @itemize @bullet
@item @item
Added option @code{--mysqld=#} to @code{safe_mysqld}
@item
Allow hex constants in the @code{--fields-*-by} and Allow hex constants in the @code{--fields-*-by} and
@code{--lines-terminated-by} options to @code{mysqldump} and @code{--lines-terminated-by} options to @code{mysqldump} and
@code{mysqlimport}. By Paul DuBois. @code{mysqlimport}. By Paul DuBois.
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "my_readline.h" #include "my_readline.h"
#include <signal.h> #include <signal.h>
const char *VER="11.9"; const char *VER="11.10";
gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr); void sql_element_free(void *ptr);
...@@ -2162,7 +2162,9 @@ com_status(String *buffer __attribute__((unused)), ...@@ -2162,7 +2162,9 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql)); tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql));
tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql)); tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql)); tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql));
tee_fprintf(stdout, "Language:\t\t%s\n", mysql.charset->name); tee_fprintf(stdout, "Client characterset:\t%s\n",
default_charset_info->name);
tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->name);
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket) if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port); tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port);
else else
......
...@@ -1277,9 +1277,6 @@ int main(int argc, char** argv) ...@@ -1277,9 +1277,6 @@ int main(int argc, char** argv)
if (!( mysql_init(&cur_con->mysql))) if (!( mysql_init(&cur_con->mysql)))
die("Failed in mysql_init()"); die("Failed in mysql_init()");
mysql_options(&cur_con->mysql, MYSQL_READ_DEFAULT_GROUP, "mysql");
cur_con->name = my_strdup("default", MYF(MY_WME)); cur_con->name = my_strdup("default", MYF(MY_WME));
if (!cur_con->name) if (!cur_con->name)
die("Out of memory"); die("Out of memory");
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
#include "heapdef.h" #include "heapdef.h"
static int check_one_key(HP_KEYDEF *keydef,ulong records,ulong blength); static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
ulong blength, my_bool print_status);
/* Returns 0 if the HEAP is ok */ /* Returns 0 if the HEAP is ok */
int heap_check_heap(HP_INFO *info) int heap_check_heap(HP_INFO *info,my_bool print_status)
{ {
int error; int error;
uint key; uint key;
...@@ -30,13 +31,15 @@ int heap_check_heap(HP_INFO *info) ...@@ -30,13 +31,15 @@ int heap_check_heap(HP_INFO *info)
DBUG_ENTER("heap_check_keys"); DBUG_ENTER("heap_check_keys");
for (error=key=0 ; key < share->keys ; key++) for (error=key=0 ; key < share->keys ; key++)
error|=check_one_key(share->keydef+key,share->records,share->blength); error|=check_one_key(share->keydef+key,key, share->records,share->blength,
print_status);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
static int check_one_key(HP_KEYDEF *keydef, ulong records, ulong blength) static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
ulong blength, my_bool print_status)
{ {
int error; int error;
uint i,found,max_links,seek,links; uint i,found,max_links,seek,links;
...@@ -76,6 +79,9 @@ static int check_one_key(HP_KEYDEF *keydef, ulong records, ulong blength) ...@@ -76,6 +79,9 @@ static int check_one_key(HP_KEYDEF *keydef, ulong records, ulong blength)
} }
DBUG_PRINT("info", DBUG_PRINT("info",
("records: %ld seeks: %d max links: %d hitrate: %.2f", ("records: %ld seeks: %d max links: %d hitrate: %.2f",
records,seek,max_links,(float) seek / (float) records)); records,seek,max_links,(float) seek / (float) (records ? records : 1)));
if (print_status)
printf("Key: %d records: %ld seeks: %d max links: %d hitrate: %.2f\n",
keynr, records, seek, max_links, (float) seek / (float) records);
return error; return error;
} }
...@@ -37,7 +37,7 @@ int _hp_close(register HP_INFO *info) ...@@ -37,7 +37,7 @@ int _hp_close(register HP_INFO *info)
int error=0; int error=0;
DBUG_ENTER("_hp_close"); DBUG_ENTER("_hp_close");
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (info->s->changed && heap_check_heap(info)) if (info->s->changed && heap_check_heap(info,0))
{ {
error=my_errno=HA_ERR_CRASHED; error=my_errno=HA_ERR_CRASHED;
} }
......
...@@ -145,6 +145,7 @@ void _hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink) ...@@ -145,6 +145,7 @@ void _hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
return; return;
} }
#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key */ /* Calc hashvalue for a key */
...@@ -152,13 +153,14 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ...@@ -152,13 +153,14 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
{ {
register ulong nr=1, nr2=4; register ulong nr=1, nr2=4;
HP_KEYSEG *seg,*endseg; HP_KEYSEG *seg,*endseg;
uchar *pos;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
uchar *pos=(uchar*) key;
key+=seg->length;
if (seg->type == HA_KEYTYPE_TEXT) if (seg->type == HA_KEYTYPE_TEXT)
{ {
for (pos=(uchar*) key,key+=seg->length ; pos < (uchar*) key ; pos++) for (; pos < (uchar*) key ; pos++)
{ {
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) my_sort_order[(uint) *pos]))+ (nr << 8); nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) my_sort_order[(uint) *pos]))+ (nr << 8);
nr2+=3; nr2+=3;
...@@ -166,7 +168,7 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ...@@ -166,7 +168,7 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
} }
else else
{ {
for (pos=(uchar*) key,key+=seg->length ; pos < (uchar*) key ; pos++) for (; pos < (uchar*) key ; pos++)
{ {
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) *pos))+ (nr << 8); nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) *pos))+ (nr << 8);
nr2+=3; nr2+=3;
...@@ -182,13 +184,13 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ...@@ -182,13 +184,13 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
{ {
register ulong nr=1, nr2=4; register ulong nr=1, nr2=4;
HP_KEYSEG *seg,*endseg; HP_KEYSEG *seg,*endseg;
uchar *pos,*end;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
uchar *pos=(uchar*) rec+seg->start,*end=pos+seg->length;
if (seg->type == HA_KEYTYPE_TEXT) if (seg->type == HA_KEYTYPE_TEXT)
{ {
for (pos=(uchar*) rec+seg->start,end=pos+seg->length ; pos < end ; pos++) for (; pos < end ; pos++)
{ {
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) my_sort_order[(uint) *pos]))+ (nr << 8); nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) my_sort_order[(uint) *pos]))+ (nr << 8);
nr2+=3; nr2+=3;
...@@ -196,7 +198,7 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ...@@ -196,7 +198,7 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
} }
else else
{ {
for (pos=(uchar*) rec+seg->start,end=pos+seg->length ; pos < end ; pos++) for (; pos < end ; pos++)
{ {
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) *pos))+ (nr << 8); nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) *pos))+ (nr << 8);
nr2+=3; nr2+=3;
...@@ -206,6 +208,85 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ...@@ -206,6 +208,85 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
return((ulong) nr); return((ulong) nr);
} }
#else
/*
* Fowler/Noll/Vo hash
*
* The basis of the hash algorithm was taken from an idea sent by email to the
* IEEE Posix P1003.2 mailing list from Phong Vo (kpv@research.att.com) and
* Glenn Fowler (gsf@research.att.com). Landon Curt Noll (chongo@toad.com)
* later improved on their algorithm.
*
* The magic is in the interesting relationship between the special prime
* 16777619 (2^24 + 403) and 2^32 and 2^8.
*
* This hash produces the fewest collisions of any function that we've seen so
* far, and works well on both numbers and strings.
*/
ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
{
register ulong nr=0;
HP_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
uchar *pos=(uchar*) key;
key+=seg->length;
if (seg->type == HA_KEYTYPE_TEXT)
{
for (; pos < (uchar*) key ; pos++)
{
nr *=16777619;
nr ^=((uint) my_sort_order[(uint) *pos]);
}
}
else
{
for ( ; pos < (uchar*) key ; pos++)
{
nr *=16777619;
nr ^=(uint) *pos;
}
}
}
return((ulong) nr);
}
/* Calc hashvalue for a key in a record */
ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
{
register ulong nr=0;
HP_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
uchar *pos=(uchar*) rec+seg->start,*end=pos+seg->length;
if (seg->type == HA_KEYTYPE_TEXT)
{
for ( ; pos < end ; pos++)
{
nr *=16777619;
nr ^=(uint) my_sort_order[(uint) *pos];
}
}
else
{
for ( ; pos < end ; pos++)
{
nr *=16777619;
nr ^=(uint) *pos;
}
}
}
return((ulong) nr);
}
#endif
/* Compare keys for two records. Returns 0 if they are identical */ /* Compare keys for two records. Returns 0 if they are identical */
int _hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) int _hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
......
...@@ -65,7 +65,7 @@ int main(int argc, char **argv) ...@@ -65,7 +65,7 @@ int main(int argc, char **argv)
sprintf(key,"%6d",j); sprintf(key,"%6d",j);
bmove(record+1,key,6); bmove(record+1,key,6);
error=heap_write(file,record); error=heap_write(file,record);
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -100,7 +100,7 @@ int main(int argc, char **argv) ...@@ -100,7 +100,7 @@ int main(int argc, char **argv)
if (! error) if (! error)
deleted++; deleted++;
} }
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
......
...@@ -133,7 +133,7 @@ char *argv[]; ...@@ -133,7 +133,7 @@ char *argv[];
write_count++; key1[n1]++; key3[n3]=1; write_count++; key1[n1]++; key3[n3]=1;
key_check+=n1; key_check+=n1;
} }
if (testflag == 1 && heap_check_heap(file)) if (testflag == 1 && heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -141,7 +141,7 @@ char *argv[]; ...@@ -141,7 +141,7 @@ char *argv[];
} }
if (testflag == 1) if (testflag == 1)
goto end; goto end;
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -173,7 +173,7 @@ char *argv[]; ...@@ -173,7 +173,7 @@ char *argv[];
key1[atoi(record+keyinfo[0].seg[0].start)]--; key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0; key3[atoi(record+keyinfo[2].seg[0].start)]=0;
key_check-=atoi(record); key_check-=atoi(record);
if (testflag == 2 && heap_check_heap(file)) if (testflag == 2 && heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -183,7 +183,7 @@ char *argv[]; ...@@ -183,7 +183,7 @@ char *argv[];
puts("Warning: Skipping delete test because no dupplicate keys"); puts("Warning: Skipping delete test because no dupplicate keys");
} }
if (testflag==2) goto end; if (testflag==2) goto end;
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -239,14 +239,14 @@ char *argv[]; ...@@ -239,14 +239,14 @@ char *argv[];
update++; update++;
key_check=key_check-atoi(record)+n1; key_check=key_check-atoi(record)+n1;
} }
if (testflag == 3 && heap_check_heap(file)) if (testflag == 3 && heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
} }
} }
if (testflag == 3) goto end; if (testflag == 3) goto end;
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -284,7 +284,7 @@ char *argv[]; ...@@ -284,7 +284,7 @@ char *argv[];
goto end; goto end;
} }
dupp_keys--; dupp_keys--;
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -320,7 +320,7 @@ char *argv[]; ...@@ -320,7 +320,7 @@ char *argv[];
goto end; goto end;
} }
dupp_keys-=2; dupp_keys-=2;
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -353,7 +353,7 @@ char *argv[]; ...@@ -353,7 +353,7 @@ char *argv[];
printf("next: Found: %d records of %d\n",ant,write_count-delete); printf("next: Found: %d records of %d\n",ant,write_count-delete);
goto end; goto end;
} }
if (heap_check_heap(file)) if (heap_check_heap(file,0))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
...@@ -556,7 +556,8 @@ char *argv[]; ...@@ -556,7 +556,8 @@ char *argv[];
} }
pos++; pos++;
} }
if (heap_check_heap(file) || heap_check_heap(file2)) printf("- Checking heap tables\n");
if (heap_check_heap(file,1) || heap_check_heap(file2,1))
{ {
puts("Heap keys crashed"); puts("Heap keys crashed");
goto err; goto err;
......
...@@ -156,7 +156,7 @@ extern int heap_rlast(HP_INFO *info,byte *record); ...@@ -156,7 +156,7 @@ extern int heap_rlast(HP_INFO *info,byte *record);
extern void heap_clear(HP_INFO *info); extern void heap_clear(HP_INFO *info);
extern int heap_rkey(HP_INFO *info,byte *record,int inx,const byte *key); extern int heap_rkey(HP_INFO *info,byte *record,int inx,const byte *key);
extern gptr heap_find(HP_INFO *info,int inx,const byte *key); extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
extern int heap_check_heap(HP_INFO *info); extern int heap_check_heap(HP_INFO *info, my_bool print_status);
extern byte *heap_position(HP_INFO *info); extern byte *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where /* The following is for programs that uses the old HEAP interface where
......
...@@ -28,12 +28,12 @@ table type possible_keys key key_len ref rows Extra ...@@ -28,12 +28,12 @@ table type possible_keys key key_len ref rows Extra
t1 ALL a NULL NULL NULL 5 t1 ALL a NULL NULL NULL 5
t2 ALL b NULL NULL NULL 5 where used t2 ALL b NULL NULL NULL 5 where used
a b a b a b a b
A B b A
a a b A
A B a a A B a a
A B b A
C c C c
a a a a a a a a
a a b A
b A A B b A A B
C c C c
a b a b
A B A B
a a a a
...@@ -242,11 +242,11 @@ HELLO 1 ...@@ -242,11 +242,11 @@ HELLO 1
HELLO MY 1 HELLO MY 1
a 1 a 1
hello 1 hello 1
_field_140 min(t3._field_131) min(t3._field_135) min(t3._field_139) min(t3._field_137) min(link_alias_142._field_165) min(link_alias_133._field_72) min(t3._field_145) min(link_alias_148._field_156) min(t3._field_140) t3_id _field_140 min(t3._field_131) min(t3._field_135) min(t3._field_139) min(t3._field_137) min(link_alias_142._field_165) min(link_alias_133._field_72) min(t3._field_145) min(link_alias_148._field_156) replace(min(t3._field_140), "\r","^M") t3_id
test test
job job
1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test 1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test^M
job job^M
1 1 1 1
stamp stamp
19990402000000 19990402000000
......
...@@ -14,6 +14,6 @@ INSERT INTO t1 VALUES ('A','B'),('b','A'),('C','c'),('D','E'),('a','a'); ...@@ -14,6 +14,6 @@ INSERT INTO t1 VALUES ('A','B'),('b','A'),('C','c'),('D','E'),('a','a');
select * from t1,t1 as t2; select * from t1,t1 as t2;
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B; explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
#select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B; #select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by t1.a; select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
select * from t1 where a='a'; select * from t1 where a='a';
drop table t1; drop table t1;
...@@ -203,7 +203,7 @@ INSERT INTO t7 VALUES (1,0,'High',1); ...@@ -203,7 +203,7 @@ INSERT INTO t7 VALUES (1,0,'High',1);
INSERT INTO t7 VALUES (2,0,'Medium',2); INSERT INTO t7 VALUES (2,0,'Medium',2);
INSERT INTO t7 VALUES (3,0,'Low',3); INSERT INTO t7 VALUES (3,0,'Low',3);
select t3._field_140,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), min(t3._field_140), t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156; select t3._field_140,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
drop table t1,t2,t3,t4,t5,t6,t7; drop table t1,t2,t3,t4,t5,t6,t7;
......
...@@ -108,6 +108,8 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax, ...@@ -108,6 +108,8 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
return hash_mask((*hash->calc_hashnr)(key,length),buffmax,maxlength); return hash_mask((*hash->calc_hashnr)(key,length),buffmax,maxlength);
} }
#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key */ /* Calc hashvalue for a key */
static uint calc_hashnr(const byte *key,uint length) static uint calc_hashnr(const byte *key,uint length)
...@@ -134,6 +136,49 @@ static uint calc_hashnr_caseup(const byte *key,uint length) ...@@ -134,6 +136,49 @@ static uint calc_hashnr_caseup(const byte *key,uint length)
return((uint) nr); return((uint) nr);
} }
#else
/*
* Fowler/Noll/Vo hash
*
* The basis of the hash algorithm was taken from an idea sent by email to the
* IEEE Posix P1003.2 mailing list from Phong Vo (kpv@research.att.com) and
* Glenn Fowler (gsf@research.att.com). Landon Curt Noll (chongo@toad.com)
* later improved on their algorithm.
*
* The magic is in the interesting relationship between the special prime
* 16777619 (2^24 + 403) and 2^32 and 2^8.
*
* This hash produces the fewest collisions of any function that we've seen so
* far, and works well on both numbers and strings.
*/
uint calc_hashnr(const byte *key, uint len)
{
const byte *end=key+len;
uint hash;
for (hash = 0; key < end; key++)
{
hash *= 16777619;
hash ^= (uint) *(uchar*) key;
}
return (hash);
}
uint calc_hashnr_caseup(const byte *key, uint len)
{
const byte *end=key+len;
uint hash;
for (hash = 0; key < end; key++)
{
hash *= 16777619;
hash ^= (uint) (uchar) toupper(*key);
}
return (hash);
}
#endif
static inline uint rec_hashnr(HASH *hash,const byte *record) static inline uint rec_hashnr(HASH *hash,const byte *record)
{ {
......
...@@ -51,6 +51,7 @@ parse_arguments() { ...@@ -51,6 +51,7 @@ parse_arguments() {
--open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;; --open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;;
--core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core_file_size=;;"` ;; --core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core_file_size=;;"` ;;
--timezone=*) TZ=`echo "$arg" | sed -e "s;--timezone=;;"` ; export TZ; ;; --timezone=*) TZ=`echo "$arg" | sed -e "s;--timezone=;;"` ; export TZ; ;;
--mysqld=*) MYSQLD=`echo "$arg" | sed -e "s;--mysqld=;;"` ;;
*) *)
if test -n "$pick_args" if test -n "$pick_args"
then then
...@@ -87,6 +88,7 @@ fi ...@@ -87,6 +88,7 @@ fi
MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@} MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}
MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@} MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@}
user=@MYSQLD_USER@ user=@MYSQLD_USER@
MYSQLD=mysqld
# these rely on $DATADIR by default, so we'll set them later on # these rely on $DATADIR by default, so we'll set them later on
pid_file= pid_file=
...@@ -111,9 +113,9 @@ args= ...@@ -111,9 +113,9 @@ args=
parse_arguments `$print_defaults $defaults mysqld safe_mysqld` parse_arguments `$print_defaults $defaults mysqld safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test ! -x $ledir/mysqld if test ! -x $ledir/$MYSQLD
then then
echo "The file $ledir/mysqld doesn't exist or is not executable" echo "The file $ledir/$MYSQLD doesn't exist or is not executable"
echo "Please do a cd to the mysql installation directory and restart" echo "Please do a cd to the mysql installation directory and restart"
echo "this script from there as follows:" echo "this script from there as follows:"
echo "./bin/safe_mysqld". echo "./bin/safe_mysqld".
...@@ -195,7 +197,7 @@ fi ...@@ -195,7 +197,7 @@ fi
# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI # $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI
# $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM # $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM
echo "Starting mysqld daemon with databases from $DATADIR" echo "Starting $MYSQLD daemon with databases from $DATADIR"
# Does this work on all systems? # Does this work on all systems?
#if type ulimit | grep "shell builtin" > /dev/null #if type ulimit | grep "shell builtin" > /dev/null
...@@ -209,9 +211,9 @@ do ...@@ -209,9 +211,9 @@ do
rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety
if test -z "$args" if test -z "$args"
then then
$NOHUP_NICENESS $ledir/mysqld $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1 $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
else else
eval "$NOHUP_NICENESS $ledir/mysqld $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1" eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
fi fi
if test ! -f $pid_file # This is removed if normal shutdown if test ! -f $pid_file # This is removed if normal shutdown
then then
...@@ -225,12 +227,12 @@ do ...@@ -225,12 +227,12 @@ do
# but should work for the rest of the servers. # but should work for the rest of the servers.
# The only thing is ps x => redhat 5 gives warnings when using ps -x. # The only thing is ps x => redhat 5 gives warnings when using ps -x.
# kill -9 is used or the process won't react on the kill. # kill -9 is used or the process won't react on the kill.
numofproces=`ps xa | grep -v "grep" | grep -c $ledir/mysqld` numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD`
echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
I=1 I=1
while test "$I" -le "$numofproces" while test "$I" -le "$numofproces"
do do
PROC=`ps xa | grep $ledir/mysqld | grep -v "grep" | tail -1` PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | tail -1`
for T in $PROC for T in $PROC
do do
break break
...@@ -238,7 +240,7 @@ do ...@@ -238,7 +240,7 @@ do
# echo "TEST $I - $T **" # echo "TEST $I - $T **"
if kill -9 $T if kill -9 $T
then then
echo "mysqld process hanging, pid $T - killed" | tee -a $err_log echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
else else
break break
fi fi
......
...@@ -1971,10 +1971,16 @@ ha_innobase::external_lock( ...@@ -1971,10 +1971,16 @@ ha_innobase::external_lock(
THR_LOCK_DATA **ha_innobase::store_lock(THD *thd, THR_LOCK_DATA **to, THR_LOCK_DATA **ha_innobase::store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type) enum thr_lock_type lock_type)
{ {
/*??????????????????*/ if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
{
/* If we are not doing a LOCK TABLE, then allow multiple writers */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
lock_type <= TL_WRITE) &&
!thd->in_lock_tables)
lock_type = TL_WRITE_ALLOW_WRITE;
lock.type=lock_type;
}
*to++= &lock; *to++= &lock;
return(to); return(to);
} }
......
...@@ -1082,9 +1082,10 @@ inline static __volatile__ void trace_stack() ...@@ -1082,9 +1082,10 @@ inline static __volatile__ void trace_stack()
uchar **stack_bottom; uchar **stack_bottom;
uchar** ebp; uchar** ebp;
LINT_INIT(ebp); LINT_INIT(ebp);
fprintf(stderr, "Attemping backtrace, please send the info below to \ fprintf(stderr,
bugs@lists.mysql.com. If you see no messages after this, something \ "Attemping backtrace. You can use the following information to find out\n\
went terribly wrong - report this anyway\n"); where mysqld died. If you see no messages after this, something went\n\
terribly wrong\n");
THD* thd = current_thd; THD* thd = current_thd;
uint frame_count = 0; uint frame_count = 0;
__asm __volatile__ ("movl %%ebp,%0" __asm __volatile__ ("movl %%ebp,%0"
...@@ -1092,7 +1093,7 @@ went terribly wrong - report this anyway\n"); ...@@ -1092,7 +1093,7 @@ went terribly wrong - report this anyway\n");
:"r"(ebp)); :"r"(ebp));
if (!ebp) if (!ebp)
{ {
fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with \ fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with\n\
-fomit-frame-pointer? Aborting backtrace\n"); -fomit-frame-pointer? Aborting backtrace\n");
return; return;
} }
...@@ -1143,9 +1144,9 @@ static sig_handler handle_segfault(int sig) ...@@ -1143,9 +1144,9 @@ static sig_handler handle_segfault(int sig)
segfaulted = 1; segfaulted = 1;
fprintf(stderr,"\ fprintf(stderr,"\
mysqld got signal %d;\n\ mysqld got signal %d;\n\
The manual section 'Debugging a MySQL server' tells you how to use a \n\ The manual section 'Debugging a MySQL server' tells you how to use a\n\
debugger on the core file to produce a backtrace that may help you find out\n\ stack trace and/or the core file to produce a readable backtrace that may\n\
why mysqld died\n",sig); help in finding out why mysqld died\n",sig);
#if defined(HAVE_LINUXTHREADS) #if defined(HAVE_LINUXTHREADS)
#ifdef __i386__ #ifdef __i386__
trace_stack(); trace_stack();
...@@ -1622,12 +1623,14 @@ int main(int argc, char **argv) ...@@ -1622,12 +1623,14 @@ int main(int argc, char **argv)
{ {
server_id= !master_host ? 1 : 2; server_id= !master_host ? 1 : 2;
switch (server_id) { switch (server_id) {
#ifdef EXTRA_DEBUG
case 1: case 1:
sql_print_error("\ sql_print_error("\
Warning: one should set server_id to a non-0 value if log-bin is enabled.\n\ Warning: one should set server_id to a non-0 value if log-bin is enabled.\n\
Will log updates to binary log, but will not accept connections from slaves"); Will log updates to binary log, but will not accept connections from slaves");
break; break;
default: #endif
case 2:
sql_print_error("\ sql_print_error("\
Warning: one should set server_id to a non-0 value if master_host is set.\n\ Warning: one should set server_id to a non-0 value if master_host is set.\n\
The server will not act as a slave"); The server will not act as a slave");
...@@ -2548,7 +2551,7 @@ CHANGEABLE_VAR changeable_vars[] = { ...@@ -2548,7 +2551,7 @@ CHANGEABLE_VAR changeable_vars[] = {
{ "lower_case_table_names", (long*) &lower_case_table_names, { "lower_case_table_names", (long*) &lower_case_table_names,
IF_WIN(1,0), 0, 1, 0, 1 }, IF_WIN(1,0), 0, 1, 0, 1 },
{ "max_allowed_packet", (long*) &max_allowed_packet, { "max_allowed_packet", (long*) &max_allowed_packet,
1024*1024L, 80, 17*1024*1024L, MALLOC_OVERHEAD, 1024 }, 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size, { "max_binlog_cache_size", (long*) &max_binlog_cache_size,
~0L, IO_SIZE, ~0L, 0, IO_SIZE }, ~0L, IO_SIZE, ~0L, 0, IO_SIZE },
{ "max_connections", (long*) &max_connections, { "max_connections", (long*) &max_connections,
......
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