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
b40756c2
Commit
b40756c2
authored
Apr 28, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
bdb1441a
126e32af
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
272 additions
and
41 deletions
+272
-41
mysql-test/r/drop.result
mysql-test/r/drop.result
+2
-2
mysql-test/r/innodb-replace.result
mysql-test/r/innodb-replace.result
+1
-0
mysql-test/t/innodb-replace.test
mysql-test/t/innodb-replace.test
+4
-0
mysys/default.c
mysys/default.c
+35
-27
mysys/mf_keycache.c
mysys/mf_keycache.c
+7
-4
sql/mysqld.cc
sql/mysqld.cc
+1
-0
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+1
-1
sql/sql_insert.cc
sql/sql_insert.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+7
-5
tests/index_corrupt.pl
tests/index_corrupt.pl
+212
-0
No files found.
mysql-test/r/drop.result
View file @
b40756c2
...
...
@@ -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;
...
...
mysql-test/r/innodb-replace.result
View file @
b40756c2
drop table if exists t1;
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
select * from t1;
c1 c2 stamp
...
...
mysql-test/t/innodb-replace.test
View file @
b40756c2
...
...
@@ -2,6 +2,10 @@
# embedded server ignores 'delayed', so skip this
--
source
include
/
not_embedded
.
inc
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
#
# Bug #1078
#
...
...
mysys/default.c
View file @
b40756c2
...
...
@@ -402,33 +402,48 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
continue
;
/* Configuration File Directives */
if
((
*
ptr
==
'!'
)
&&
(
recursion_level
<
max_recursion_level
)
)
if
((
*
ptr
==
'!'
))
{
if
(
recursion_level
>=
max_recursion_level
)
{
for
(
end
=
ptr
+
strlen
(
ptr
)
-
1
;
my_isspace
(
&
my_charset_latin1
,
*
(
end
-
1
));
end
--
)
{}
end
[
0
]
=
0
;
fprintf
(
stderr
,
"Warning: skipping '%s' directive as maximum include"
"recursion level was reached in file %s at line %d
\n
"
,
ptr
,
name
,
line
);
continue
;
}
/* skip over `!' and following whitespace */
for
(
++
ptr
;
my_isspace
(
&
my_charset_latin1
,
ptr
[
0
]);
ptr
++
)
{}
if
((
!
strncmp
(
ptr
,
includedir_keyword
,
sizeof
(
includedir_keyword
)
-
1
))
&&
my_isspace
(
&
my_charset_latin1
,
ptr
[
sizeof
(
includedir_keyword
)
-
1
]))
if
((
!
strncmp
(
ptr
,
includedir_keyword
,
sizeof
(
includedir_keyword
)
-
1
))
&&
my_isspace
(
&
my_charset_latin1
,
ptr
[
sizeof
(
includedir_keyword
)
-
1
]))
{
/* skip over "includedir" and following whitespace */
for
(
ptr
+=
sizeof
(
includedir_keyword
)
-
1
;
my_isspace
(
&
my_charset_latin1
,
ptr
[
0
]);
ptr
++
)
{}
/*
trim trailing whitespace from directory name */
end
=
ptr
+
strlen
(
ptr
)
-
1
;
/* fgets() stores the newline character in the buffer */
if
((
end
[
0
]
==
'\n'
)
||
(
end
[
0
]
==
'\r'
)
||
my_isspace
(
&
my_charset_latin1
,
end
[
0
]))
{
for
(;
my_isspace
(
&
my_charset_latin1
,
*
(
end
-
1
));
end
--
)
{}
end
[
0
]
=
0
;
}
/*
trim trailing whitespace from directory name
The -1 below is for the newline added by fgets()
Note that my_isspace() is true for \r and \n
*/
for
(
end
=
ptr
+
strlen
(
ptr
)
-
1
;
my_isspace
(
&
my_charset_latin1
,
*
(
end
-
1
));
end
--
)
{}
end
[
0
]
=
0
;
/* print error msg if there is nothing after !includedir directive */
if
(
end
=
=
ptr
)
if
(
end
<
=
ptr
)
{
fprintf
(
stderr
,
"error: Wrong !includedir directive in config "
...
...
@@ -468,8 +483,8 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
my_dirend
(
search_dir
);
}
else
if
((
!
strncmp
(
ptr
,
include_keyword
,
sizeof
(
include_keyword
)
-
1
))
&&
my_isspace
(
&
my_charset_latin1
,
ptr
[
sizeof
(
include_keyword
)
-
1
]))
else
if
((
!
strncmp
(
ptr
,
include_keyword
,
sizeof
(
include_keyword
)
-
1
))
&&
my_isspace
(
&
my_charset_latin1
,
ptr
[
sizeof
(
include_keyword
)
-
1
]))
{
/* skip over `include' and following whitespace */
for
(
ptr
+=
sizeof
(
include_keyword
)
-
1
;
...
...
@@ -477,12 +492,13 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{}
/* trim trailing whitespace from filename */
end
=
ptr
+
strlen
(
ptr
)
-
1
;
for
(;
my_isspace
(
&
my_charset_latin1
,
*
(
end
-
1
))
;
end
--
)
for
(
end
=
ptr
+
strlen
(
ptr
)
-
1
;
my_isspace
(
&
my_charset_latin1
,
*
(
end
-
1
));
end
--
)
{}
end
[
0
]
=
0
;
if
(
end
=
=
ptr
)
if
(
end
<
=
ptr
)
{
fprintf
(
stderr
,
"error: Wrong !include directive in config "
...
...
@@ -497,14 +513,6 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
continue
;
}
else
if
(
recursion_level
>=
max_recursion_level
)
{
fprintf
(
stderr
,
"warning: skipping !include directive as maximum include"
"recursion level was reached in file %s at line %d
\n
"
,
name
,
line
);
}
if
(
*
ptr
==
'['
)
/* Group name */
{
...
...
mysys/mf_keycache.c
View file @
b40756c2
...
...
@@ -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
)
...
...
sql/mysqld.cc
View file @
b40756c2
...
...
@@ -1492,6 +1492,7 @@ void end_thread(THD *thd, bool put_in_cache)
thd
=
thread_cache
.
get
();
thd
->
real_id
=
pthread_self
();
(
void
)
thd
->
store_globals
();
thd
->
thr_create_time
=
time
(
NULL
);
threads
.
append
(
thd
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
DBUG_VOID_RETURN
;
...
...
sql/share/english/errmsg.txt
View file @
b40756c2
...
...
@@ -67,7 +67,7 @@ character-set=latin1
"Column '%-.64s' cannot be null",
"Unknown database '%-.64s'",
"Table '%-.64s' already exists",
"Unknown table '%-.1
8
0s'",
"Unknown table '%-.1
0
0s'",
"Column '%-.64s' in %-.64s is ambiguous",
"Server shutdown in progress",
"Unknown column '%-.64s' in '%-.64s'",
...
...
sql/sql_insert.cc
View file @
b40756c2
...
...
@@ -72,7 +72,7 @@ static int check_insert_fields(THD *thd, TABLE *table, List<Item> &fields,
{
my_printf_error
(
ER_WRONG_VALUE_COUNT_ON_ROW
,
ER
(
ER_WRONG_VALUE_COUNT_ON_ROW
),
MYF
(
0
),
1
);
MYF
(
0
),
1
L
);
return
-
1
;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
...
...
@@ -89,7 +89,7 @@ static int check_insert_fields(THD *thd, TABLE *table, List<Item> &fields,
{
my_printf_error
(
ER_WRONG_VALUE_COUNT_ON_ROW
,
ER
(
ER_WRONG_VALUE_COUNT_ON_ROW
),
MYF
(
0
),
1
);
MYF
(
0
),
1
L
);
return
-
1
;
}
TABLE_LIST
table_list
;
...
...
sql/sql_select.cc
View file @
b40756c2
...
...
@@ -2055,8 +2055,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
KEY_OPTIMIZE_EXISTS
)
|
((
old
->
optimize
|
new_fields
->
optimize
)
&
KEY_OPTIMIZE_REF_OR_NULL
));
old
->
null_rejecting
=
old
->
null_rejecting
&&
new_fields
->
null_rejecting
;
old
->
null_rejecting
=
(
old
->
null_rejecting
&&
new_fields
->
null_rejecting
)
;
}
}
else
if
(
old
->
eq_func
&&
new_fields
->
eq_func
&&
...
...
@@ -2068,8 +2068,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
KEY_OPTIMIZE_EXISTS
)
|
((
old
->
optimize
|
new_fields
->
optimize
)
&
KEY_OPTIMIZE_REF_OR_NULL
));
old
->
null_rejecting
=
old
->
null_rejecting
&&
new_fields
->
null_rejecting
;
old
->
null_rejecting
=
(
old
->
null_rejecting
&&
new_fields
->
null_rejecting
)
;
}
else
if
(
old
->
eq_func
&&
new_fields
->
eq_func
&&
(
old
->
val
->
is_null
()
||
new_fields
->
val
->
is_null
()))
...
...
@@ -2081,7 +2081,7 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
if
(
old
->
val
->
is_null
())
old
->
val
=
new_fields
->
val
;
/* The referred expression can be NULL: */
old
->
null_rejecting
=
false
;
old
->
null_rejecting
=
0
;
}
else
{
...
...
@@ -2242,6 +2242,8 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, Item_func *cond,
If the condition has form "tbl.keypart = othertbl.field" and
othertbl.field can be NULL, there will be no matches if othertbl.field
has NULL value.
We use null_rejecting in add_not_null_conds() to add
'othertbl.field IS NOT NULL' to tab->select_cond.
*/
(
*
key_fields
)
->
null_rejecting
=
(
cond
->
functype
()
==
Item_func
::
EQ_FUNC
)
&&
((
*
value
)
->
type
()
==
Item
::
FIELD_ITEM
)
&&
...
...
tests/index_corrupt.pl
0 → 100755
View file @
b40756c2
#!/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