Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
07b1f0dc
Commit
07b1f0dc
authored
Dec 29, 2000
by
monty@donna.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed --no-defaults in mysqltest
parent
38cd62e8
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
384 additions
and
66 deletions
+384
-66
.bzrignore
.bzrignore
+1
-0
BUILD/compile-pentium
BUILD/compile-pentium
+6
-0
BUILD/compile-pentium-debug
BUILD/compile-pentium-debug
+6
-0
BUILD/compile-pentium-symbols
BUILD/compile-pentium-symbols
+15
-0
Docs/internals.texi
Docs/internals.texi
+145
-0
Docs/manual.texi
Docs/manual.texi
+8
-6
client/mysql.cc
client/mysql.cc
+4
-2
client/mysqltest.c
client/mysqltest.c
+0
-3
heap/_check.c
heap/_check.c
+11
-5
heap/hp_close.c
heap/hp_close.c
+1
-1
heap/hp_hash.c
heap/hp_hash.c
+87
-6
heap/hp_test1.c
heap/hp_test1.c
+2
-2
heap/hp_test2.c
heap/hp_test2.c
+11
-10
include/heap.h
include/heap.h
+1
-1
mysql-test/r/key_diff.result
mysql-test/r/key_diff.result
+3
-3
mysql-test/r/type_blob.result
mysql-test/r/type_blob.result
+3
-3
mysql-test/t/key_diff.test
mysql-test/t/key_diff.test
+1
-1
mysql-test/t/type_blob.test
mysql-test/t/type_blob.test
+1
-1
mysys/hash.c
mysys/hash.c
+45
-0
scripts/safe_mysqld.sh
scripts/safe_mysqld.sh
+10
-8
sql/ha_innobase.cc
sql/ha_innobase.cc
+11
-5
sql/mysqld.cc
sql/mysqld.cc
+12
-9
No files found.
.bzrignore
View file @
07b1f0dc
...
...
@@ -184,3 +184,4 @@ mysqld.sym
.snprj/*
sql-bench/output/*
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
Docs/my_sys.doc
BUILD/compile-pentium
View file @
07b1f0dc
...
...
@@ -7,4 +7,10 @@ extra_flags="$pentium_cflags $fast_cflags"
extra_configs
=
"
$pentium_configs
"
strip
=
yes
# Use the optimized version if it exists
if
test
-d
/usr/local/BerkeleyDB-opt/
then
extra_configs
=
"
$extra_configs
--with-berkeley-db=/usr/local/BerkeleyDB-opt/"
fi
.
"
$path
/FINISH.sh"
BUILD/compile-pentium-debug
View file @
07b1f0dc
...
...
@@ -8,4 +8,10 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings
=
"
$cxx_warnings
$debug_extra_warnings
"
extra_configs
=
"
$pentium_configs
$debug_configs
"
# Use the debug version if it exists
if
test
-d
/usr/local/BerkeleyDB-dbug/
then
extra_configs
=
"
$extra_configs
--with-berkeley-db=/usr/local/BerkeleyDB-dbug/"
fi
.
"
$path
/FINISH.sh"
BUILD/compile-pentium-symbols
0 → 100755
View file @
07b1f0dc
#! /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"
Docs/internals.texi
View file @
07b1f0dc
...
...
@@ -289,6 +289,151 @@ Use pointers rather than array indexing when operating on strings.
@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 @node Index
...
...
Docs/manual.texi
View file @
07b1f0dc
...
...
@@ -28445,20 +28445,20 @@ Most of the options to @code{safe_mysqld} are the same as the options to
@table @code
@item --basedir=path
@item --core-file-size=#
@item --datadir=path
@item --defaults-extra-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 --ledir=path
Path to @code{mysqld}
@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 --open-files=#
Number of files @code{mysqld} should be able to open. Passed to
@code{ulimit -n}.
Number of files @code{mysqld} should be able to open. Passed to @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 --port=#
@item --socket=path
...
...
@@ -40057,6 +40057,8 @@ though, so Version 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.30
@itemize @bullet
@item
Added option @code{--mysqld=#} to @code{safe_mysqld}
@item
Allow hex constants in the @code{--fields-*-by} and
@code{--lines-terminated-by} options to @code{mysqldump} and
@code{mysqlimport}. By Paul DuBois.
client/mysql.cc
View file @
07b1f0dc
...
...
@@ -39,7 +39,7 @@
#include "my_readline.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
void
sql_element_free
(
void
*
ptr
);
...
...
@@ -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
,
"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
,
"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
)
tee_fprintf
(
stdout
,
"TCP port:
\t\t
%d
\n
"
,
mysql
.
port
);
else
...
...
client/mysqltest.c
View file @
07b1f0dc
...
...
@@ -1277,9 +1277,6 @@ int main(int argc, char** argv)
if
(
!
(
mysql_init
(
&
cur_con
->
mysql
)))
die
(
"Failed in mysql_init()"
);
mysql_options
(
&
cur_con
->
mysql
,
MYSQL_READ_DEFAULT_GROUP
,
"mysql"
);
cur_con
->
name
=
my_strdup
(
"default"
,
MYF
(
MY_WME
));
if
(
!
cur_con
->
name
)
die
(
"Out of memory"
);
...
...
heap/_check.c
View file @
07b1f0dc
...
...
@@ -18,11 +18,12 @@
#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 */
int
heap_check_heap
(
HP_INFO
*
info
)
int
heap_check_heap
(
HP_INFO
*
info
,
my_bool
print_status
)
{
int
error
;
uint
key
;
...
...
@@ -30,13 +31,15 @@ int heap_check_heap(HP_INFO *info)
DBUG_ENTER
(
"heap_check_keys"
);
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
);
}
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
;
uint
i
,
found
,
max_links
,
seek
,
links
;
...
...
@@ -76,6 +79,9 @@ static int check_one_key(HP_KEYDEF *keydef, ulong records, ulong blength)
}
DBUG_PRINT
(
"info"
,
(
"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
;
}
heap/hp_close.c
View file @
07b1f0dc
...
...
@@ -37,7 +37,7 @@ int _hp_close(register HP_INFO *info)
int
error
=
0
;
DBUG_ENTER
(
"_hp_close"
);
#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
;
}
...
...
heap/hp_hash.c
View file @
07b1f0dc
...
...
@@ -145,6 +145,7 @@ void _hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
return
;
}
#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key */
...
...
@@ -152,13 +153,14 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
{
register
ulong
nr
=
1
,
nr2
=
4
;
HP_KEYSEG
*
seg
,
*
endseg
;
uchar
*
pos
;
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
,
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
);
nr2
+=
3
;
...
...
@@ -166,7 +168,7 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
}
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
);
nr2
+=
3
;
...
...
@@ -182,13 +184,13 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
{
register
ulong
nr
=
1
,
nr2
=
4
;
HP_KEYSEG
*
seg
,
*
endseg
;
uchar
*
pos
,
*
end
;
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
=
(
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
);
nr2
+=
3
;
...
...
@@ -196,7 +198,7 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
}
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
);
nr2
+=
3
;
...
...
@@ -206,6 +208,85 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
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 */
int
_hp_rec_key_cmp
(
HP_KEYDEF
*
keydef
,
const
byte
*
rec1
,
const
byte
*
rec2
)
...
...
heap/hp_test1.c
View file @
07b1f0dc
...
...
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
sprintf
(
key
,
"%6d"
,
j
);
bmove
(
record
+
1
,
key
,
6
);
error
=
heap_write
(
file
,
record
);
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
if
(
!
error
)
deleted
++
;
}
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
heap/hp_test2.c
View file @
07b1f0dc
...
...
@@ -133,7 +133,7 @@ char *argv[];
write_count
++
;
key1
[
n1
]
++
;
key3
[
n3
]
=
1
;
key_check
+=
n1
;
}
if
(
testflag
==
1
&&
heap_check_heap
(
file
))
if
(
testflag
==
1
&&
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -141,7 +141,7 @@ char *argv[];
}
if
(
testflag
==
1
)
goto
end
;
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -173,7 +173,7 @@ char *argv[];
key1
[
atoi
(
record
+
keyinfo
[
0
].
seg
[
0
].
start
)]
--
;
key3
[
atoi
(
record
+
keyinfo
[
2
].
seg
[
0
].
start
)]
=
0
;
key_check
-=
atoi
(
record
);
if
(
testflag
==
2
&&
heap_check_heap
(
file
))
if
(
testflag
==
2
&&
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -183,7 +183,7 @@ char *argv[];
puts
(
"Warning: Skipping delete test because no dupplicate keys"
);
}
if
(
testflag
==
2
)
goto
end
;
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -239,14 +239,14 @@ char *argv[];
update
++
;
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"
);
goto
err
;
}
}
if
(
testflag
==
3
)
goto
end
;
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -284,7 +284,7 @@ char *argv[];
goto
end
;
}
dupp_keys
--
;
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -320,7 +320,7 @@ char *argv[];
goto
end
;
}
dupp_keys
-=
2
;
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -353,7 +353,7 @@ char *argv[];
printf
(
"next: Found: %d records of %d
\n
"
,
ant
,
write_count
-
delete
);
goto
end
;
}
if
(
heap_check_heap
(
file
))
if
(
heap_check_heap
(
file
,
0
))
{
puts
(
"Heap keys crashed"
);
goto
err
;
...
...
@@ -556,7 +556,8 @@ char *argv[];
}
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"
);
goto
err
;
...
...
include/heap.h
View file @
07b1f0dc
...
...
@@ -156,7 +156,7 @@ extern int heap_rlast(HP_INFO *info,byte *record);
extern
void
heap_clear
(
HP_INFO
*
info
);
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
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
);
/* The following is for programs that uses the old HEAP interface where
...
...
mysql-test/r/key_diff.result
View file @
07b1f0dc
...
...
@@ -28,12 +28,12 @@ table type possible_keys key key_len ref rows Extra
t1 ALL a NULL NULL NULL 5
t2 ALL b NULL NULL NULL 5 where used
a b a b
A B b A
a a b A
A B a a
A B b A
C c C c
a a a a
a a b A
b A A B
C c C c
a b
A B
a a
mysql-test/r/type_blob.result
View file @
07b1f0dc
...
...
@@ -242,11 +242,11 @@ HELLO 1
HELLO MY 1
a 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
job
1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test
job
1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test
^M
job
^M
1 1
stamp
19990402000000
...
...
mysql-test/t/key_diff.test
View file @
07b1f0dc
...
...
@@ -14,6 +14,6 @@ INSERT INTO t1 VALUES ('A','B'),('b','A'),('C','c'),('D','E'),('a','a');
select
*
from
t1
,
t1
as
t2
;
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
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'
;
drop
table
t1
;
mysql-test/t/type_blob.test
View file @
07b1f0dc
...
...
@@ -203,7 +203,7 @@ INSERT INTO t7 VALUES (1,0,'High',1);
INSERT
INTO
t7
VALUES
(
2
,
0
,
'Medium'
,
2
);
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
;
...
...
mysys/hash.c
View file @
07b1f0dc
...
...
@@ -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
);
}
#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key */
static
uint
calc_hashnr
(
const
byte
*
key
,
uint
length
)
...
...
@@ -134,6 +136,49 @@ static uint calc_hashnr_caseup(const byte *key,uint length)
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
)
{
...
...
scripts/safe_mysqld.sh
View file @
07b1f0dc
...
...
@@ -51,6 +51,7 @@ parse_arguments() {
--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=;;"
`
;;
--timezone
=
*
)
TZ
=
`
echo
"
$arg
"
|
sed
-e
"s;--timezone=;;"
`
;
export
TZ
;
;;
--mysqld
=
*
)
MYSQLD
=
`
echo
"
$arg
"
|
sed
-e
"s;--mysqld=;;"
`
;;
*
)
if
test
-n
"
$pick_args
"
then
...
...
@@ -87,6 +88,7 @@ fi
MYSQL_UNIX_PORT
=
${
MYSQL_UNIX_PORT
:-
@MYSQL_UNIX_ADDR@
}
MYSQL_TCP_PORT
=
${
MYSQL_TCP_PORT
:-
@MYSQL_TCP_PORT@
}
user
=
@MYSQLD_USER@
MYSQLD
=
mysqld
# these rely on $DATADIR by default, so we'll set them later on
pid_file
=
...
...
@@ -111,9 +113,9 @@ args=
parse_arguments
`
$print_defaults
$defaults
mysqld safe_mysqld
`
parse_arguments PICK-ARGS-FROM-ARGV
"
$@
"
if
test
!
-x
$ledir
/
mysqld
if
test
!
-x
$ledir
/
$MYSQLD
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
"this script from there as follows:"
echo
"./bin/safe_mysqld"
.
...
...
@@ -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/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?
#if type ulimit | grep "shell builtin" > /dev/null
...
...
@@ -209,9 +211,9 @@ do
rm
-f
$MYSQL_UNIX_PORT
$pid_file
# Some extra safety
if
test
-z
"
$args
"
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
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
if
test
!
-f
$pid_file
# This is removed if normal shutdown
then
...
...
@@ -225,12 +227,12 @@ do
# but should work for the rest of the servers.
# 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.
numofproces
=
`
ps xa |
grep
-v
"grep"
|
grep
-c
$ledir
/
mysqld
`
numofproces
=
`
ps xa |
grep
-v
"grep"
|
grep
-c
$ledir
/
$MYSQLD
`
echo
-e
"
\n
Number of processes running now:
$numofproces
"
|
tee
-a
$err_log
I
=
1
while
test
"
$I
"
-le
"
$numofproces
"
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
do
break
...
...
@@ -238,7 +240,7 @@ do
# echo "TEST $I - $T **"
if
kill
-9
$T
then
echo
"
mysqld
process hanging, pid
$T
- killed"
|
tee
-a
$err_log
echo
"
$MYSQLD
process hanging, pid
$T
- killed"
|
tee
-a
$err_log
else
break
fi
...
...
sql/ha_innobase.cc
View file @
07b1f0dc
...
...
@@ -1971,11 +1971,17 @@ ha_innobase::external_lock(
THR_LOCK_DATA
**
ha_innobase
::
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
)
{
/*??????????????????*/
*
to
++=
&
lock
;
return
(
to
);
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
;
return
(
to
);
}
/*********************************************************************
...
...
sql/mysqld.cc
View file @
07b1f0dc
...
...
@@ -1082,9 +1082,10 @@ inline static __volatile__ void trace_stack()
uchar
**
stack_bottom
;
uchar
**
ebp
;
LINT_INIT
(
ebp
);
fprintf
(
stderr
,
"Attemping backtrace, please send the info below to \
bugs@lists.mysql.com. If you see no messages after this, something \
went terribly wrong - report this anyway
\n
"
);
fprintf
(
stderr
,
"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
\
terribly wrong
\n
"
);
THD
*
thd
=
current_thd
;
uint
frame_count
=
0
;
__asm
__volatile__
(
"movl %%ebp,%0"
...
...
@@ -1092,7 +1093,7 @@ went terribly wrong - report this anyway\n");
:
"r"
(
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
"
);
return
;
}
...
...
@@ -1143,9 +1144,9 @@ static sig_handler handle_segfault(int sig)
segfaulted
=
1
;
fprintf
(
stderr
,
"\
mysqld got signal %d;
\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
\
why mysqld died
\n
"
,
sig
);
The manual section 'Debugging a MySQL server' tells you how to use a
\n
\
stack trace and/or the core file to produce a readable backtrace that may
\n
\
help in finding out
why mysqld died
\n
"
,
sig
);
#if defined(HAVE_LINUXTHREADS)
#ifdef __i386__
trace_stack
();
...
...
@@ -1622,12 +1623,14 @@ int main(int argc, char **argv)
{
server_id
=
!
master_host
?
1
:
2
;
switch
(
server_id
)
{
#ifdef EXTRA_DEBUG
case
1
:
sql_print_error
(
"\
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"
);
break
;
default:
#endif
case
2
:
sql_print_error
(
"\
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"
);
...
...
@@ -2548,7 +2551,7 @@ CHANGEABLE_VAR changeable_vars[] = {
{
"lower_case_table_names"
,
(
long
*
)
&
lower_case_table_names
,
IF_WIN
(
1
,
0
),
0
,
1
,
0
,
1
},
{
"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
,
~
0L
,
IO_SIZE
,
~
0L
,
0
,
IO_SIZE
},
{
"max_connections"
,
(
long
*
)
&
max_connections
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment