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
b5f76be0
Commit
b5f76be0
authored
Jul 17, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Plain Diff
merged with 3.23
parents
66ab2056
ef88e507
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
331 additions
and
55 deletions
+331
-55
configure.in
configure.in
+18
-4
mit-pthreads/gen/ctime.c
mit-pthreads/gen/ctime.c
+1
-1
mit-pthreads/machdep/netbsd-1.1/__signal.h
mit-pthreads/machdep/netbsd-1.1/__signal.h
+7
-0
mit-pthreads/stdio/strerror.c
mit-pthreads/stdio/strerror.c
+6
-1
myisam/mi_check.c
myisam/mi_check.c
+15
-1
myisam/myisamchk.c
myisam/myisamchk.c
+1
-1
mysql-test/r/auto_increment.result
mysql-test/r/auto_increment.result
+5
-0
mysql-test/r/limit.result
mysql-test/r/limit.result
+3
-0
mysql-test/r/lock.result
mysql-test/r/lock.result
+4
-0
mysql-test/r/rpl_sporadic_master.result
mysql-test/r/rpl_sporadic_master.result
+6
-6
mysql-test/t/auto_increment.test
mysql-test/t/auto_increment.test
+11
-0
mysql-test/t/limit.test
mysql-test/t/limit.test
+11
-0
mysql-test/t/lock.test
mysql-test/t/lock.test
+42
-0
mysql-test/t/rpl_sporadic_master.test
mysql-test/t/rpl_sporadic_master.test
+7
-5
mysys/thr_lock.c
mysys/thr_lock.c
+20
-16
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+3
-1
sql/ha_gemini.cc
sql/ha_gemini.cc
+3
-2
sql/ha_gemini.h
sql/ha_gemini.h
+1
-1
sql/ha_innobase.cc
sql/ha_innobase.cc
+45
-0
sql/ha_innobase.h
sql/ha_innobase.h
+1
-0
sql/mysqld.cc
sql/mysqld.cc
+4
-0
sql/slave.cc
sql/slave.cc
+1
-0
sql/slave.h
sql/slave.h
+4
-0
sql/sql_acl.cc
sql/sql_acl.cc
+3
-4
sql/sql_delete.cc
sql/sql_delete.cc
+4
-3
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_show.cc
sql/sql_show.cc
+1
-1
sql/sql_update.cc
sql/sql_update.cc
+2
-1
tests/fork2_test.pl
tests/fork2_test.pl
+33
-2
tests/fork_big.pl
tests/fork_big.pl
+68
-4
No files found.
configure.in
View file @
b5f76be0
...
@@ -629,7 +629,10 @@ struct request_info *req;
...
@@ -629,7 +629,10 @@ struct request_info *req;
AC_MSG_RESULT
(
yes
)
AC_MSG_RESULT
(
yes
)
AC_DEFINE
(
LIBWRAP
)
AC_DEFINE
(
LIBWRAP
)
AC_DEFINE
(
HAVE_LIBWRAP
)
AC_DEFINE
(
HAVE_LIBWRAP
)
WRAPLIBS
=
"-L
$with_libwrap
/lib -lwrap"
,
if
test
"
$with_libwrap
"
!=
"yes"
;
then
WRAPLIBS
=
"-L
${
with_libwrap
}
/lib"
fi
WRAPLIBS
=
"
${
WRAPLIBS
}
-lwrap"
,
AC_MSG_RESULT
(
no
)
AC_MSG_RESULT
(
no
)
CPPFLAGS
=
${
_cppflags
}
LDFLAGS
=
${
_ldflags
}
)
,
CPPFLAGS
=
${
_cppflags
}
LDFLAGS
=
${
_ldflags
}
)
,
CPPFLAGS
=
${
_cppflags
}
LDFLAGS
=
${
_ldflags
}
)
CPPFLAGS
=
${
_cppflags
}
LDFLAGS
=
${
_ldflags
}
)
...
@@ -831,6 +834,12 @@ case $SYSTEM_TYPE in
...
@@ -831,6 +834,12 @@ case $SYSTEM_TYPE in
echo
"Adding fix for interrupted reads"
echo
"Adding fix for interrupted reads"
CXXFLAGS
=
"
$CXXFLAGS
-DMYSQLD_NET_RETRY_COUNT=1000000"
CXXFLAGS
=
"
$CXXFLAGS
-DMYSQLD_NET_RETRY_COUNT=1000000"
;;
;;
*
netbsd
*
)
echo
"Adding flag -Dunix"
CFLAGS
=
"
$CFLAGS
-Dunix"
CXXFLAGS
=
"
$CXXFLAGS
-Dunix"
OVERRIDE_MT_LD_ADD
=
"
\$
(top_srcdir)/mit-pthreads/obj/libpthread.a"
;;
*
bsdi
*
)
*
bsdi
*
)
echo
"Adding fix for BSDI"
echo
"Adding fix for BSDI"
CFLAGS
=
"
$CFLAGS
-D__BSD__ -DHAVE_BROKEN_REALPATH"
CFLAGS
=
"
$CFLAGS
-D__BSD__ -DHAVE_BROKEN_REALPATH"
...
@@ -2058,7 +2067,7 @@ and GNU make work together causes some files to depend on this
...
@@ -2058,7 +2067,7 @@ and GNU make work together causes some files to depend on this
header, even if we're not building with Berkeley DB.
header, even if we're not building with Berkeley DB.
Obviously, if this file *is* used, it'll break and hopefully we can find
Obviously, if this file *is* used, it'll break and hopefully we can find
out why this file was generated by
$
(
top_srcdir
)
/configure instead of
out why this file was generated by
$
{
top_srcdir
}
/configure instead of
the real db.h.
the real db.h.
If you run into some problems because of this file, please use mysql_bug
If you run into some problems because of this file, please use mysql_bug
...
@@ -2099,15 +2108,20 @@ EOF
...
@@ -2099,15 +2108,20 @@ EOF
AC_DEFINE
(
HAVE_mit_thread
)
AC_DEFINE
(
HAVE_mit_thread
)
MT_INCLUDES
=
"-I
\$
(top_srcdir)/mit-pthreads/include"
MT_INCLUDES
=
"-I
\$
(top_srcdir)/mit-pthreads/include"
AC_SUBST
(
MT_INCLUDES
)
AC_SUBST
(
MT_INCLUDES
)
if
test
-n
"
$OVERRIDE_MT_LD_ADD
"
then
MT_LD_ADD
=
"
$OVERRIDE_MT_LD_ADD
"
else
MT_LD_ADD
=
"-L
\$
(top_srcdir)/mit-pthreads/obj/ -lpthread"
MT_LD_ADD
=
"-L
\$
(top_srcdir)/mit-pthreads/obj/ -lpthread"
fi
AC_SUBST
(
MT_LD_ADD
)
AC_SUBST
(
MT_LD_ADD
)
LIBS
=
"
$MT_LD_ADD
$LIBS
"
echo
""
echo
""
echo
"Configuring MIT Pthreads"
echo
"Configuring MIT Pthreads"
# We will never install so installation paths are not needed.
# We will never install so installation paths are not needed.
(
cd
mit-pthreads
;
sh ./configure
)
(
cd
mit-pthreads
;
sh ./configure
)
echo
"End of MIT Pthreads configuration"
echo
"End of MIT Pthreads configuration"
echo
""
echo
""
LIBS
=
"
$MT_LD_ADD
$LIBS
"
fi
fi
fi
fi
AC_SUBST
(
sql_server_dirs
)
AC_SUBST
(
sql_server_dirs
)
...
...
mit-pthreads/gen/ctime.c
View file @
b5f76be0
...
@@ -177,7 +177,7 @@ time_t altzone = 0;
...
@@ -177,7 +177,7 @@ time_t altzone = 0;
static
int
detzcode
(
const
char
*
codep
)
static
int
detzcode
(
const
char
*
codep
)
{
{
long
result
;
int
result
;
int
i
;
int
i
;
result
=
0
;
result
=
0
;
...
...
mit-pthreads/machdep/netbsd-1.1/__signal.h
View file @
b5f76be0
#include <sys/signal.h>
#include <sys/signal.h>
__BEGIN_DECLS
#if NSIG <= 32
#if NSIG <= 32
#define __SIGEMPTYSET 0
#define __SIGEMPTYSET 0
#define __SIGFILLSET 0xffffffff
#define __SIGFILLSET 0xffffffff
...
@@ -8,6 +10,9 @@
...
@@ -8,6 +10,9 @@
#define __SIGISMEMBER(s, n) ((*(s) & (1 << ((n) - 1))) != 0)
#define __SIGISMEMBER(s, n) ((*(s) & (1 << ((n) - 1))) != 0)
#else
/* XXX Netbsd >= 1.3H */
#else
/* XXX Netbsd >= 1.3H */
int
sigaction
__P_
((
int
,
const
struct
sigaction
*
,
struct
sigaction
*
))
__RENAME
(
__sigaction14
);
#define __SIGEMPTYSET { 0, 0, 0, 0}
#define __SIGEMPTYSET { 0, 0, 0, 0}
#define __SIGFILLSET { 0xffffffff, 0xffffffff, \
#define __SIGFILLSET { 0xffffffff, 0xffffffff, \
0xffffffff, 0xffffffff }
0xffffffff, 0xffffffff }
...
@@ -18,3 +23,5 @@
...
@@ -18,3 +23,5 @@
#define __SIGISMEMBER(s, n) (((s)->__bits[__SIGWORD(n)] & __SIGMASK(n)) != 0)
#define __SIGISMEMBER(s, n) (((s)->__bits[__SIGWORD(n)] & __SIGMASK(n)) != 0)
#endif
#endif
__END_DECLS
mit-pthreads/stdio/strerror.c
View file @
b5f76be0
...
@@ -36,13 +36,18 @@ static char sccsid[] = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
...
@@ -36,13 +36,18 @@ static char sccsid[] = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
#endif
/* LIBC_SCCS and not lint */
#endif
/* LIBC_SCCS and not lint */
#include <string.h>
#include <string.h>
#if defined(__NetBSD__)
#include <errno.h>
#endif
char
*
char
*
strerror
(
num
)
strerror
(
num
)
int
num
;
int
num
;
{
{
#if !defined(__NetBSD__)
extern
int
sys_nerr
;
extern
int
sys_nerr
;
extern
char
*
sys_errlist
[];
extern
char
*
sys_errlist
[];
#endif
#define UPREFIX "Unknown error: "
#define UPREFIX "Unknown error: "
static
char
ebuf
[
40
]
=
UPREFIX
;
/* 64-bit number + slop */
static
char
ebuf
[
40
]
=
UPREFIX
;
/* 64-bit number + slop */
register
unsigned
int
errnum
;
register
unsigned
int
errnum
;
...
@@ -51,7 +56,7 @@ strerror(num)
...
@@ -51,7 +56,7 @@ strerror(num)
errnum
=
num
;
/* convert to unsigned */
errnum
=
num
;
/* convert to unsigned */
if
(
errnum
<
sys_nerr
)
if
(
errnum
<
sys_nerr
)
return
(
sys_errlist
[
errnum
]);
return
(
(
char
*
)
sys_errlist
[
errnum
]);
/* Do this by hand, so we don't include stdio(3). */
/* Do this by hand, so we don't include stdio(3). */
t
=
tmp
;
t
=
tmp
;
...
...
myisam/mi_check.c
View file @
b5f76be0
...
@@ -434,9 +434,9 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
...
@@ -434,9 +434,9 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
}
}
else
else
full_text_keys
++
;
full_text_keys
++
;
/* Check that auto_increment key is bigger than max key value */
if
((
uint
)
share
->
base
.
auto_key
-
1
==
key
)
if
((
uint
)
share
->
base
.
auto_key
-
1
==
key
)
{
{
/* Check that auto_increment key is bigger than max key value */
ulonglong
save_auto_value
=
info
->
s
->
state
.
auto_increment
;
ulonglong
save_auto_value
=
info
->
s
->
state
.
auto_increment
;
info
->
s
->
state
.
auto_increment
=
0
;
info
->
s
->
state
.
auto_increment
=
0
;
info
->
lastinx
=
key
;
info
->
lastinx
=
key
;
...
@@ -456,6 +456,20 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
...
@@ -456,6 +456,20 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
}
}
else
else
info
->
s
->
state
.
auto_increment
=
save_auto_value
;
info
->
s
->
state
.
auto_increment
=
save_auto_value
;
/* Check that there isn't a row with auto_increment = 0 in the table */
mi_extra
(
info
,
HA_EXTRA_KEYREAD
);
bzero
(
info
->
lastkey
,
keyinfo
->
seg
->
length
);
if
(
!
mi_rkey
(
info
,
info
->
rec_buff
,
key
,
info
->
lastkey
,
keyinfo
->
seg
->
length
,
HA_READ_KEY_EXACT
))
{
/* Don't count this as a real warning, as myisamchk can't correct it */
uint
save
=
param
->
warning_printed
;
mi_check_print_warning
(
param
,
"Found row where the auto_increment column has the value 0"
);
param
->
warning_printed
=
save
;
}
mi_extra
(
info
,
HA_EXTRA_NO_KEYREAD
);
}
}
length
=
(
my_off_t
)
isam_key_length
(
info
,
keyinfo
)
*
keys
+
param
->
key_blocks
*
2
;
length
=
(
my_off_t
)
isam_key_length
(
info
,
keyinfo
)
*
keys
+
param
->
key_blocks
*
2
;
...
...
myisam/myisamchk.c
View file @
b5f76be0
...
@@ -206,7 +206,7 @@ static struct option long_options[] =
...
@@ -206,7 +206,7 @@ static struct option long_options[] =
static
void
print_version
(
void
)
static
void
print_version
(
void
)
{
{
printf
(
"%s Ver 1.4
7
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
printf
(
"%s Ver 1.4
8
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
MACHINE_TYPE
);
}
}
...
...
mysql-test/r/auto_increment.result
View file @
b5f76be0
...
@@ -55,3 +55,8 @@ ordid ord
...
@@ -55,3 +55,8 @@ ordid ord
2 sdj
2 sdj
3 sdj
3 sdj
1 zzz
1 zzz
a
0
Table Op Msg_type Msg_text
test.t1 check warning Found row where the auto_increment column has the value 0
test.t1 check status OK
mysql-test/r/limit.result
View file @
b5f76be0
...
@@ -20,3 +20,6 @@ a b
...
@@ -20,3 +20,6 @@ a b
a b
a b
2 2
2 2
3 4
3 4
i
2
1
mysql-test/r/lock.result
View file @
b5f76be0
...
@@ -4,3 +4,7 @@ Table Op Msg_type Msg_text
...
@@ -4,3 +4,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
test.t1 check status OK
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t2 check error Table 't2' was not locked with LOCK TABLES
n
4
n
1
mysql-test/r/rpl_sporadic_master.result
View file @
b5f76be0
n
n
1
1
0
2
11
3
12
4
13
5
14
6
15
mysql-test/t/auto_increment.test
View file @
b5f76be0
...
@@ -64,3 +64,14 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null
...
@@ -64,3 +64,14 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null
insert
into
t1
values
(
NULL
,
'sdj'
),(
NULL
,
'sdj'
),(
NULL
,
"abc"
),(
NULL
,
'abc'
),(
NULL
,
'zzz'
),(
NULL
,
'sdj'
),(
NULL
,
'abc'
);
insert
into
t1
values
(
NULL
,
'sdj'
),(
NULL
,
'sdj'
),(
NULL
,
"abc"
),(
NULL
,
'abc'
),(
NULL
,
'zzz'
),(
NULL
,
'sdj'
),(
NULL
,
'abc'
);
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Test of auto_increment columns when they are set to 0
#
create
table
t1
(
a
int
not
null
primary
key
auto_increment
);
insert
into
t1
values
(
0
);
update
t1
set
a
=
0
;
select
*
from
t1
;
check
table
t1
;
drop
table
t1
;
mysql-test/t/limit.test
View file @
b5f76be0
...
@@ -17,3 +17,14 @@ select * from t1;
...
@@ -17,3 +17,14 @@ select * from t1;
delete
from
t1
limit
1
;
delete
from
t1
limit
1
;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
i
int
);
insert
into
t1
(
i
)
values
(
1
);
insert
into
t1
(
i
)
values
(
1
);
insert
into
t1
(
i
)
values
(
1
);
delete
from
t1
limit
1
;
update
t1
set
i
=
2
limit
1
;
delete
from
t1
limit
0
;
update
t1
set
i
=
3
limit
0
;
select
*
from
t1
;
drop
table
t1
;
mysql-test/t/lock.test
View file @
b5f76be0
...
@@ -53,3 +53,45 @@ lock tables t1 write;
...
@@ -53,3 +53,45 @@ lock tables t1 write;
check
table
t2
;
check
table
t2
;
unlock
tables
;
unlock
tables
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#test to see if select will get the lock ahead of low priority update
connect
(
locker
,
localhost
,
root
,,);
connect
(
reader
,
localhost
,
root
,,);
connect
(
writer
,
localhost
,
root
,,);
connection
locker
;
create
table
t1
(
n
int
);
insert
into
t1
values
(
1
);
lock
tables
t1
write
;
connection
writer
;
send
update
low_priority
t1
set
n
=
4
;
connection
reader
;
--
sleep
2
send
select
n
from
t1
;
connection
locker
;
--
sleep
2
unlock
tables
;
connection
writer
;
reap
;
connection
reader
;
reap
;
drop
table
t1
;
connection
locker
;
create
table
t1
(
n
int
);
insert
into
t1
values
(
1
);
lock
tables
t1
read
;
connection
writer
;
send
update
low_priority
t1
set
n
=
4
;
connection
reader
;
--
sleep
2
send
select
n
from
t1
;
connection
locker
;
--
sleep
2
unlock
tables
;
connection
writer
;
reap
;
connection
reader
;
reap
;
drop
table
t1
;
mysql-test/t/rpl_sporadic_master.test
View file @
b5f76be0
#test to see if replication can continue when master sporadically fails on
#
test to see if replication can continue when master sporadically fails on
# COM_BINLOG_DUMP and additionally limits the number of events per dump
# COM_BINLOG_DUMP and additionally limits the number of events per dump
source
include
/
master
-
slave
.
inc
;
source
include
/
master
-
slave
.
inc
;
connection
master
;
connection
master
;
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
create
table
t1
(
n
int
not
null
auto_increment
primary
key
);
create
table
t1
(
n
int
not
null
auto_increment
primary
key
);
insert
into
t1
values
(
NULL
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
truncate
table
t1
;
delete
from
t1
;
insert
into
t1
values
(
NULL
),(
NULL
);
# We have to use 4 in the following to make this test work with all table types
insert
into
t1
values
(
4
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
flush
logs
;
flush
logs
;
truncate
table
t1
;
delete
from
t1
;
insert
into
t1
values
(
NULL
),(
NULL
);
insert
into
t1
values
(
10
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
insert
into
t1
values
(
NULL
),(
NULL
);
save_master_pos
;
save_master_pos
;
...
...
mysys/thr_lock.c
View file @
b5f76be0
...
@@ -110,7 +110,8 @@ my_bool init_thr_lock()
...
@@ -110,7 +110,8 @@ my_bool init_thr_lock()
}
}
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG
static
int
found_errors
=
0
;
#define MAX_FOUND_ERRORS 10
/* Report 10 first errors */
static
uint
found_errors
=
0
;
static
int
check_lock
(
struct
st_lock_list
*
list
,
const
char
*
lock_type
,
static
int
check_lock
(
struct
st_lock_list
*
list
,
const
char
*
lock_type
,
const
char
*
where
,
my_bool
same_thread
)
const
char
*
where
,
my_bool
same_thread
)
...
@@ -167,15 +168,16 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
...
@@ -167,15 +168,16 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
static
void
check_locks
(
THR_LOCK
*
lock
,
const
char
*
where
,
static
void
check_locks
(
THR_LOCK
*
lock
,
const
char
*
where
,
my_bool
allow_no_locks
)
my_bool
allow_no_locks
)
{
{
if
(
!
found_errors
)
uint
old_found_errors
=
found_errors
;
if
(
found_errors
<
MAX_FOUND_ERRORS
)
{
{
if
(
check_lock
(
&
lock
->
write
,
"write"
,
where
,
1
)
|
if
(
check_lock
(
&
lock
->
write
,
"write"
,
where
,
1
)
|
check_lock
(
&
lock
->
write_wait
,
"write_wait"
,
where
,
0
)
|
check_lock
(
&
lock
->
write_wait
,
"write_wait"
,
where
,
0
)
|
check_lock
(
&
lock
->
read
,
"read"
,
where
,
0
)
|
check_lock
(
&
lock
->
read
,
"read"
,
where
,
0
)
|
check_lock
(
&
lock
->
read_wait
,
"read_wait"
,
where
,
0
))
check_lock
(
&
lock
->
read_wait
,
"read_wait"
,
where
,
0
))
found_errors
=
1
;
found_errors
++
;
if
(
!
found_errors
)
if
(
found_errors
<
MAX_FOUND_ERRORS
)
{
{
uint
count
=
0
;
uint
count
=
0
;
THR_LOCK_DATA
*
data
;
THR_LOCK_DATA
*
data
;
...
@@ -186,7 +188,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -186,7 +188,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
}
if
(
count
!=
lock
->
read_no_write_count
)
if
(
count
!=
lock
->
read_no_write_count
)
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': Locks read_no_write_count was %u when it should have been %u
\n
"
,
where
,
lock
->
read_no_write_count
,
count
);
"Warning at '%s': Locks read_no_write_count was %u when it should have been %u
\n
"
,
where
,
lock
->
read_no_write_count
,
count
);
}
}
...
@@ -196,7 +198,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -196,7 +198,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
if
(
!
allow_no_locks
&&
!
lock
->
read
.
data
&&
if
(
!
allow_no_locks
&&
!
lock
->
read
.
data
&&
(
lock
->
write_wait
.
data
||
lock
->
read_wait
.
data
))
(
lock
->
write_wait
.
data
||
lock
->
read_wait
.
data
))
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': No locks in use but locks are in wait queue
\n
"
,
"Warning at '%s': No locks in use but locks are in wait queue
\n
"
,
where
);
where
);
...
@@ -205,7 +207,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -205,7 +207,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
{
{
if
(
!
allow_no_locks
&&
lock
->
read_wait
.
data
)
if
(
!
allow_no_locks
&&
lock
->
read_wait
.
data
)
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': No write locks and waiting read locks
\n
"
,
"Warning at '%s': No write locks and waiting read locks
\n
"
,
where
);
where
);
...
@@ -221,7 +223,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -221,7 +223,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
(
lock
->
write_wait
.
data
->
type
==
TL_WRITE_DELAYED
&&
(
lock
->
write_wait
.
data
->
type
==
TL_WRITE_DELAYED
&&
!
lock
->
read
.
data
)))
!
lock
->
read
.
data
)))
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': Write lock %d waiting while no exclusive read locks
\n
"
,
where
,(
int
)
lock
->
write_wait
.
data
->
type
);
"Warning at '%s': Write lock %d waiting while no exclusive read locks
\n
"
,
where
,(
int
)
lock
->
write_wait
.
data
->
type
);
}
}
...
@@ -235,7 +237,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -235,7 +237,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
lock
->
write
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
&&
lock
->
write
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
&&
lock
->
write_wait
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
)
lock
->
write_wait
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
)
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock
\n
"
,
"Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock
\n
"
,
where
);
where
);
...
@@ -243,16 +245,18 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -243,16 +245,18 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
}
if
(
lock
->
read
.
data
)
if
(
lock
->
read
.
data
)
{
{
if
((
!
pthread_equal
(
lock
->
write
.
data
->
thread
,
lock
->
read
.
data
->
thread
)
&&
if
((
!
pthread_equal
(
lock
->
write
.
data
->
thread
,
lock
->
write
.
data
->
type
>
TL_WRITE_DELAYED
)
||
lock
->
read
.
data
->
thread
)
&&
lock
->
write
.
data
->
type
>
TL_WRITE_DELAYED
&&
lock
->
write
.
data
->
type
!=
TL_WRITE_ONLY
)
||
((
lock
->
write
.
data
->
type
==
TL_WRITE_CONCURRENT_INSERT
||
((
lock
->
write
.
data
->
type
==
TL_WRITE_CONCURRENT_INSERT
||
lock
->
write
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
)
&&
lock
->
write
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
)
&&
lock
->
read_no_write_count
))
lock
->
read_no_write_count
))
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': Found lock that is write and read locked
\n
"
,
"Warning at '%s': Found lock
of type %d
that is write and read locked
\n
"
,
where
);
where
,
lock
->
write
.
data
->
type
);
}
}
}
}
if
(
lock
->
read_wait
.
data
)
if
(
lock
->
read_wait
.
data
)
...
@@ -260,7 +264,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -260,7 +264,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
if
(
!
allow_no_locks
&&
lock
->
write
.
data
->
type
<=
TL_WRITE_DELAYED
&&
if
(
!
allow_no_locks
&&
lock
->
write
.
data
->
type
<=
TL_WRITE_DELAYED
&&
lock
->
read_wait
.
data
->
type
<=
TL_READ_HIGH_PRIORITY
)
lock
->
read_wait
.
data
->
type
<=
TL_READ_HIGH_PRIORITY
)
{
{
found_errors
=
1
;
found_errors
++
;
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning at '%s': Found read lock of type %d waiting for write lock of type %d
\n
"
,
"Warning at '%s': Found read lock of type %d waiting for write lock of type %d
\n
"
,
where
,
where
,
...
@@ -270,7 +274,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
...
@@ -270,7 +274,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
}
}
}
}
}
}
if
(
found_errors
)
if
(
found_errors
!=
old_found_errors
)
{
{
DBUG_PRINT
(
"error"
,(
"Found wrong lock"
));
DBUG_PRINT
(
"error"
,(
"Found wrong lock"
));
}
}
...
...
sql/ha_berkeley.cc
View file @
b5f76be0
...
@@ -453,8 +453,10 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
...
@@ -453,8 +453,10 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
if
((
primary_key
=
table
->
primary_key
)
>=
MAX_KEY
)
if
((
primary_key
=
table
->
primary_key
)
>=
MAX_KEY
)
{
// No primary key
{
// No primary key
primary_key
=
table
->
keys
;
primary_key
=
table
->
keys
;
key_used_on_scan
=
MAX_KEY
;
ref_length
=
hidden_primary_key
=
BDB_HIDDEN_PRIMARY_KEY_LENGTH
;
ref_length
=
hidden_primary_key
=
BDB_HIDDEN_PRIMARY_KEY_LENGTH
;
}
}
else
key_used_on_scan
=
primary_key
;
key_used_on_scan
=
primary_key
;
/* Need some extra memory in case of packed keys */
/* Need some extra memory in case of packed keys */
...
...
sql/ha_gemini.cc
View file @
b5f76be0
/* Copyright (C) 2000 NuSphere Corporation
/* Copyright (C) 2000
MySQL AB &
NuSphere Corporation
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This file is based on ha_berkeley.cc */
#ifdef __GNUC__
#ifdef __GNUC__
#pragma implementation // gcc: Class implementation
#pragma implementation // gcc: Class implementation
...
...
sql/ha_gemini.h
View file @
b5f76be0
/* Copyright (C) 2000 NuSphere Corporation
/* Copyright (C) 2000
MySQL AB &
NuSphere Corporation
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
...
sql/ha_innobase.cc
View file @
b5f76be0
...
@@ -2885,4 +2885,49 @@ ha_innobase::store_lock(
...
@@ -2885,4 +2885,49 @@ ha_innobase::store_lock(
return
(
to
);
return
(
to
);
}
}
/***********************************************************************
Returns the next auto-increment column value for the table. write_row
normally fetches the value from the cache in the data dictionary. This
function in used by SHOW TABLE STATUS and when the first insert to the table
is done after database startup. */
longlong
ha_innobase
::
get_auto_increment
()
/*=============================*/
/* out: the next auto-increment column value */
{
row_prebuilt_t
*
prebuilt
=
(
row_prebuilt_t
*
)
innobase_prebuilt
;
longlong
nr
;
int
error
;
(
void
)
extra
(
HA_EXTRA_KEYREAD
);
index_init
(
table
->
next_number_index
);
/* We use an exclusive lock when we read the max key value from the
auto-increment column index. This is because then build_template will
advise InnoDB to fetch all columns. In SHOW TABLE STATUS the query
id of the auto-increment column is not changed, and previously InnoDB
did not fetch it, causing SHOW TABLE STATUS to show wrong values
for the autoinc column. */
prebuilt
->
select_lock_type
=
LOCK_X
;
prebuilt
->
trx
->
mysql_n_tables_locked
+=
1
;
error
=
index_last
(
table
->
record
[
1
]);
if
(
error
)
{
nr
=
1
;
}
else
{
nr
=
(
longlong
)
table
->
next_number_field
->
val_int_offset
(
table
->
rec_buff_length
)
+
1
;
}
(
void
)
extra
(
HA_EXTRA_NO_KEYREAD
);
index_end
();
return
(
nr
);
}
#endif
/* HAVE_INNOBASE_DB */
#endif
/* HAVE_INNOBASE_DB */
sql/ha_innobase.h
View file @
b5f76be0
...
@@ -147,6 +147,7 @@ class ha_innobase: public handler
...
@@ -147,6 +147,7 @@ class ha_innobase: public handler
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
enum
thr_lock_type
lock_type
);
longlong
get_auto_increment
();
};
};
extern
bool
innodb_skip
;
extern
bool
innodb_skip
;
...
...
sql/mysqld.cc
View file @
b5f76be0
...
@@ -272,6 +272,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
...
@@ -272,6 +272,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
net_interactive_timeout
,
slow_launch_time
=
2L
,
net_interactive_timeout
,
slow_launch_time
=
2L
,
net_read_timeout
,
net_write_timeout
,
slave_open_temp_tables
=
0
,
net_read_timeout
,
net_write_timeout
,
slave_open_temp_tables
=
0
,
open_files_limit
=
0
,
max_binlog_size
;
open_files_limit
=
0
,
max_binlog_size
;
ulong
slave_net_timeout
;
ulong
thread_cache_size
=
0
,
binlog_cache_size
=
0
,
max_binlog_cache_size
=
0
;
ulong
thread_cache_size
=
0
,
binlog_cache_size
=
0
,
max_binlog_cache_size
=
0
;
volatile
ulong
cached_thread_count
=
0
;
volatile
ulong
cached_thread_count
=
0
;
...
@@ -2782,6 +2783,8 @@ CHANGEABLE_VAR changeable_vars[] = {
...
@@ -2782,6 +2783,8 @@ CHANGEABLE_VAR changeable_vars[] = {
0
,
MALLOC_OVERHEAD
,
(
long
)
~
0
,
MALLOC_OVERHEAD
,
IO_SIZE
},
0
,
MALLOC_OVERHEAD
,
(
long
)
~
0
,
MALLOC_OVERHEAD
,
IO_SIZE
},
{
"record_buffer"
,
(
long
*
)
&
my_default_record_cache_size
,
{
"record_buffer"
,
(
long
*
)
&
my_default_record_cache_size
,
128
*
1024L
,
IO_SIZE
*
2
+
MALLOC_OVERHEAD
,
~
0L
,
MALLOC_OVERHEAD
,
IO_SIZE
},
128
*
1024L
,
IO_SIZE
*
2
+
MALLOC_OVERHEAD
,
~
0L
,
MALLOC_OVERHEAD
,
IO_SIZE
},
{
"slave_net_timeout"
,
(
long
*
)
&
slave_net_timeout
,
SLAVE_NET_TIMEOUT
,
1
,
65535
,
0
,
1
},
{
"slow_launch_time"
,
(
long
*
)
&
slow_launch_time
,
{
"slow_launch_time"
,
(
long
*
)
&
slow_launch_time
,
2L
,
0L
,
~
0L
,
0
,
1
},
2L
,
0L
,
~
0L
,
0
,
1
},
{
"sort_buffer"
,
(
long
*
)
&
sortbuff_size
,
{
"sort_buffer"
,
(
long
*
)
&
sortbuff_size
,
...
@@ -2903,6 +2906,7 @@ struct show_var_st init_vars[]= {
...
@@ -2903,6 +2906,7 @@ struct show_var_st init_vars[]= {
{
"query_buffer_size"
,
(
char
*
)
&
query_buff_size
,
SHOW_LONG
},
{
"query_buffer_size"
,
(
char
*
)
&
query_buff_size
,
SHOW_LONG
},
{
"safe_show_database"
,
(
char
*
)
&
opt_safe_show_db
,
SHOW_BOOL
},
{
"safe_show_database"
,
(
char
*
)
&
opt_safe_show_db
,
SHOW_BOOL
},
{
"server_id"
,
(
char
*
)
&
server_id
,
SHOW_LONG
},
{
"server_id"
,
(
char
*
)
&
server_id
,
SHOW_LONG
},
{
"slave_net_timeout"
,
(
char
*
)
&
slave_net_timeout
,
SHOW_LONG
},
{
"skip_locking"
,
(
char
*
)
&
my_disable_locking
,
SHOW_MY_BOOL
},
{
"skip_locking"
,
(
char
*
)
&
my_disable_locking
,
SHOW_MY_BOOL
},
{
"skip_networking"
,
(
char
*
)
&
opt_disable_networking
,
SHOW_BOOL
},
{
"skip_networking"
,
(
char
*
)
&
opt_disable_networking
,
SHOW_BOOL
},
{
"skip_show_database"
,
(
char
*
)
&
opt_skip_show_db
,
SHOW_BOOL
},
{
"skip_show_database"
,
(
char
*
)
&
opt_skip_show_db
,
SHOW_BOOL
},
...
...
sql/slave.cc
View file @
b5f76be0
...
@@ -735,6 +735,7 @@ static int init_slave_thread(THD* thd)
...
@@ -735,6 +735,7 @@ static int init_slave_thread(THD* thd)
thd
->
system_thread
=
thd
->
bootstrap
=
1
;
thd
->
system_thread
=
thd
->
bootstrap
=
1
;
thd
->
client_capabilities
=
0
;
thd
->
client_capabilities
=
0
;
my_net_init
(
&
thd
->
net
,
0
);
my_net_init
(
&
thd
->
net
,
0
);
thd
->
net
.
timeout
=
slave_net_timeout
;
thd
->
max_packet_length
=
thd
->
net
.
max_packet
;
thd
->
max_packet_length
=
thd
->
net
.
max_packet
;
thd
->
master_access
=
~
0
;
thd
->
master_access
=
~
0
;
thd
->
priv_user
=
0
;
thd
->
priv_user
=
0
;
...
...
sql/slave.h
View file @
b5f76be0
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
#define SLAVE_H
#define SLAVE_H
#include "mysql.h"
#include "mysql.h"
#define SLAVE_NET_TIMEOUT 3600
extern
ulong
slave_net_timeout
;
typedef
struct
st_master_info
typedef
struct
st_master_info
{
{
...
...
sql/sql_acl.cc
View file @
b5f76be0
...
@@ -1824,9 +1824,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights,
...
@@ -1824,9 +1824,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights,
*
Str
,
*
Str
,
(
!
db
?
rights
:
0
),
what
)))
(
!
db
?
rights
:
0
),
what
)))
result
=
-
1
;
result
=
-
1
;
if
(
db
)
if
(
db
&&
replace_db_table
(
tables
[
1
].
table
,
db
,
*
Str
,
rights
&
DB_ACLS
,
if
((
replace_db_table
(
tables
[
1
].
table
,
db
,
*
Str
,
rights
,
what
))
what
)))
result
=
-
1
;
result
=
-
1
;
}
}
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
...
...
sql/sql_delete.cc
View file @
b5f76be0
...
@@ -178,12 +178,13 @@ int mysql_delete(THD *thd,
...
@@ -178,12 +178,13 @@ int mysql_delete(THD *thd,
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
)
if
(
error
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
if
(
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
SQL_SAFE_UPDATES
),
if
((
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
SQL_SAFE_UPDATES
),
limit
))
limit
))
||
!
limit
)
{
{
delete
select
;
delete
select
;
send_ok
(
&
thd
->
net
,
0L
);
send_ok
(
&
thd
->
net
,
0L
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
// Nothing to delete
}
}
/* If running in safe sql mode, don't allow updates without keys */
/* If running in safe sql mode, don't allow updates without keys */
...
...
sql/sql_parse.cc
View file @
b5f76be0
...
@@ -556,7 +556,7 @@ pthread_handler_decl(handle_one_connection,arg)
...
@@ -556,7 +556,7 @@ pthread_handler_decl(handle_one_connection,arg)
free_root
(
&
thd
->
mem_root
,
MYF
(
0
));
free_root
(
&
thd
->
mem_root
,
MYF
(
0
));
if
(
net
->
error
&&
net
->
vio
!=
0
)
if
(
net
->
error
&&
net
->
vio
!=
0
)
{
{
if
(
!
thd
->
killed
&&
!
opt_warnings
)
if
(
!
thd
->
killed
&&
opt_warnings
)
sql_print_error
(
ER
(
ER_NEW_ABORTING_CONNECTION
),
sql_print_error
(
ER
(
ER_NEW_ABORTING_CONNECTION
),
thd
->
thread_id
,(
thd
->
db
?
thd
->
db
:
"unconnected"
),
thd
->
thread_id
,(
thd
->
db
?
thd
->
db
:
"unconnected"
),
thd
->
user
?
thd
->
user
:
"unauthenticated"
,
thd
->
user
?
thd
->
user
:
"unauthenticated"
,
...
...
sql/sql_show.cc
View file @
b5f76be0
...
@@ -599,7 +599,7 @@ mysqld_show_logs(THD *thd)
...
@@ -599,7 +599,7 @@ mysqld_show_logs(THD *thd)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
if
(
berkeley_show_logs
(
thd
))
if
(
!
berkeley_skip
&&
berkeley_show_logs
(
thd
))
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
#endif
#endif
...
...
sql/sql_update.cc
View file @
b5f76be0
...
@@ -114,7 +114,8 @@ int mysql_update(THD *thd,
...
@@ -114,7 +114,8 @@ int mysql_update(THD *thd,
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
||
if
(
error
||
(
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
SQL_SAFE_UPDATES
),
(
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
SQL_SAFE_UPDATES
),
limit
)))
limit
))
||
!
limit
)
{
{
delete
select
;
delete
select
;
table
->
time_stamp
=
save_time_stamp
;
// Restore timestamp pointer
table
->
time_stamp
=
save_time_stamp
;
// Restore timestamp pointer
...
...
tests/fork2_test.pl
View file @
b5f76be0
...
@@ -6,6 +6,9 @@
...
@@ -6,6 +6,9 @@
# the last 3 does different selects on the tables.
# the last 3 does different selects on the tables.
# Er, hmmm..., something like that :^)
# Er, hmmm..., something like that :^)
# Modified to do crazy-join, la Nasdaq.
# Modified to do crazy-join, la Nasdaq.
#
# This test uses the old obsolete mysql interface. For a test that uses
# DBI, please take a look at fork_big.pl
$opt_loop_count
=
10000
;
# Change this to make test harder/easier
$opt_loop_count
=
10000
;
# Change this to make test harder/easier
...
@@ -26,8 +29,8 @@ GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in",
...
@@ -26,8 +29,8 @@ GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in",
"
force
")
||
die
"
Aborted
";
"
force
")
||
die
"
Aborted
";
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$
Mysql::
db_errstr
=
$opt_force
=
undef
;
# Ignore warnings from these
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$
Mysql::
db_errstr
=
$opt_force
=
undef
;
# Ignore warnings from these
print
"
Testing
9
multiple connections to a server with 1 insert/update
\n
";
print
"
Testing
10
multiple connections to a server with 1 insert/update
\n
";
print
"
and 8 select connections.
\n
";
print
"
and 8 select connections
and one ALTER TABLE
.
\n
";
@testtables
=
qw(bench_f21 bench_f22 bench_f23 bench_f24 bench_f25)
;
@testtables
=
qw(bench_f21 bench_f22 bench_f23 bench_f24 bench_f25)
;
...
@@ -83,6 +86,7 @@ test_2() if (($pid=fork()) == 0); $work{$pid}="simple3";
...
@@ -83,6 +86,7 @@ test_2() if (($pid=fork()) == 0); $work{$pid}="simple3";
test_3
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
funny3
";
test_3
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
funny3
";
test_2
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
simple4
";
test_2
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
simple4
";
test_3
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
funny4
";
test_3
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
funny4
";
alter_test
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
alter
";
$errors
=
0
;
$errors
=
0
;
while
((
$pid
=
wait
())
!=
-
1
)
while
((
$pid
=
wait
())
!=
-
1
)
...
@@ -205,6 +209,33 @@ sub test_3
...
@@ -205,6 +209,33 @@ sub test_3
exit
(
0
);
exit
(
0
);
}
}
#
# Do an ALTER TABLE every 20 seconds
#
sub
alter_test
{
my
(
$dbh
,
$count
,
$old_row_count
,
$row_count
,
$id
,
@row
,
$sth
);
$dbh
=
Mysql
->
Connect
(
$opt_host
,
$opt_db
)
||
die
$
Mysql::
db_errstr
;
$id
=
$count
=
$row_count
=
0
;
$old_row_count
=
-
1
;
# Execute the test as long as we get more data into the table
while
(
$row_count
!=
$old_row_count
)
{
sleep
(
10
);
$sth
=
$dbh
->
Query
("
ALTER TABLE
$testtables
[
$id
] modify info varchar(32)
")
or
die
"
Couldn't execute ALTER TABLE
\n
";
$sth
=
0
;
$id
=
(
$id
+
1
)
%
$numtables
;
# Test if insert test has ended
$sth
=
$dbh
->
query
("
select count(*) from
$testtables
[0]
")
or
die
"
Couldn't execute count(*)
\n
";
@row
=
$sth
->
FetchRow
();
$old_row_count
=
$row_count
;
$row_count
=
$row
[
0
];
$count
++
;
}
$dbh
=
0
;
print
"
alter: Executed
$count
ALTER TABLE commands
\n
";
exit
(
0
);
}
tests/fork_big.pl
View file @
b5f76be0
...
@@ -23,7 +23,7 @@ GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","s
...
@@ -23,7 +23,7 @@ GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","s
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$opt_force
=
undef
;
# Ignore warnings from these
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$opt_force
=
undef
;
# Ignore warnings from these
print
"
Test of multiple connections that test the following things:
\n
";
print
"
Test of multiple connections that test the following things:
\n
";
print
"
insert, select, delete, update, check, repair and flush
\n
";
print
"
insert, select, delete, update,
alter,
check, repair and flush
\n
";
@testtables
=
(
["
bench_f31
",
""],
@testtables
=
(
["
bench_f31
",
""],
["
bench_f32
",
"
row_format=fixed
"],
["
bench_f32
",
"
row_format=fixed
"],
...
@@ -34,6 +34,7 @@ $abort_table="bench_f39";
...
@@ -34,6 +34,7 @@ $abort_table="bench_f39";
$numtables
=
$#testtables
+
1
;
$numtables
=
$#testtables
+
1
;
srand
100
;
# Make random numbers repeatable
srand
100
;
# Make random numbers repeatable
####
####
#### Start timeing and start test
#### Start timeing and start test
####
####
...
@@ -88,12 +89,14 @@ for ($i=0 ; $i < $opt_threads ; $i ++)
...
@@ -88,12 +89,14 @@ for ($i=0 ; $i < $opt_threads ; $i ++)
{
{
test_select
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select_key
";
test_select
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select_key
";
}
}
test_join
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
test_join
";
test_select_count
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select_count
";
test_select_count
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select_count
";
test_delete
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
delete
";
test_delete
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
delete
";
test_update
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
update
";
test_update
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
update
";
test_flush
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
flush
";
test_flush
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
flush
";
test_check
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
check
";
test_check
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
check
";
test_repair
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
repair
";
test_repair
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
repair
";
test_alter
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
alter
";
#test_database("test2") if (($pid=fork()) == 0); $work{$pid}="check_database";
#test_database("test2") if (($pid=fork()) == 0); $work{$pid}="check_database";
print
"
Started
"
.
(
$opt_threads
*
2
+
4
)
.
"
threads
\n
";
print
"
Started
"
.
(
$opt_threads
*
2
+
4
)
.
"
threads
\n
";
...
@@ -243,6 +246,44 @@ sub test_select_count
...
@@ -243,6 +246,44 @@ sub test_select_count
exit
(
0
);
exit
(
0
);
}
}
#
# select records
# Do continously joins between the first and second table
#
sub
test_join
{
my
(
$dbh
,
$i
,
$j
,
$count
,
$loop
);
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
$count_query
=
make_count_query
(
$numtables
);
$count
=
0
;
$loop
=
9999
;
$i
=
0
;
while
((
$i
++
%
100
)
||
!
test_if_abort
(
$dbh
))
{
if
(
$loop
++
>=
100
)
{
$loop
=
0
;
$row_counts
=
simple_query
(
$dbh
,
$count_query
);
}
for
(
$j
=
0
;
$j
<
$numtables
-
1
;
$j
++
)
{
my
(
$id
)
=
int
rand
$row_counts
->
[
$j
];
my
(
$t1
,
$t2
)
=
(
$testtables
[
$j
]
->
[
0
],
$testtables
[
$j
+
1
]
->
[
0
]);
simple_query
(
$dbh
,
"
select
$t1
.id,
$t2
.info from
$t1
,
$t2
where
$t1
.id=
$t2
.id and
$t1
.id=
$id
");
$count
++
;
}
}
$dbh
->
disconnect
;
$dbh
=
0
;
print
"
Test_join: Executed
$count
joins
\n
";
exit
(
0
);
}
#
#
# Delete 1-5 rows from the first 2 tables.
# Delete 1-5 rows from the first 2 tables.
# Test ends when the number of rows for table 3 didn't change during
# Test ends when the number of rows for table 3 didn't change during
...
@@ -457,6 +498,29 @@ sub test_database
...
@@ -457,6 +498,29 @@ sub test_database
exit
(
0
);
exit
(
0
);
}
}
#
# Test ALTER TABLE on the second table
#
sub
test_alter
{
my
(
$dbh
,
$row
,
$i
,
$type
,
$table
);
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
for
(
$i
=
0
;
!
test_if_abort
(
$dbh
)
;
$i
++
)
{
sleep
(
100
);
$table
=
$testtables
[
1
]
->
[
0
];
$sth
=
$dbh
->
prepare
("
ALTER table
$table
modify info char(32)
")
||
die
"
Got error on prepare:
$DBI
::errstr
\n
";
$sth
->
execute
||
die
$
DBI::
errstr
;
}
$dbh
->
disconnect
;
$dbh
=
0
;
print
"
test_alter: Executed
$i
ALTER TABLE
\n
";
exit
(
0
);
}
#
#
# Help functions
# Help functions
...
@@ -507,8 +571,8 @@ sub simple_query()
...
@@ -507,8 +571,8 @@ sub simple_query()
my
(
$dbh
,
$query
)
=
@_
;
my
(
$dbh
,
$query
)
=
@_
;
my
(
$sth
,
$row
);
my
(
$sth
,
$row
);
$sth
=
$dbh
->
prepare
(
$query
)
||
die
"
Got error on '
$query
':
$DBI
::errstr
\n
";
$sth
=
$dbh
->
prepare
(
$query
)
||
die
"
Got error on '
$query
':
"
.
$dbh
->
errstr
.
"
\n
";
$sth
->
execute
||
die
"
Got error on '
$query
':
$dbh
->errstr
\n
";
$sth
->
execute
||
die
"
Got error on '
$query
':
"
.
$dbh
->
errstr
.
"
\n
";
$row
=
$sth
->
fetchrow_arrayref
();
$row
=
$sth
->
fetchrow_arrayref
();
$sth
=
0
;
$sth
=
0
;
return
$row
;
return
$row
;
...
...
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