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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
80b7f100
Commit
80b7f100
authored
Mar 09, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql
into mysql.sashanet.com:/home/sasha/src/bk/mysql
parents
7e3cb5fa
267c8760
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
502 additions
and
144 deletions
+502
-144
Docs/manual.texi
Docs/manual.texi
+270
-79
configure.in
configure.in
+26
-0
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+5
-0
mysql-test/r/delayed.result
mysql-test/r/delayed.result
+5
-0
mysql-test/t/delayed.test
mysql-test/t/delayed.test
+16
-0
scripts/mysql_install_db.sh
scripts/mysql_install_db.sh
+1
-1
scripts/mysqldumpslow.sh
scripts/mysqldumpslow.sh
+112
-50
sql-bench/crash-me.sh
sql-bench/crash-me.sh
+1
-0
sql/field_conv.cc
sql/field_conv.cc
+2
-1
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+2
-1
sql/sql_class.cc
sql/sql_class.cc
+2
-1
sql/sql_delete.cc
sql/sql_delete.cc
+1
-1
sql/sql_insert.cc
sql/sql_insert.cc
+16
-5
tests/fork3_test.pl
tests/fork3_test.pl
+42
-4
No files found.
Docs/manual.texi
View file @
80b7f100
This diff is collapsed.
Click to expand it.
configure.in
View file @
80b7f100
...
...
@@ -1906,6 +1906,32 @@ dnl echo "bdb = '$bdb'; inc = '$bdb_includes', lib = '$bdb_libs'"
fi
AC_DEFINE
(
HAVE_BERKELEY_DB
)
else
if
test
-d
bdb
;
then
:
else
mkdir
bdb
&&
mkdir
bdb/build_unix
fi
if
test
-r
bdb/build_unix/db.h
;
then
:
else
cat
<<
EOF
> bdb/build_unix/db.h
This file is a placeholder to fool make. The way that automake
and GNU make work together causes some files to depend on this
header, even if we're not building with Berkeley DB.
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
the real db.h.
If you run into some problems because of this file, please use mysql_bug
to generate a bug report, and give the exact output of make and any
details you can think of. Send the message to bugs@lists.mysql.com.
Thank you!
EOF
fi
fi
if
test
X
"
$have_innobase_db
"
=
Xyes
...
...
mysql-test/mysql-test-run.sh
View file @
80b7f100
...
...
@@ -291,6 +291,11 @@ report_stats () {
xwhole
=
`
$EXPR
$whole
\*
100
`
deci
=
`
$EXPR
$raw
-
$xwhole
`
$ECHO
"Failed
${
TOT_FAIL
}
/
${
TOT_TEST
}
tests,
${
whole
}
.
${
deci
}
% successful."
$ECHO
""
$ECHO
"The log files in
$MYSQL_TEST_DIR
/var/log may give you some hint"
$ECHO
"of what when wrong."
$ECHO
"If you want to report this error, please read first the documentation at"
$ECHO
"http://www.mysql.com/doc/M/y/MySQL_test_suite.html"
fi
}
...
...
mysql-test/r/delayed.result
View file @
80b7f100
...
...
@@ -3,3 +3,8 @@ a tmsp
5 19711006010203
6 19711006010203
8 19711006010203
a b
1 b
2 c
3 d
4 e
mysql-test/t/delayed.test
View file @
80b7f100
...
...
@@ -11,7 +11,23 @@ insert delayed into t1 set a = 4;
insert
delayed
into
t1
set
a
=
5
,
tmsp
=
19711006010203
;
insert
delayed
into
t1
(
a
,
tmsp
)
values
(
6
,
19711006010203
);
insert
delayed
into
t1
(
a
,
tmsp
)
values
(
7
,
NULL
);
--
sleep
1
insert
into
t1
set
a
=
8
,
tmsp
=
19711006010203
;
select
*
from
t1
where
tmsp
=
0
;
select
*
from
t1
where
tmsp
=
19711006010203
;
drop
table
t1
;
#
# Test bug when inserting NULL into an auto_increment field with
# INSERT DELAYED
#
create
table
t1
(
a
int
not
null
auto_increment
primary
key
,
b
char
(
10
));
insert
delayed
into
t1
values
(
1
,
"b"
);
insert
delayed
into
t1
values
(
null
,
"c"
);
insert
delayed
into
t1
values
(
3
,
"d"
),(
null
,
"e"
);
--
error
1136
insert
delayed
into
t1
values
(
3
,
"this will give an"
,
"error"
);
--
sleep
2
select
*
from
t1
;
drop
table
t1
;
scripts/mysql_install_db.sh
View file @
80b7f100
...
...
@@ -282,7 +282,7 @@ fi
echo
"Installing all prepared tables"
if
eval
"
$execdir
/mysqld
$defaults
--bootstrap --skip-grant-tables
\
--basedir=
$basedir
--datadir=
$ldata
--skip-innobase --skip-gem
e
ni --skip-bdb
$args
"
<<
END_OF_DATA
--basedir=
$basedir
--datadir=
$ldata
--skip-innobase --skip-gem
i
ni --skip-bdb
$args
"
<<
END_OF_DATA
use mysql;
$c_d
$i_d
...
...
scripts/mysqldumpslow.sh
View file @
80b7f100
#!@PERL@
# mysqldumpslow - parse and summarize the MySQL slow query log
# Original version by Tim Bunce, sometime in 2000.
# Further changes by Tim Bunce, 8th March 2001.
use strict
;
use Getopt::Long
;
...
...
@@ -8,69 +11,128 @@ use Getopt::Long;
# at, al, and ar are the corresponding averages
my %opt
=
(
s
=>
'at'
,
h
=>
'*'
,
s
=>
'at'
,
h
=>
'*'
,
)
;
GetOptions
(
\%
opt,
'v+'
,
# verbose
'd+'
,
# debug
's=s'
,
# what to sort by (t, at, l, al, r, ar etc)
'a!'
,
# don't abstract all numbers to N and strings to 'S'
'g=s'
,
# grep: only consider stmts that include this string
'h=s'
,
# hostname of db server (can be wildcard)
'v+'
,
# verbose
'd+'
,
# debug
's=s'
,
# what to sort by (t, at, l, al, r, ar etc)
'r!'
,
# reverse the sort order (largest last instead of first)
't=i'
,
# just show the top n queries
'a!'
,
# don't abstract all numbers to N and strings to 'S'
'n=i'
,
# abstract numbers with at least n digits within names
'g=s'
,
# grep: only consider stmts that include this string
'h=s'
,
# hostname of db server for *-slow.log filename (can be wildcard)
'i=s'
,
# name of server instance (if using mysql.server startup script)
'l!'
,
# don't subtract lock time from total time
)
or die
"Bad option"
;
my %stmt
;
my
$datadir
=
"/var/lib/mysql"
;
# XXX should fetch dynamically
@ARGV
=
<
$datadir
/
$opt
{
h
}
-slow
.log>
;
$/
=
"
\n
#"
;
# read entire statements using paragraph mode
while
(
<
>)
{
print
"[
$_
]
\n
"
if
$opt
{
v
}
;
s/^#// unless %stmt
;
s/
\s
*
Time:
(
\d
+
)
Lock_time:
(
\d
+
)
Rows_sent:
(
\d
+
)
.
*
\n
//
;
my
(
$t
,
$l
,
$r
)
=
(
$1
,
$2
,
$3
)
;
s/^use
\w
+
;
\n
//
;
# not consistently added
s/^SET
timestamp
=
\d
+
;
\n
//
;
s/^[
]
*
\n
//mg
;
# delete blank lines
s/^[
]
*
/ /mg
;
# normalize leading whitespace
s/
\s
*
;
\s
*
(
#\s*)?$//; # remove traing semicolon(+newline-hash)
next
if
$opt
{
g
}
and
!
m/
$opt
{
g
}
/i
;
unless
(
$opt
{
a
})
{
s/
\b\d
+
\b
/N/g
;
s/
\b
0x[0-9A-Fa-f]+
\b
/N/g
;
s/
'.*?'
/
'S'
/g
;
s/
".*?"
/
"S"
/g
;
}
unless
(
@ARGV
)
{
my
$defaults
=
`
my_print_defaults mysqld
`
;
my
$basedir
=
(
$defaults
=
~ m/--basedir
=(
.
*
)
/
)[
0]
or die
"Can't determine basedir from 'my_print_defaults mysqld' output:
$defaults
"
;
warn
"basedir=
$basedir
\n
"
if
$opt
{
v
}
;
my
$datadir
=
(
$defaults
=
~ m/--datadir
=(
.
*
)
/
)[
0]
;
if
(!
$datadir
or
$opt
{
i
})
{
# determine the datadir from the instances section of /etc/my.cnf, if any
my
$instances
=
`
my_print_defaults instances
`
;
die
"Can't determine datadir from 'my_print_defaults mysqld' output:
$defaults
"
unless
$instances
;
my @instances
=
(
$instances
=
~ m/^--
(
\w
+
)
-/mg
)
;
die
"No -i 'instance_name' specified to select among known instances: @instances.
\n
"
unless
$opt
{
i
}
;
die
"Instance '
$opt
{i}' is unknown (known instances: @instances)
\n
"
unless
grep
{
$_
eq
$opt
{
i
}
}
@instances
;
$datadir
=
(
$instances
=
~ m/--
$opt
{
i
}
-datadir
=(
.
*
)
/
)[
0]
or die
"Can't determine --
$opt
{i}-datadir from 'my_print_defaults instances' output:
$instances
"
;
warn
"datadir=
$datadir
\n
"
if
$opt
{
v
}
;
}
@ARGV
=
<
$datadir
/
$opt
{
h
}
-slow
.log>
;
die
"Can't find '
$datadir
/
$opt
{h}-slow.log'
\n
"
unless @ARGV
;
}
$stmt
{
$_
}
->
{
c
}
+
=
1
;
$stmt
{
$_
}
->
{
t
}
+
=
$t
;
$stmt
{
$_
}
->
{
l
}
+
=
$l
;
$stmt
{
$_
}
->
{
r
}
+
=
$r
;
warn
"
\n
Reading mysql slow query log from @ARGV
\n
"
;
warn
"[
$_
]"
if
$opt
{
d
}
;
my @pending
;
my %stmt
;
$/
=
";
\n
#"
;
# read entire statements using paragraph mode
while
(
defined
(
$_
=
shift
@pending
)
or defined
(
$_
=
<
>)
)
{
warn
"[[
$_
]]
\n
"
if
$opt
{
d
}
;
# show raw paragraph being read
my @chunks
=
split
/^
\/
.
*
Version.
*
started with[
\0
00-
\3
77]
*
?Time.
*
Id.
*
Command.
*
Argument.
*
\n
/m
;
if
(
@chunks
>
1
)
{
unshift @pending, map
{
length
(
$_
)
?
$_
:
()
}
@chunks
;
warn
"<<"
.join
(
">>
\n
<<"
,@chunks
)
.
">>"
if
$opt
{
d
}
;
next
;
}
s/^#? Time:
\d
{
6
}
\s
+
\d
+:
\d
+:
\d
+.
*
\n
//
;
my
(
$user
,
$host
)
=
s/^#? User
\@
Host:
\s
+
(
\S
+
)
\s
+
\@\s
+
(
\S
+
)
.
*
\n
// ?
(
$1
,
$2
)
:
(
''
,
''
)
;
s/^# Time:
(
\d
+
)
Lock_time:
(
\d
+
)
Rows_sent:
(
\d
+
)
.
*
\n
//
;
my
(
$t
,
$l
,
$r
)
=
(
$1
,
$2
,
$3
)
;
$t
-
=
$l
unless
$opt
{
l
}
;
# remove fluff that mysqld writes to log when it (re)starts:
s!^/.
*
Version.
*
started with:.
*
\n
!!
mg
;
s!^Tcp port:
\d
+ Unix socket:
\S
+
\n
!!
mg
;
s!^Time.
*
Id.
*
Command.
*
Argument.
*
\n
!!
mg
;
s/^use
\w
+
;
\n
//
;
# not consistently added
s/^SET
timestamp
=
\d
+
;
\n
//
;
s/^[
]
*
\n
//mg
;
# delete blank lines
s/^[
]
*
/ /mg
;
# normalize leading whitespace
s/
\s
*
;
\s
*
(
#\s*)?$//; # remove trailing semicolon(+newline-hash)
next
if
$opt
{
g
}
and
!
m/
$opt
{
g
}
/io
;
unless
(
$opt
{
a
})
{
s/
\b\d
+
\b
/N/g
;
s/
\b
0x[0-9A-Fa-f]+
\b
/N/g
;
s/
'.*?'
/
'S'
/g
;
s/
".*?"
/
"S"
/g
;
# -n=8: turn log_20001231 into log_NNNNNNNN
s/
([
a-z_]+
)(
\d
{
$opt
{
n
}
,
})
/
$1
.
(
'N'
x length
(
$2
))
/ieg
if
$opt
{
n
}
;
# abbreviate massive "in (...)" statements and similar
s!
(([
NS],
){
100,
})!
sprintf
(
"
$2
,{repeated %d times}"
,length
(
$1
)
/2
)!
eg
;
}
my
$s
=
$stmt
{
$_
}
||=
{
users
=>{}
,
hosts
=>{}
}
;
$s
->
{
c
}
+
=
1
;
$s
->
{
t
}
+
=
$t
;
$s
->
{
l
}
+
=
$l
;
$s
->
{
r
}
+
=
$r
;
$s
->
{
users
}
->
{
$user
}
++
if
$user
;
$s
->
{
hosts
}
->
{
$host
}
++
if
$host
;
warn
"{{
$_
}}
\n\n
"
if
$opt
{
d
}
;
# show processed statement string
}
foreach
(
keys %stmt
)
{
my
$v
=
$stmt
{
$_
}
||
die
;
my
(
$c
,
$t
,
$l
,
$r
)
=
@
{
$v
}{
qw
(
c t l r
)}
;
$v
->
{
at
}
=
$t
/
$c
;
$v
->
{
al
}
=
$l
/
$c
;
$v
->
{
ar
}
=
$r
/
$c
;
my
$v
=
$stmt
{
$_
}
||
die
;
my
(
$c
,
$t
,
$l
,
$r
)
=
@
{
$v
}{
qw
(
c t l r
)}
;
$v
->
{
at
}
=
$t
/
$c
;
$v
->
{
al
}
=
$l
/
$c
;
$v
->
{
ar
}
=
$r
/
$c
;
}
my @sorted
=
sort
{
$stmt
{
$a
}
->
{
$opt
{
s
}}
<
=>
$stmt
{
$b
}
->
{
$opt
{
s
}}
}
keys %stmt
;
my @sorted
=
sort
{
$stmt
{
$b
}
->
{
$opt
{
s
}}
<
=>
$stmt
{
$a
}
->
{
$opt
{
s
}}
}
keys %stmt
;
@sorted
=
@sorted[0 ..
$opt
{
t
}
-1
]
if
$opt
{
t
}
;
@sorted
=
reverse @sorted
if
$opt
{
r
}
;
foreach
(
@sorted
)
{
my
$v
=
$stmt
{
$_
}
||
die
;
my
(
$c
,
$t
,
$at
,
$l
,
$al
,
$r
,
$ar
)
=
@
{
$v
}{
qw
(
c t at l al r ar
)}
;
printf
"Count: %d Time: %.2f (%d) Lock_time: %.2f (%d) Rows_sent: %.1f (%d)
\n
%s
\n\n
"
,
$c
,
$at
,
$t
,
$al
,
$l
,
$ar
,
$r
,
$_
;
my
$v
=
$stmt
{
$_
}
||
die
;
my
(
$c
,
$t
,
$at
,
$l
,
$al
,
$r
,
$ar
)
=
@
{
$v
}{
qw
(
c t at l al r ar
)}
;
my @users
=
keys %
{
$v
->
{
users
}}
;
my
$user
=
(
@users
==
1
)
?
$users
[
0] : sprintf
"%dusers"
,scalar @users
;
my @hosts
=
keys %
{
$v
->
{
hosts
}}
;
my
$host
=
(
@hosts
==
1
)
?
$hosts
[
0] : sprintf
"%dhosts"
,scalar @hosts
;
printf
"Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows=%.1f (%d),
$user
\@
$host
\n
%s
\n\n
"
,
$c
,
$at
,
$t
,
$al
,
$l
,
$ar
,
$r
,
$_
;
}
sql-bench/crash-me.sh
View file @
80b7f100
...
...
@@ -47,6 +47,7 @@ require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n";
$opt_server
=
"mysql"
;
$opt_host
=
"localhost"
;
$opt_database
=
"test"
;
$opt_dir
=
"limits"
;
$opt_user
=
$opt_password
=
""
;
$opt_debug
=
$opt_help
=
$opt_Information
=
$opt_restart
=
$opt_force
=
$opt_quick
=
0
;
$opt_log_all_queries
=
$opt_fix_limit_file
=
$opt_batch_mode
=
0
;
$opt_db_start_cmd
=
""
;
# the db server start command
...
...
sql/field_conv.cc
View file @
80b7f100
...
...
@@ -133,7 +133,8 @@ set_field_to_null(Field *field)
return
0
;
}
if
(
!
current_thd
->
no_errors
)
my_printf_error
(
ER_BAD_NULL_ERROR
,
ER
(
ER_BAD_NULL_ERROR
),
MYF
(
0
),
field
->
field_name
);
my_printf_error
(
ER_BAD_NULL_ERROR
,
ER
(
ER_BAD_NULL_ERROR
),
MYF
(
0
),
field
->
field_name
);
return
1
;
}
return
0
;
...
...
sql/mysql_priv.h
View file @
80b7f100
...
...
@@ -477,7 +477,7 @@ extern uint32 server_id;
extern
char
mysql_data_home
[
2
],
server_version
[
SERVER_VERSION_LENGTH
],
max_sort_char
,
mysql_real_data_home
[];
extern
my_string
mysql_unix_port
,
mysql_tmpdir
;
extern
const
char
*
first_keyword
,
*
localhost
;
extern
const
char
*
first_keyword
,
*
localhost
,
*
delayed_user
;
extern
ulong
refresh_version
,
flush_version
,
thread_id
,
query_id
,
opened_tables
,
created_tmp_tables
,
created_tmp_disk_tables
,
aborted_threads
,
aborted_connects
,
...
...
sql/mysqld.cc
View file @
80b7f100
...
...
@@ -243,6 +243,7 @@ volatile ulong cached_thread_count=0;
my_string
master_user
=
(
char
*
)
"test"
,
master_password
=
0
,
master_host
=
0
,
master_info_file
=
(
char
*
)
"master.info"
;
const
char
*
localhost
=
LOCAL_HOST
;
const
char
*
delayed_user
=
"DELAYED"
;
uint
master_port
=
MYSQL_PORT
,
master_connect_retry
=
60
;
ulong
max_tmp_tables
,
max_heap_table_size
;
...
...
@@ -2364,7 +2365,7 @@ pthread_handler_decl(handle_connections_namedpipes,arg)
continue
;
}
/* host name is unknown */
thd
->
host
=
my_strdup
(
"localhost"
,
MYF
(
0
));
/* Host is unknown */
thd
->
host
=
my_strdup
(
localhost
,
MYF
(
0
));
/* Host is unknown */
create_new_thread
(
thd
);
}
...
...
sql/sql_class.cc
View file @
80b7f100
...
...
@@ -176,7 +176,8 @@ THD::~THD()
if
(
host
!=
localhost
)
// If not pointer to constant
safeFree
(
host
);
safeFree
(
user
);
if
(
user
!=
delayed_user
)
safeFree
(
user
);
safeFree
(
db
);
safeFree
(
ip
);
free_root
(
&
mem_root
,
MYF
(
0
));
...
...
sql/sql_delete.cc
View file @
80b7f100
...
...
@@ -192,7 +192,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
(
void
)
table
->
file
->
extra
(
HA_EXTRA_NO_READCHECK
);
if
(
options
&
OPTION_QUICK
)
(
void
)
table
->
file
->
extra
(
HA_EXTRA_QUICK
);
init_read_record
(
&
info
,
thd
,
table
,
select
,
1
,
1
);
init_read_record
(
&
info
,
thd
,
table
,
select
,
0
,
1
);
ulong
deleted
=
0L
;
thd
->
proc_info
=
"updating"
;
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
...
...
sql/sql_insert.cc
View file @
80b7f100
...
...
@@ -247,9 +247,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
}
if
(
lock_type
==
TL_WRITE_DELAYED
)
{
id
=
0
;
// No auto_increment id
info
.
copied
=
values_list
.
elements
;
end_delayed_insert
(
thd
);
if
(
!
error
)
{
id
=
0
;
// No auto_increment id
info
.
copied
=
values_list
.
elements
;
end_delayed_insert
(
thd
);
}
}
else
{
...
...
@@ -486,7 +489,8 @@ class delayed_insert :public ilink {
table
(
0
),
tables_in_use
(
0
),
stacked_inserts
(
0
),
status
(
0
),
dead
(
0
),
group_count
(
0
)
{
thd
.
user
=
thd
.
host
=
(
char
*
)
""
;
thd
.
user
=
thd
.
priv_user
=
(
char
*
)
delayed_user
;
thd
.
host
=
(
char
*
)
localhost
;
thd
.
current_tablenr
=
0
;
thd
.
version
=
refresh_version
;
thd
.
command
=
COM_DELAYED_INSERT
;
...
...
@@ -676,7 +680,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
TABLE
*
delayed_insert
::
get_local_table
(
THD
*
client_thd
)
{
my_ptrdiff_t
adjust_ptrs
;
Field
**
field
,
**
org_field
;
Field
**
field
,
**
org_field
,
*
found_next_number_field
;
TABLE
*
copy
;
/* First request insert thread to get a lock */
...
...
@@ -719,11 +723,14 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
adjust_ptrs
=
PTR_BYTE_DIFF
(
copy
->
record
[
0
],
table
->
record
[
0
]);
found_next_number_field
=
table
->
found_next_number_field
;
for
(
org_field
=
table
->
field
;
*
org_field
;
org_field
++
,
field
++
)
{
if
(
!
(
*
field
=
(
*
org_field
)
->
new_field
(
copy
)))
return
0
;
(
*
field
)
->
move_field
(
adjust_ptrs
);
// Point at copy->record[0]
if
(
*
org_field
==
found_next_number_field
)
(
*
field
)
->
table
->
found_next_number_field
=
*
field
;
}
*
field
=
0
;
...
...
@@ -806,14 +813,17 @@ static int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic,
static
void
end_delayed_insert
(
THD
*
thd
)
{
DBUG_ENTER
(
"end_delayed_insert"
);
delayed_insert
*
di
=
thd
->
di
;
pthread_mutex_lock
(
&
di
->
mutex
);
DBUG_PRINT
(
"info"
,(
"tables in use: %d"
,
di
->
tables_in_use
));
if
(
!--
di
->
tables_in_use
||
di
->
thd
.
killed
)
{
// Unlock table
di
->
status
=
1
;
pthread_cond_signal
(
&
di
->
cond
);
}
pthread_mutex_unlock
(
&
di
->
mutex
);
DBUG_VOID_RETURN
;
}
...
...
@@ -951,6 +961,7 @@ static pthread_handler_decl(handle_delayed_insert,arg)
pthread_mutex_unlock
(
&
di
->
thd
.
mysys_var
->
mutex
);
di
->
thd
.
proc_info
=
0
;
DBUG_PRINT
(
"info"
,(
"Waiting for someone to insert rows"
));
for
(
;
;)
{
int
error
;
...
...
tests/fork3_test.pl
View file @
80b7f100
#!/usr/bin/perl -w
#
# This is a test with uses
3 processes to insert, delete
and select
# This is a test with uses
4 processes to insert, delete , check
and select
#
$opt_loop_count
=
1
00000
;
# Change this to make test harder/easier
$opt_loop_count
=
2
00000
;
# Change this to make test harder/easier
##################### Standard benchmark inits ##############################
...
...
@@ -21,8 +21,8 @@ GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in","skip-delete",
"
verbose
","
fast-insert
","
lock-tables
","
debug
","
fast
","
force
")
||
die
"
Aborted
";
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$opt_force
=
undef
;
# Ignore warnings from these
print
"
Testing
3
multiple connections to a server with 1 insert, 1 delete
\n
";
print
"
and 1 select connections
.
\n
";
print
"
Testing
4
multiple connections to a server with 1 insert, 1 delete
\n
";
print
"
1 select and one repair/check connection
.
\n
";
$firsttable
=
"
bench_f1
";
...
...
@@ -51,6 +51,7 @@ $|= 1; # Autoflush
test_insert
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
insert
";
test_delete
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
delete
";
test_select
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select1
";
repair_and_check
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
repair/check
";
$errors
=
0
;
while
((
$pid
=
wait
())
!=
-
1
)
...
...
@@ -148,3 +149,40 @@ sub test_select
print
"
Test_select: ok
\n
";
exit
(
0
);
}
sub
repair_and_check
{
my
(
$dbh
,
$row
,
$found1
,
$last_found1
,
$i
,
$type
,
$table
);
$found1
=
0
;
$last_found1
=
-
1
;
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
for
(
$i
=
0
;
$found1
!=
$last_found1
;
$i
++
)
{
$type
=
(
$i
&
2
)
?
"
repair
"
:
"
check
";
$table
=
$firsttable
;
$last_found1
=
$found1
;
$sth
=
$dbh
->
prepare
("
$type
table
$table
")
||
die
"
Got error on prepare:
$dbh
->errstr
\n
";
$sth
->
execute
||
die
$dbh
->
errstr
;
while
((
$row
=
$sth
->
fetchrow_arrayref
))
{
if
(
$row
->
[
3
]
ne
"
OK
")
{
print
"
Got error
"
.
$row
->
[
3
]
.
"
when doing
$type
on
$table
\n
";
exit
(
1
);
}
}
$sth
=
$dbh
->
prepare
("
select count(*) from
$table
")
||
die
"
Got error on prepare:
$dbh
->errstr
\n
";
$sth
->
execute
||
die
$dbh
->
errstr
;
@row
=
$sth
->
fetchrow_array
();
$found1
=
$row
[
0
];
$sth
->
finish
;
sleep
(
3
);
}
$dbh
->
disconnect
;
$dbh
=
0
;
print
"
check/repair: Did
$i
repair/checks
\n
";
exit
(
0
);
}
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