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
8b0c4b77
Commit
8b0c4b77
authored
Apr 03, 2009
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test written by windows to get it working under linux (line endings)
parent
6120cc96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
142 deletions
+142
-142
tests/fork_big2.pl
tests/fork_big2.pl
+142
-142
No files found.
tests/fork_big2.pl
View file @
8b0c4b77
...
@@ -16,21 +16,21 @@ package main;
...
@@ -16,21 +16,21 @@ package main;
$opt_skip_create
=
$opt_skip_in
=
$opt_verbose
=
$opt_fast_insert
=
$opt_skip_create
=
$opt_skip_in
=
$opt_verbose
=
$opt_fast_insert
=
$opt_lock_tables
=
$opt_debug
=
$opt_skip_drop
=
$opt_fast
=
$opt_force
=
0
;
$opt_lock_tables
=
$opt_debug
=
$opt_skip_drop
=
$opt_fast
=
$opt_force
=
0
;
$opt_thread_factor
=
1
;
$opt_thread_factor
=
1
;
$opt_insert
=
1
;
$opt_insert
=
1
;
$opt_select
=
6
;
$opt_join
=
4
;
$opt_select
=
6
;
$opt_join
=
4
;
$opt_select_count
=
$opt_join_count
=
0
;
$opt_select_count
=
$opt_join_count
=
0
;
$opt_update
=
1
;
$opt_delete
=
0
;
$opt_update
=
1
;
$opt_delete
=
0
;
$opt_flush
=
$opt_check
=
$opt_repair
=
$opt_alter
=
0
;
$opt_flush
=
$opt_check
=
$opt_repair
=
$opt_alter
=
0
;
$opt_join_range
=
100
;
$opt_join_range
=
100
;
$opt_resize_interval
=
0
;
$opt_resize_interval
=
0
;
$opt_time
=
0
;
$opt_time
=
0
;
$opt_host
=
$opt_user
=
$opt_password
=
"";
$opt_db
=
"
test
";
$opt_host
=
$opt_user
=
$opt_password
=
"";
$opt_db
=
"
test
";
$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
GetOptions
("
host=s
","
db=s
","
user=s
","
password=s
","
loop-count=i
","
skip-create
","
skip-in
","
skip-drop
",
GetOptions
("
host=s
","
db=s
","
user=s
","
password=s
","
loop-count=i
","
skip-create
","
skip-in
","
skip-drop
",
"
verbose
","
fast-insert
","
lock-tables
","
debug
","
fast
","
force
","
thread-factor=i
",
"
verbose
","
fast-insert
","
lock-tables
","
debug
","
fast
","
force
","
thread-factor=i
",
"
insert=i
",
"
select=i
",
"
join=i
",
"
select-count=i
",
"
join-count=i
",
"
update=i
",
"
delete=i
",
"
insert=i
",
"
select=i
",
"
join=i
",
"
select-count=i
",
"
join-count=i
",
"
update=i
",
"
delete=i
",
"
flush=i
",
"
check=i
",
"
repair=i
",
"
alter=i
",
"
resize-interval=i
",
"
max-join_range=i
",
"
time=i
")
||
die
"
Aborted
";
"
flush=i
",
"
check=i
",
"
repair=i
",
"
alter=i
",
"
resize-interval=i
",
"
max-join_range=i
",
"
time=i
")
||
die
"
Aborted
";
print
"
Test of multiple connections that test the following things:
\n
";
print
"
Test of multiple connections that test the following things:
\n
";
...
@@ -48,20 +48,20 @@ srand 100; # Make random numbers repeatable
...
@@ -48,20 +48,20 @@ srand 100; # Make random numbers repeatable
####
####
#### Start timeing and start test
#### Start timeing and start test
####
####
$opt_insert
*=
$opt_thread_factor
;
$opt_insert
*=
$opt_thread_factor
;
$opt_select
*=
$opt_thread_factor
;
$opt_select
*=
$opt_thread_factor
;
$opt_join
*=
$opt_thread_factor
;
$opt_join
*=
$opt_thread_factor
;
$opt_select_count
*=
$opt_thread_factor
;
$opt_select_count
*=
$opt_thread_factor
;
$opt_join_count
*=
$opt_thread_factor
;
$opt_join_count
*=
$opt_thread_factor
;
$opt_update
*=
$opt_thread_factor
;
$opt_update
*=
$opt_thread_factor
;
$opt_delete
*=
$opt_thread_factor
;
$opt_delete
*=
$opt_thread_factor
;
if
(
$opt_time
==
0
&&
$opt_insert
==
0
)
if
(
$opt_time
==
0
&&
$opt_insert
==
0
)
{
{
$opt_insert
=
1
;
$opt_insert
=
1
;
}
}
$start_time
=
new
Benchmark
;
$start_time
=
new
Benchmark
;
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
...
@@ -100,71 +100,71 @@ $|= 1; # Autoflush
...
@@ -100,71 +100,71 @@ $|= 1; # Autoflush
####
####
#### Start the tests
#### Start the tests
####
####
if
(
$opt_time
!=
0
)
if
(
$opt_time
!=
0
)
{
{
test_abort
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
abort
";
test_abort
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
abort
";
}
}
for
(
$i
=
0
;
$i
<
$opt_insert
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_insert
;
$i
++
)
{
{
test_insert
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
insert
";
test_insert
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
insert
";
}
}
$threads
=
$i
;
$threads
=
$i
;
for
(
$i
=
0
;
$i
<
$opt_select
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_select
;
$i
++
)
{
{
test_select
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select
";
test_select
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_join
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_join
;
$i
++
)
{
{
test_join
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
join
";
test_join
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
join
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_select_count
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_select_count
;
$i
++
)
{
{
test_select_count
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select_count
";
test_select_count
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
select_count
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_join_count
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_join_count
;
$i
++
)
{
{
test_join_count
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
join_count
";
test_join_count
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
join_count
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_update
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_update
;
$i
++
)
{
{
test_update
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
update
";
test_update
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
update
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_delete
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_delete
;
$i
++
)
{
{
test_delete
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
delete
";
test_delete
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
delete
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_flush
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_flush
;
$i
++
)
{
{
test_flush
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
flush
";
test_flush
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
flush
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_check
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_check
;
$i
++
)
{
{
test_check
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
check
";
test_check
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
check
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_repair
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_repair
;
$i
++
)
{
{
test_repair
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
repair
";
test_repair
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
repair
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
for
(
$i
=
0
;
$i
<
$opt_alter
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_alter
;
$i
++
)
{
{
test_alter
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
alter
";
test_alter
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
alter
";
}
}
$threads
+=
$i
;
$threads
+=
$i
;
if
(
$opt_resize_interval
!=
0
)
if
(
$opt_resize_interval
!=
0
)
{
{
test_resize
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
resize
";
test_resize
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
resize
";
$threads
+=
1
;
$threads
+=
1
;
}
}
print
"
Started
$threads
threads
\n
";
print
"
Started
$threads
threads
\n
";
$errors
=
0
;
$errors
=
0
;
...
@@ -172,17 +172,17 @@ $running_insert_threads=$opt_insert;
...
@@ -172,17 +172,17 @@ $running_insert_threads=$opt_insert;
while
((
$pid
=
wait
())
!=
-
1
)
while
((
$pid
=
wait
())
!=
-
1
)
{
{
$ret
=
$?
/
256
;
$ret
=
$?
/
256
;
print
"
thread '
"
.
$work
{
$pid
}
.
"
' finished with exit code
$ret
\n
";
print
"
thread '
"
.
$work
{
$pid
}
.
"
' finished with exit code
$ret
\n
";
if
(
$opt_time
==
0
)
if
(
$opt_time
==
0
)
{
{
if
(
$work
{
$pid
}
=~
/^insert/
)
if
(
$work
{
$pid
}
=~
/^insert/
)
{
{
if
(
!--
$running_insert_threads
)
if
(
!--
$running_insert_threads
)
{
{
# Time to stop other threads
# Time to stop other threads
signal_abort
();
signal_abort
();
}
}
}
}
}
}
$errors
++
if
(
$ret
!=
0
);
$errors
++
if
(
$ret
!=
0
);
...
@@ -214,17 +214,17 @@ print "Total time: " .
...
@@ -214,17 +214,17 @@ print "Total time: " .
exit
(
0
);
exit
(
0
);
#
#
# Sleep and then abort other threads
# Sleep and then abort other threads
#
#
sub
test_abort
sub
test_abort
{
{
sleep
(
$opt_time
);
sleep
(
$opt_time
);
signal_abort
();
signal_abort
();
exit
(
0
);
exit
(
0
);
}
}
#
#
# Insert records in the table
# Insert records in the table
...
@@ -363,58 +363,58 @@ sub test_join
...
@@ -363,58 +363,58 @@ sub test_join
$dbh
->
disconnect
;
$dbh
=
0
;
$dbh
->
disconnect
;
$dbh
=
0
;
print
"
Test_join: Executed
$count
joins
\n
";
print
"
Test_join: Executed
$count
joins
\n
";
exit
(
0
);
exit
(
0
);
}
}
#
#
# select records
# select records
# Do continously joins between the first and second for range and count selected rows
# Do continously joins between the first and second for range and count selected rows
#
#
sub
test_join_count
sub
test_join_count
{
{
my
(
$dbh
,
$i
,
$j
,
$count
,
$loop
);
my
(
$dbh
,
$i
,
$j
,
$count
,
$loop
);
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
$count_query
=
make_count_query
(
$numtables
);
$count_query
=
make_count_query
(
$numtables
);
$count
=
0
;
$count
=
0
;
$loop
=
9999
;
$loop
=
9999
;
$sum
=
0
;
$sum
=
0
;
srand
();
srand
();
$i
=
0
;
$i
=
0
;
while
((
$i
++
%
10
)
||
!
test_if_abort
(
$dbh
))
while
((
$i
++
%
10
)
||
!
test_if_abort
(
$dbh
))
{
{
if
(
$loop
++
>=
10
)
if
(
$loop
++
>=
10
)
{
{
$loop
=
0
;
$loop
=
0
;
$row_counts
=
simple_query
(
$dbh
,
$count_query
);
$row_counts
=
simple_query
(
$dbh
,
$count_query
);
}
}
for
(
$j
=
0
;
$j
<
$numtables
-
1
;
$j
++
)
for
(
$j
=
0
;
$j
<
$numtables
-
1
;
$j
++
)
{
{
my
(
$id1
)
=
int
rand
$row_counts
->
[
$j
];
my
(
$id1
)
=
int
rand
$row_counts
->
[
$j
];
my
(
$id2
)
=
int
rand
$row_counts
->
[
$j
];
my
(
$id2
)
=
int
rand
$row_counts
->
[
$j
];
if
(
$id1
>
$id2
)
if
(
$id1
>
$id2
)
{
{
my
$id0
=
$id1
;
$id1
=
$id2
;
$id2
=
$id0
;
my
$id0
=
$id1
;
$id1
=
$id2
;
$id2
=
$id0
;
if
(
$id2
-
$id1
>
$opt_join_range
)
if
(
$id2
-
$id1
>
$opt_join_range
)
{
{
$id2
=
$id1
+
$opt_join_range
;
$id2
=
$id1
+
$opt_join_range
;
}
}
}
}
my
(
$t1
,
$t2
)
=
(
$testtables
[
$j
]
->
[
0
],
$testtables
[
$j
+
1
]
->
[
0
]);
my
(
$t1
,
$t2
)
=
(
$testtables
[
$j
]
->
[
0
],
$testtables
[
$j
+
1
]
->
[
0
]);
$row
=
simple_query
(
$dbh
,
"
select count(*) from
$t1
,
$t2
where
$t1
.id=
$t2
.id and
$t1
.id between
$id1
and
$id2
");
$row
=
simple_query
(
$dbh
,
"
select count(*) from
$t1
,
$t2
where
$t1
.id=
$t2
.id and
$t1
.id between
$id1
and
$id2
");
$sum
+=
$row
->
[
0
];
$sum
+=
$row
->
[
0
];
$count
++
;
$count
++
;
}
}
}
}
$dbh
->
disconnect
;
$dbh
=
0
;
$dbh
->
disconnect
;
$dbh
=
0
;
print
"
Test_join_count: Executed
$count
joins: total
$sum
rows
\n
";
print
"
Test_join_count: Executed
$count
joins: total
$sum
rows
\n
";
exit
(
0
);
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