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
e18a155f
Commit
e18a155f
authored
Apr 27, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed core dump bug when hot link list in key cache was empty. Bug #10167
parent
972f86f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
221 additions
and
6 deletions
+221
-6
mysql-test/r/drop.result
mysql-test/r/drop.result
+2
-2
mysys/mf_keycache.c
mysys/mf_keycache.c
+7
-4
tests/index_corrupt.pl
tests/index_corrupt.pl
+212
-0
No files found.
mysql-test/r/drop.result
View file @
e18a155f
...
...
@@ -30,13 +30,13 @@ table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28;
ERROR 42S02: Unknown table 'table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table
14,table15,table16,table17,table18,table19,table20,table21,table22,table23,table
'
ERROR 42S02: Unknown table 'table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table'
drop table table1, table2, table3, table4, table5, table6,
table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28, table29, table30;
ERROR 42S02: Unknown table 'table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table
14,table15,table16,table17,table18,table19,table20,table21,table22,table23,table
'
ERROR 42S02: Unknown table 'table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table'
use test;
drop database mysqltest;
flush tables with read lock;
...
...
mysys/mf_keycache.c
View file @
e18a155f
...
...
@@ -1025,8 +1025,8 @@ static void reg_requests(KEY_CACHE *keycache, BLOCK_LINK *block, int count)
for a too long time (this time is determined by parameter age_threshold).
*/
static
inline
void
unreg_request
(
KEY_CACHE
*
keycache
,
BLOCK_LINK
*
block
,
int
at_end
)
static
void
unreg_request
(
KEY_CACHE
*
keycache
,
BLOCK_LINK
*
block
,
int
at_end
)
{
if
(
!
--
block
->
requests
)
{
...
...
@@ -1045,10 +1045,13 @@ static inline void unreg_request(KEY_CACHE *keycache,
}
link_block
(
keycache
,
block
,
hot
,
(
my_bool
)
at_end
);
block
->
last_hit_time
=
keycache
->
keycache_time
;
if
(
++
keycache
->
keycache_time
-
keycache
->
used_ins
->
last_hit_time
>
keycache
->
keycache_time
++
;
block
=
keycache
->
used_ins
;
/* Check if we should link a hot block to the warm block */
if
(
block
&&
keycache
->
keycache_time
-
block
->
last_hit_time
>
keycache
->
age_threshold
)
{
block
=
keycache
->
used_ins
;
unlink_block
(
keycache
,
block
);
link_block
(
keycache
,
block
,
0
,
0
);
if
(
block
->
temperature
!=
BLOCK_WARM
)
...
...
tests/index_corrupt.pl
0 → 100755
View file @
e18a155f
#!/usr/bin/perl -w
#
# This is a test for a key cache bug (bug #10167)
# To expose the bug mysqld should be started with --key-buffer-size=64K
#
$opt_loop_count
=
100000
;
# Change this to make test harder/easier
##################### Standard benchmark inits ##############################
use
DBI
;
use
Getopt::
Long
;
use
Benchmark
;
package
main
;
$opt_skip_create
=
$opt_skip_in
=
$opt_verbose
=
$opt_fast_insert
=
$opt_lock_tables
=
$opt_debug
=
$opt_skip_delete
=
$opt_fast
=
$opt_force
=
0
;
$opt_host
=
$opt_user
=
$opt_password
=
"";
$opt_db
=
"
test
";
GetOptions
("
host=s
","
db=s
","
loop-count=i
","
skip-create
","
skip-in
",
"
skip-delete
","
verbose
","
fast-insert
","
lock-tables
","
debug
","
fast
",
"
force
","
user=s
","
password=s
")
||
die
"
Aborted
";
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$opt_force
=
undef
;
# Ignore warnings from these
$firsttable
=
"
bench_f1
";
$secondtable
=
"
bench_f2
";
$kill_file
=
"
/tmp/mysqltest_index_corrupt.$$
";
####
#### Start timeing and start test
####
$start_time
=
new
Benchmark
;
if
(
!
$opt_skip_create
)
{
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
$dbh
->
do
("
drop table if exists
$firsttable
,
$secondtable
");
print
"
Creating tables in
$opt_db
\n
";
$dbh
->
do
("
create table
$firsttable
(
c_pollid INTEGER NOT NULL,
c_time BIGINT NOT NULL,
c_data DOUBLE NOT NULL,
c_error INTEGER NOT NULL,
c_warning INTEGER NOT NULL,
c_okay INTEGER NOT NULL,
c_unknown INTEGER NOT NULL,
c_rolled_up BIT NOT NULL,
INDEX t_mgmt_hist_r_i1 (c_pollid),
INDEX t_mgmt_hist_r_i2 (c_time),
INDEX t_mgmt_hist_r_i3 (c_rolled_up))
")
or
die
$
DBI::
errstr
;
$dbh
->
do
("
create table
$secondtable
(
c_pollid INTEGER NOT NULL,
c_min_time BIGINT NOT NULL,
c_max_time BIGINT NOT NULL,
c_min_data DOUBLE NOT NULL,
c_max_data DOUBLE NOT NULL,
c_avg_data DOUBLE NOT NULL,
c_error INTEGER NOT NULL,
c_warning INTEGER NOT NULL,
c_okay INTEGER NOT NULL,
c_unknown INTEGER NOT NULL,
c_rolled_up BIT NOT NULL,
INDEX t_mgmt_hist_d_i1 (c_pollid),
INDEX t_mgmt_hist_d_i2 (c_min_time),
INDEX t_mgmt_hist_d_i3 (c_max_time),
INDEX t_mgmt_hist_d_i4 (c_rolled_up))
")
or
die
$
DBI::
errstr
;
$dbh
->
disconnect
;
$dbh
=
0
;
# Close handler
}
$|
=
1
;
# Autoflush
####
#### Start the tests
####
print
"
Running tests
\n
";
insert_in_bench
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
insert
";
select_from_bench
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
insert-select;
delete_from_bench() if ((
$pid
=fork()) == 0);
$work
{
$pid
}=
"
delete
"
;
$errors
=0;
while ((
$pid
=wait()) != -1)
{
$ret
=$?/256;
print
"
thread
'
" . $work{$pid} . "
'
finished
with
exit
code
$ret
\
n
"
;
$errors
++ if (
$ret
!= 0);
}
if (!
$opt_skip_delete
&& !
$errors
)
{
$dbh
= DBI->connect(
"
DBI:mysql:$opt_db:$opt_host
"
,
$opt_user
,
$opt_password
,
{ PrintError => 0}) || die
$DBI
::errstr;
$dbh
->do(
"
drop
table
$firsttable
,
$secondtable
"
);
}
print (
$errors
?
"
Test
failed
\
n
"
:
"
Test
ok
\
n
"
);
$end_time
=new Benchmark;
print
"
Total
time
:
"
.
timestr(timediff(
$end_time
,
$start_time
),
"
noc
"
) .
"
\
n
"
;
unlink
$kill_file
;
exit(0);
#
# Insert records in the two tables
#
sub insert_in_bench
{
my (
$dbh
,
$rows
,
$found
,
$i
);
$dbh
= DBI->connect(
"
DBI:mysql:$opt_db:$opt_host
"
,
$opt_user
,
$opt_password
,
{ PrintError => 0}) || die
$DBI
::errstr;
for (
$rows
= 1;
$rows
<=
$opt_loop_count
;
$rows
++)
{
$c_pollid
= sprintf(
"
%
d
"
,rand 1000);
$c_time
= sprintf(
"
%
d
"
,rand 100000);
$c_data
= rand 1000000;
$test
= rand 1;
$c_error
=0;
$c_warning
=0;
$c_okay
=0;
$c_unknown
=0;
if (
$test
< .8) {
$c_okay
=1;
} elsif (
$test
<.9) {
$c_error
=1;
} elsif (
$test
<.95) {
$c_warning
=1;
} else {
$c_unknown
=1;
}
$statement
=
"
INSERT
INTO
$firsttable
(
c_pollid
,
c_time
,
c_data
,
c_error
,
c_warning
,
c_okay
,
c_unknown
,
c_rolled_up
)
"
.
"
VALUES
(
$c_pollid
,
$c_time
,
$c_data
,
$c_error
,
$c_warning
,
$c_okay
,
$c_unknown
,
0
)"
;
$cursor
=
$dbh
->prepare(
$statement
);
$cursor
->execute();
$cursor
->finish();
}
$dbh
->disconnect;
$dbh
=0;
print
"
insert_in_bench:
Inserted
$rows
rows
\
n
"
;
# Kill other threads
open(KILLFILE,
"
>
$kill_file
"
);
close(KILLFILE);
exit(0);
}
sub select_from_bench
{
my (
$dbh
,
$rows
,
$cursor
);
$dbh
= DBI->connect(
"
DBI:mysql:$opt_db:$opt_host
"
,
$opt_user
,
$opt_password
,
{ PrintError => 0}) || die
$DBI
::errstr;
for (
$rows
= 1;
$rows
<
$opt_loop_count
;
$rows
++)
{
$t_value
= rand 100000;
$t_value2
=
$t_value
+10000;
$statement
=
"
INSERT
INTO
$secondtable
(
c_pollid
,
c_min_time
,
c_max_time
,
c_min_data
,
c_max_data
,
c_avg_data
,
c_error
,
c_warning
,
c_okay
,
c_unknown
,
c_rolled_up
)
SELECT
c_pollid
,
MIN
(
c_time
),
MAX
(
c_time
),
MIN
(
c_data
),
MAX
(
c_data
),
AVG
(
c_data
),
SUM
(
c_error
),
SUM
(
c_warning
),
SUM
(
c_okay
),
SUM
(
c_unknown
),
0
FROM
$firsttable
WHERE
(
c_time
>=
$t_value
)
AND
(
c_time
<
$t_value2
)
AND
(
c_rolled_up
=
0
)
GROUP
BY
c_pollid
"
;
$cursor
=
$dbh
->prepare(
$statement
);
$cursor
->execute();
$cursor
->finish();
sleep 1;
if (-e
$kill_file
)
{
last;
}
}
print
"
select_from_bench:
insert
-
select
executed
$rows
times
\
n
"
;
exit(0);
}
sub delete_from_bench
{
my (
$dbh
,
$row
,
$t_value
,
$t2_value
,
$statement
,
$cursor
);
$dbh
= DBI->connect(
"
DBI:mysql:$opt_db:$opt_host
"
,
$opt_user
,
$opt_password
,
{ PrintError => 0}) || die
$DBI
::errstr;
for (
$rows
= 1;
$rows
<
$opt_loop_count
;
$rows
++)
{
$t_value
= rand 50000;
$t2_value
=
$t_value
+ 50001;
$statement
=
"
DELETE
FROM
$firsttable
WHERE
(
c_time
>
$t_value
)
AND
(
c_time
<
$t2_value
)"
;
$cursor
=
$dbh
->prepare(
$statement
);
$cursor
->execute();
$cursor
->finish();
sleep 10;
if (-e
$kill_file
)
{
last;
}
}
print
"
delete
:
delete
executed
$rows
times
\
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