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
c433fb5e
Commit
c433fb5e
authored
Feb 09, 2010
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Plain Diff
Merge fixes for bug49902 and 50351 to mysql-5.1-bugteam.
parents
2b012a3e
5d0012ec
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
114 additions
and
88 deletions
+114
-88
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+20
-0
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+13
-0
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+21
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+10
-0
sql/opt_range.cc
sql/opt_range.cc
+4
-11
sql/opt_sum.cc
sql/opt_sum.cc
+3
-14
sql/sql_select.cc
sql/sql_select.cc
+15
-51
sql/sql_update.cc
sql/sql_update.cc
+1
-8
sql/table.cc
sql/table.cc
+2
-3
sql/table.h
sql/table.h
+14
-0
storage/myisam/ft_boolean_search.c
storage/myisam/ft_boolean_search.c
+11
-1
No files found.
mysql-test/r/fulltext.result
View file @
c433fb5e
...
...
@@ -603,6 +603,26 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
count(*)
0
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a));
INSERT INTO t1 VALUES
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
('awrd');
SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
COUNT(*)
0
DROP TABLE t1;
#
# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with
# fulltext search and row op
...
...
mysql-test/r/group_min_max.result
View file @
c433fb5e
...
...
@@ -2524,4 +2524,17 @@ SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
a MAX(b)
2 1
DROP TABLE t;
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b));
INSERT INTO t1 VALUES(1,1),(2,1);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
c b
1 1
SELECT a FROM t1 WHERE b=1;
a
1
2
DROP TABLE t1;
End of 5.1 tests
mysql-test/t/fulltext.test
View file @
c433fb5e
...
...
@@ -544,6 +544,27 @@ SELECT count(*) FROM t1 WHERE
DROP
TABLE
t1
,
t2
,
t3
;
#
# BUG#50351 - ft_min_word_len=2 Causes query to hang
#
CREATE
TABLE
t1
(
a
VARCHAR
(
4
),
FULLTEXT
(
a
));
INSERT
INTO
t1
VALUES
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),
(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'cwrd'
),(
'awrd'
),(
'cwrd'
),
(
'awrd'
);
SELECT
COUNT
(
*
)
FROM
t1
WHERE
MATCH
(
a
)
AGAINST
(
"+awrd bwrd* +cwrd*"
IN
BOOLEAN
MODE
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with
...
...
mysql-test/t/group_min_max.test
View file @
c433fb5e
...
...
@@ -1044,4 +1044,14 @@ SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
DROP
TABLE
t
;
#
# BUG#49902 - SELECT returns incorrect results
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NOT
NULL
,
KEY
(
b
));
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
1
);
ANALYZE
TABLE
t1
;
SELECT
1
AS
c
,
b
FROM
t1
WHERE
b
IN
(
1
,
2
)
GROUP
BY
c
,
b
;
SELECT
a
FROM
t1
WHERE
b
=
1
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
sql/opt_range.cc
View file @
c433fb5e
...
...
@@ -1171,11 +1171,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
if
(
file
)
{
range_end
();
if
(
head
->
key_read
)
{
head
->
key_read
=
0
;
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
head
->
set_keyread
(
FALSE
);
if
(
free_file
)
{
DBUG_PRINT
(
"info"
,
(
"Freeing separate handler 0x%lx (free: %d)"
,
(
long
)
file
,
...
...
@@ -1377,10 +1373,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
head
->
file
=
file
;
/* We don't have to set 'head->keyread' here as the 'file' is unique */
if
(
!
head
->
no_keyread
)
{
head
->
key_read
=
1
;
head
->
mark_columns_used_by_index
(
index
);
}
head
->
prepare_for_position
();
head
->
file
=
org_file
;
bitmap_copy
(
&
column_bitmap
,
head
->
read_set
);
...
...
@@ -8165,7 +8158,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
DBUG_ENTER
(
"QUICK_INDEX_MERGE_SELECT::read_keys_and_merge"
);
/* We're going to just read rowids. */
file
->
extra
(
HA_EXTRA_KEYREAD
);
head
->
set_keyread
(
TRUE
);
head
->
prepare_for_position
();
cur_quick_it
.
rewind
();
...
...
@@ -8241,7 +8234,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
delete
unique
;
doing_pk_scan
=
FALSE
;
/* index_merge currently doesn't support "using index" at all */
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
head
->
set_keyread
(
FALSE
);
init_read_record
(
&
read_record
,
thd
,
head
,
(
SQL_SELECT
*
)
0
,
1
,
1
,
TRUE
);
DBUG_RETURN
(
result
);
}
...
...
@@ -10628,7 +10621,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void)
int
result
;
DBUG_ENTER
(
"QUICK_GROUP_MIN_MAX_SELECT::reset"
);
file
->
extra
(
HA_EXTRA_KEYREAD
);
/* We need only the key attributes */
head
->
set_keyread
(
TRUE
);
/* We need only the key attributes */
if
((
result
=
file
->
ha_index_init
(
index
,
1
)))
DBUG_RETURN
(
result
);
if
(
quick_prefix_select
&&
quick_prefix_select
->
reset
())
...
...
sql/opt_sum.cc
View file @
c433fb5e
...
...
@@ -326,11 +326,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if
(
!
error
&&
reckey_in_range
(
0
,
&
ref
,
item_field
->
field
,
conds
,
range_fl
,
prefix_len
))
error
=
HA_ERR_KEY_NOT_FOUND
;
if
(
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
table
->
set_keyread
(
FALSE
);
table
->
file
->
ha_index_end
();
if
(
error
)
{
...
...
@@ -413,11 +409,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if
(
!
error
&&
reckey_in_range
(
1
,
&
ref
,
item_field
->
field
,
conds
,
range_fl
,
prefix_len
))
error
=
HA_ERR_KEY_NOT_FOUND
;
if
(
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
table
->
set_keyread
(
FALSE
);
table
->
file
->
ha_index_end
();
if
(
error
)
{
...
...
@@ -876,10 +868,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
converted (for example to upper case)
*/
if
(
field
->
part_of_key
.
is_set
(
idx
))
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
table
->
set_keyread
(
TRUE
);
return
1
;
}
}
...
...
sql/sql_select.cc
View file @
c433fb5e
...
...
@@ -6639,10 +6639,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
case
JT_CONST
:
// Only happens with left join
if
(
table
->
covering_keys
.
is_set
(
tab
->
ref
.
key
)
&&
!
table
->
no_keyread
)
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
table
->
set_keyread
(
TRUE
);
break
;
case
JT_ALL
:
/*
...
...
@@ -6703,10 +6700,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
if
(
tab
->
select
&&
tab
->
select
->
quick
&&
tab
->
select
->
quick
->
index
!=
MAX_KEY
&&
//not index_merge
table
->
covering_keys
.
is_set
(
tab
->
select
->
quick
->
index
))
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
table
->
set_keyread
(
TRUE
);
else
if
(
!
table
->
covering_keys
.
is_clear_all
()
&&
!
(
tab
->
select
&&
tab
->
select
->
quick
))
{
// Only read index tree
...
...
@@ -6790,11 +6784,7 @@ void JOIN_TAB::cleanup()
limit
=
0
;
if
(
table
)
{
if
(
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
table
->
set_keyread
(
FALSE
);
table
->
file
->
ha_index_or_rnd_end
();
/*
We need to reset this for next select
...
...
@@ -11664,16 +11654,11 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
!
table
->
no_keyread
&&
(
int
)
table
->
reginfo
.
lock_type
<=
(
int
)
TL_READ_HIGH_PRIORITY
)
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
table
->
set_keyread
(
TRUE
);
tab
->
index
=
tab
->
ref
.
key
;
}
error
=
join_read_const
(
tab
);
if
(
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
table
->
set_keyread
(
FALSE
);
if
(
error
)
{
tab
->
info
=
"unique row not found"
;
...
...
@@ -12028,12 +12013,8 @@ join_read_first(JOIN_TAB *tab)
{
int
error
;
TABLE
*
table
=
tab
->
table
;
if
(
!
table
->
key_read
&&
table
->
covering_keys
.
is_set
(
tab
->
index
)
&&
!
table
->
no_keyread
)
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
if
(
table
->
covering_keys
.
is_set
(
tab
->
index
)
&&
!
table
->
no_keyread
)
table
->
set_keyread
(
TRUE
);
tab
->
table
->
status
=
0
;
tab
->
read_record
.
read_record
=
join_read_next
;
tab
->
read_record
.
table
=
table
;
...
...
@@ -12067,12 +12048,8 @@ join_read_last(JOIN_TAB *tab)
{
TABLE
*
table
=
tab
->
table
;
int
error
;
if
(
!
table
->
key_read
&&
table
->
covering_keys
.
is_set
(
tab
->
index
)
&&
!
table
->
no_keyread
)
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
if
(
table
->
covering_keys
.
is_set
(
tab
->
index
)
&&
!
table
->
no_keyread
)
table
->
set_keyread
(
TRUE
);
tab
->
table
->
status
=
0
;
tab
->
read_record
.
read_record
=
join_read_prev
;
tab
->
read_record
.
table
=
table
;
...
...
@@ -13490,11 +13467,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
If ref_key used index tree reading only ('Using index' in EXPLAIN),
and best_key doesn't, then revert the decision.
*/
if
(
!
table
->
covering_keys
.
is_set
(
best_key
)
&&
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
if
(
!
table
->
covering_keys
.
is_set
(
best_key
))
table
->
set_keyread
(
FALSE
);
if
(
!
quick_created
)
{
tab
->
index
=
best_key
;
...
...
@@ -13507,10 +13481,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
select
->
quick
=
0
;
}
if
(
table
->
covering_keys
.
is_set
(
best_key
))
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
table
->
set_keyread
(
TRUE
);
table
->
file
->
ha_index_or_rnd_end
();
if
(
join
->
select_options
&
SELECT_DESCRIBE
)
{
...
...
@@ -13684,11 +13655,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
We can only use 'Only index' if quick key is same as ref_key
and in index_merge 'Only index' cannot be used
*/
if
(
table
->
key_read
&&
((
uint
)
tab
->
ref
.
key
!=
select
->
quick
->
index
))
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
if
(((
uint
)
tab
->
ref
.
key
!=
select
->
quick
->
index
))
table
->
set_keyread
(
FALSE
);
}
else
{
...
...
@@ -13744,11 +13712,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
tab
->
type
=
JT_ALL
;
// Read with normal read_record
tab
->
read_first_record
=
join_init_read_record
;
tab
->
join
->
examined_rows
+=
examined_rows
;
if
(
table
->
key_read
)
// Restore if we used indexes
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
table
->
set_keyread
(
FALSE
);
// Restore if we used indexes
DBUG_RETURN
(
table
->
sort
.
found_records
==
HA_POS_ERROR
);
err:
DBUG_RETURN
(
-
1
);
...
...
sql/sql_update.cc
View file @
c433fb5e
...
...
@@ -397,10 +397,7 @@ int mysql_update(THD *thd,
matching rows before updating the table!
*/
if
(
used_index
<
MAX_KEY
&&
old_covering_keys
.
is_set
(
used_index
))
{
table
->
key_read
=
1
;
table
->
mark_columns_used_by_index
(
used_index
);
}
else
{
table
->
use_all_columns
();
...
...
@@ -844,11 +841,7 @@ int mysql_update(THD *thd,
err:
delete
select
;
free_underlaid_joins
(
thd
,
select_lex
);
if
(
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
table
->
set_keyread
(
FALSE
);
thd
->
abort_on_warning
=
0
;
DBUG_RETURN
(
1
);
}
...
...
sql/table.cc
View file @
c433fb5e
...
...
@@ -4374,7 +4374,7 @@ void st_table::mark_columns_used_by_index(uint index)
MY_BITMAP
*
bitmap
=
&
tmp_set
;
DBUG_ENTER
(
"st_table::mark_columns_used_by_index"
);
(
void
)
file
->
extra
(
HA_EXTRA_KEYREAD
);
set_keyread
(
TRUE
);
bitmap_clear_all
(
bitmap
);
mark_columns_used_by_index_no_reset
(
index
,
bitmap
);
column_bitmaps_set
(
bitmap
,
bitmap
);
...
...
@@ -4397,8 +4397,7 @@ void st_table::restore_column_maps_after_mark_index()
{
DBUG_ENTER
(
"st_table::restore_column_maps_after_mark_index"
);
key_read
=
0
;
(
void
)
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
set_keyread
(
FALSE
);
default_column_bitmaps
();
file
->
column_bitmaps_signal
();
DBUG_VOID_RETURN
;
...
...
sql/table.h
View file @
c433fb5e
...
...
@@ -902,6 +902,20 @@ struct st_table {
inline
bool
needs_reopen_or_name_lock
()
{
return
s
->
version
!=
refresh_version
;
}
bool
is_children_attached
(
void
);
inline
void
set_keyread
(
bool
flag
)
{
DBUG_ASSERT
(
file
);
if
(
flag
&&
!
key_read
)
{
key_read
=
1
;
file
->
extra
(
HA_EXTRA_KEYREAD
);
}
else
if
(
!
flag
&&
key_read
)
{
key_read
=
0
;
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
}
};
enum
enum_schema_table_state
...
...
storage/myisam/ft_boolean_search.c
View file @
c433fb5e
...
...
@@ -437,8 +437,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
return
0
;
}
/* going up to the first-level tree to continue search there */
/*
Going up to the first-level tree to continue search there.
Only done when performing prefix search.
Key buffer data pointer as well as docid[0] may be smaller
than values we got while searching first-level tree. Thus
they must be restored to original values to avoid dead-loop,
when subsequent search for a bigger value eventually ends up
in this same second-level tree.
*/
_mi_dpointer
(
info
,
(
uchar
*
)
(
lastkey_buf
+
HA_FT_WLEN
),
ftbw
->
key_root
);
ftbw
->
docid
[
0
]
=
ftbw
->
key_root
;
ftbw
->
key_root
=
info
->
s
->
state
.
key_root
[
ftb
->
keynr
];
ftbw
->
keyinfo
=
info
->
s
->
keyinfo
+
ftb
->
keynr
;
ftbw
->
off
=
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