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
9eb9eca7
Commit
9eb9eca7
authored
Jun 27, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1
parents
460f10ba
8f490b2c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
160 additions
and
35 deletions
+160
-35
include/my_global.h
include/my_global.h
+0
-2
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+8
-8
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+15
-0
mysql-test/r/heap_hash.result
mysql-test/r/heap_hash.result
+12
-11
mysql-test/r/range.result
mysql-test/r/range.result
+32
-1
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+7
-0
mysql-test/t/heap_hash.test
mysql-test/t/heap_hash.test
+2
-0
mysql-test/t/range.test
mysql-test/t/range.test
+19
-3
sql/ha_heap.cc
sql/ha_heap.cc
+26
-5
sql/ha_heap.h
sql/ha_heap.h
+3
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+1
-1
sql/opt_range.cc
sql/opt_range.cc
+35
-3
No files found.
include/my_global.h
View file @
9eb9eca7
...
...
@@ -274,10 +274,8 @@ C_MODE_START int __cxa_pure_virtual() {\
#include <alloca.h>
#endif
#ifdef HAVE_ATOMIC_ADD
#if defined(__ia64__)
#define new my_arg_new
#define need_to_restore_new 1
#endif
C_MODE_START
#include <asm/atomic.h>
C_MODE_END
...
...
mysql-test/mysql-test-run.pl
View file @
9eb9eca7
...
...
@@ -303,7 +303,7 @@ sub mysqld_arguments ($$$$$);
sub
stop_masters_slaves
();
sub
stop_masters
();
sub
stop_slaves
();
sub
run_mysqltest
($
$
);
sub
run_mysqltest
($);
sub
usage
($);
######################################################################
...
...
@@ -1345,10 +1345,11 @@ sub run_testcase ($) {
if
(
!
$glob_use_running_server
and
!
$glob_use_embedded_server
)
{
if
(
$tinfo
->
{'
master_restart
'}
or
$master
->
[
0
]
->
{'
uses_special_flags
'}
)
if
(
$tinfo
->
{'
master_restart
'}
or
$master
->
[
0
]
->
{'
running_master_is_special
'}
)
{
stop_masters
();
$master
->
[
0
]
->
{'
uses_special_flags
'}
=
0
;
# Forget abou
t why we stopped
$master
->
[
0
]
->
{'
running_master_is_special
'}
=
0
;
# Forge
t why we stopped
}
# ----------------------------------------------------------------------
...
...
@@ -1426,9 +1427,9 @@ sub run_testcase ($) {
}
}
if
(
@
{
$tinfo
->
{'
master_opt
'}
}
)
if
(
$tinfo
->
{'
master_restart
'
}
)
{
$master
->
[
0
]
->
{'
uses_special_flags
'}
=
1
;
$master
->
[
0
]
->
{'
running_master_is_special
'}
=
1
;
}
}
...
...
@@ -1475,7 +1476,7 @@ sub run_testcase ($) {
}
unlink
(
$path_timefile
);
my
$res
=
run_mysqltest
(
$tinfo
,
$tinfo
->
{'
master_opt
'}
);
my
$res
=
run_mysqltest
(
$tinfo
);
if
(
$res
==
0
)
{
...
...
@@ -1975,9 +1976,8 @@ sub stop_slaves () {
}
sub
run_mysqltest
($
$
)
{
sub
run_mysqltest
($)
{
my
$tinfo
=
shift
;
my
$master_opts
=
shift
;
my
$cmdline_mysqldump
=
"
$exe_mysqldump
--no-defaults -uroot
"
.
"
--socket=
$master
->[0]->{'path_mysock'} --password=
";
...
...
mysql-test/r/func_time.result
View file @
9eb9eca7
...
...
@@ -611,3 +611,18 @@ SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAY
count(*)
3
DROP TABLE t1;
select last_day('2005-00-00');
last_day('2005-00-00')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-00-00'
select last_day('2005-00-01');
last_day('2005-00-01')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-00-01'
select last_day('2005-01-00');
last_day('2005-01-00')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-01-00'
mysql-test/r/heap_hash.result
View file @
9eb9eca7
...
...
@@ -231,18 +231,19 @@ explain select * from t1 where a='aaad';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where
insert into t1 select * from t1;
flush tables;
explain select * from t1 where a='aaaa';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
explain select * from t1 where a='aaab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
explain select * from t1 where a='aaac';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
explain select * from t1 where a='aaad';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
flush tables;
explain select * from t1 where a='aaaa';
id select_type table type possible_keys key key_len ref rows Extra
...
...
@@ -261,16 +262,16 @@ delete from t1;
insert into t1 select * from t2;
explain select * from t1 where a='aaaa';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
explain select * from t1 where a='aaab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
explain select * from t1 where a='aaac';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
explain select * from t1 where a='aaad';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const
1
Using where
1 SIMPLE t1 ref a a 8 const
2
Using where
drop table t1, t2;
create table t1 (
id int unsigned not null primary key auto_increment,
...
...
@@ -345,15 +346,15 @@ insert into t3 select name, name from t1;
show index from t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t3 1 a 1 a NULL NULL NULL NULL HASH
t3 1 a 2 b NULL 1
5
NULL NULL HASH
t3 1 a 2 b NULL 1
3
NULL NULL HASH
show index from t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t3 1 a 1 a NULL NULL NULL NULL HASH
t3 1 a 2 b NULL 1
5
NULL NULL HASH
t3 1 a 2 b NULL 1
3
NULL NULL HASH
explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
1 SIMPLE t3 ref a a 40 func,const
6
Using where
1 SIMPLE t3 ref a a 40 func,const
7
Using where
drop table t1, t2, t3;
create temporary table t1 ( a int, index (a) ) engine=memory;
insert into t1 values (1),(2),(3),(4),(5);
...
...
mysql-test/r/range.result
View file @
9eb9eca7
...
...
@@ -556,11 +556,42 @@ count(*)
0
select count(*) from t1 where x > -16;
count(*)
1
2
select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
create table t1 (a bigint unsigned);
create index t1i on t1(a);
insert into t1 select 18446744073709551615;
insert into t1 select 18446744073709551614;
explain select * from t1 where a <> -1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index
select * from t1 where a <> -1;
a
18446744073709551614
18446744073709551615
explain select * from t1 where a > -1 or a < -1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index
select * from t1 where a > -1 or a < -1;
a
18446744073709551614
18446744073709551615
explain select * from t1 where a > -1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index
select * from t1 where a > -1;
a
18446744073709551614
18446744073709551615
explain select * from t1 where a < -1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
select * from t1 where a < -1;
a
drop table t1;
set names latin1;
create table t1 (a char(10), b text, key (a)) character set latin1;
INSERT INTO t1 (a) VALUES
...
...
mysql-test/t/func_time.test
View file @
9eb9eca7
...
...
@@ -307,3 +307,10 @@ INSERT INTO t1 VALUES (NOW());
SELECT
count
(
*
)
FROM
t1
WHERE
d
>
FROM_DAYS
(
TO_DAYS
(
@
TMP
))
AND
d
<=
FROM_DAYS
(
TO_DAYS
(
@
TMP
)
+
1
);
DROP
TABLE
t1
;
#
# Bug #10568
#
select
last_day
(
'2005-00-00'
);
select
last_day
(
'2005-00-01'
);
select
last_day
(
'2005-01-00'
);
mysql-test/t/heap_hash.test
View file @
9eb9eca7
...
...
@@ -169,6 +169,8 @@ explain select * from t1 where a='aaac';
explain
select
*
from
t1
where
a
=
'aaad'
;
insert
into
t1
select
*
from
t1
;
# avoid statistics differences between normal and ps-protocol tests
flush
tables
;
explain
select
*
from
t1
where
a
=
'aaaa'
;
explain
select
*
from
t1
where
a
=
'aaab'
;
explain
select
*
from
t1
where
a
=
'aaac'
;
...
...
mysql-test/t/range.test
View file @
9eb9eca7
...
...
@@ -423,14 +423,30 @@ select count(*) from t1 where x=0;
select
count
(
*
)
from
t1
where
x
<
0
;
select
count
(
*
)
from
t1
where
x
<
-
16
;
select
count
(
*
)
from
t1
where
x
=
-
16
;
# The following query returns wrong value because the range optimizer can't
# handle search on a signed value for an unsigned parameter. This will be fixed in
# 5.0
select
count
(
*
)
from
t1
where
x
>
-
16
;
select
count
(
*
)
from
t1
where
x
=
18446744073709551601
;
drop
table
t1
;
#
# Bug #11185 incorrect comparison of unsigned int to signed constant
#
create
table
t1
(
a
bigint
unsigned
);
create
index
t1i
on
t1
(
a
);
insert
into
t1
select
18446744073709551615
;
insert
into
t1
select
18446744073709551614
;
explain
select
*
from
t1
where
a
<>
-
1
;
select
*
from
t1
where
a
<>
-
1
;
explain
select
*
from
t1
where
a
>
-
1
or
a
<
-
1
;
select
*
from
t1
where
a
>
-
1
or
a
<
-
1
;
explain
select
*
from
t1
where
a
>
-
1
;
select
*
from
t1
where
a
>
-
1
;
explain
select
*
from
t1
where
a
<
-
1
;
select
*
from
t1
where
a
<
-
1
;
drop
table
t1
;
#
# Bug #6045: Binary Comparison regression in MySQL 4.1
# Binary searches didn't use a case insensitive index.
...
...
sql/ha_heap.cc
View file @
9eb9eca7
...
...
@@ -60,7 +60,15 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
/* Initialize variables for the opened table */
set_keys_for_scanning
();
update_key_stats
();
/*
We cannot run update_key_stats() here because we do not have a
lock on the table. The 'records' count might just be changed
temporarily at this moment and we might get wrong statistics (Bug
#10178). Instead we request for update. This will be done in
ha_heap::info(), which is always called before key statistics are
used.
*/
key_stats_ok
=
FALSE
;
}
return
(
file
?
0
:
1
);
}
...
...
@@ -112,6 +120,8 @@ void ha_heap::update_key_stats()
}
}
records_changed
=
0
;
/* At the end of update_key_stats() we can proudly claim they are OK. */
key_stats_ok
=
TRUE
;
}
int
ha_heap
::
write_row
(
byte
*
buf
)
...
...
@@ -125,7 +135,7 @@ int ha_heap::write_row(byte * buf)
res
=
heap_write
(
file
,
buf
);
if
(
!
res
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
update_key_stats
()
;
key_stats_ok
=
FALSE
;
return
res
;
}
...
...
@@ -138,7 +148,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
res
=
heap_update
(
file
,
old_data
,
new_data
);
if
(
!
res
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
update_key_stats
()
;
key_stats_ok
=
FALSE
;
return
res
;
}
...
...
@@ -149,7 +159,7 @@ int ha_heap::delete_row(const byte * buf)
res
=
heap_delete
(
file
,
buf
);
if
(
!
res
&&
table
->
tmp_table
==
NO_TMP_TABLE
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
update_key_stats
()
;
key_stats_ok
=
FALSE
;
return
res
;
}
...
...
@@ -262,6 +272,13 @@ void ha_heap::info(uint flag)
delete_length
=
info
.
deleted
*
info
.
reclength
;
if
(
flag
&
HA_STATUS_AUTO
)
auto_increment_value
=
info
.
auto_increment
;
/*
If info() is called for the first time after open(), we will still
have to update the key statistics. Hoping that a table lock is now
in place.
*/
if
(
!
key_stats_ok
)
update_key_stats
();
}
int
ha_heap
::
extra
(
enum
ha_extra_function
operation
)
...
...
@@ -273,7 +290,7 @@ int ha_heap::delete_all_rows()
{
heap_clear
(
file
);
if
(
table
->
tmp_table
==
NO_TMP_TABLE
)
update_key_stats
()
;
key_stats_ok
=
FALSE
;
return
0
;
}
...
...
@@ -433,7 +450,11 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key,
max_key
->
flag
!=
HA_READ_AFTER_KEY
)
return
HA_POS_ERROR
;
// Can only use exact keys
else
{
/* Assert that info() did run. We need current statistics here. */
DBUG_ASSERT
(
key_stats_ok
);
return
key
->
rec_per_key
[
key
->
key_parts
-
1
];
}
}
...
...
sql/ha_heap.h
View file @
9eb9eca7
...
...
@@ -29,8 +29,10 @@ class ha_heap: public handler
key_map
btree_keys
;
/* number of records changed since last statistics update */
uint
records_changed
;
bool
key_stats_ok
;
public:
ha_heap
(
TABLE
*
table
)
:
handler
(
table
),
file
(
0
),
records_changed
(
0
)
{}
ha_heap
(
TABLE
*
table
)
:
handler
(
table
),
file
(
0
),
records_changed
(
0
),
key_stats_ok
(
0
)
{}
~
ha_heap
()
{}
const
char
*
table_type
()
const
{
return
"HEAP"
;
}
const
char
*
index_type
(
uint
inx
)
...
...
sql/item_timefunc.cc
View file @
9eb9eca7
...
...
@@ -2817,7 +2817,7 @@ String *Item_func_str_to_date::val_str(String *str)
bool
Item_func_last_day
::
get_date
(
TIME
*
ltime
,
uint
fuzzy_date
)
{
if
(
get_arg0_date
(
ltime
,
fuzzy_date
))
if
(
get_arg0_date
(
ltime
,
fuzzy_date
&
~
TIME_FUZZY_DATE
))
return
1
;
uint
month_idx
=
ltime
->
month
-
1
;
ltime
->
day
=
days_in_month
[
month_idx
];
...
...
sql/opt_range.cc
View file @
9eb9eca7
...
...
@@ -960,7 +960,9 @@ get_mm_parts(PARAM *param, COND *cond_func, Field *field,
if
(
sel_arg
->
type
==
SEL_ARG
::
IMPOSSIBLE
)
{
tree
->
type
=
SEL_TREE
::
IMPOSSIBLE
;
DBUG_RETURN
(
tree
);
/* If this is an NE_FUNC, we still need to check GT_FUNC. */
if
(
!
ne_func
)
DBUG_RETURN
(
tree
);
}
}
else
...
...
@@ -979,8 +981,9 @@ get_mm_parts(PARAM *param, COND *cond_func, Field *field,
SEL_TREE
*
tree2
=
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
GT_FUNC
,
value
,
cmp_type
);
if
(
tree2
)
tree
=
tree_or
(
param
,
tree
,
tree2
);
if
(
!
tree2
)
DBUG_RETURN
(
0
)
tree
=
tree_or
(
param
,
tree
,
tree2
);
}
DBUG_RETURN
(
tree
);
}
...
...
@@ -1159,6 +1162,35 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
if
(
!
(
tree
=
new
SEL_ARG
(
field
,
str
,
str2
)))
DBUG_RETURN
(
0
);
// out of memory
/*
Check if we are comparing an UNSIGNED integer with a negative constant.
In this case we know that:
(a) (unsigned_int [< | <=] negative_constant) == FALSE
(b) (unsigned_int [> | >=] negative_constant) == TRUE
In case (a) the condition is false for all values, and in case (b) it
is true for all values, so we can avoid unnecessary retrieval and condition
testing, and we also get correct comparison of unsinged integers with
negative integers (which otherwise fails because at query execution time
negative integers are cast to unsigned if compared with unsigned).
*/
Item_result
field_result_type
=
field
->
result_type
();
Item_result
value_result_type
=
value
->
result_type
();
if
(
field_result_type
==
INT_RESULT
&&
value_result_type
==
INT_RESULT
&&
((
Field_num
*
)
field
)
->
unsigned_flag
&&
!
((
Item_int
*
)
value
)
->
unsigned_flag
)
{
longlong
item_val
=
value
->
val_int
();
if
(
item_val
<
0
)
{
if
(
type
==
Item_func
::
LT_FUNC
||
type
==
Item_func
::
LE_FUNC
)
{
tree
->
type
=
SEL_ARG
::
IMPOSSIBLE
;
DBUG_RETURN
(
tree
);
}
if
(
type
==
Item_func
::
GT_FUNC
||
type
==
Item_func
::
GE_FUNC
)
DBUG_RETURN
(
0
);
}
}
switch
(
type
)
{
case
Item_func
:
:
LT_FUNC
:
if
(
field_is_equal_to_item
(
field
,
value
))
...
...
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