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
a575bc51
Commit
a575bc51
authored
Jun 15, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
automerge
parents
0d6ded59
10c61461
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
mysql-test/include/index_merge1.inc
mysql-test/include/index_merge1.inc
+26
-0
mysql-test/r/index_merge_myisam.result
mysql-test/r/index_merge_myisam.result
+24
-0
sql/sql_select.cc
sql/sql_select.cc
+15
-0
No files found.
mysql-test/include/index_merge1.inc
View file @
a575bc51
...
...
@@ -527,4 +527,30 @@ where exists (select 1 from t2, t3
drop
table
t0
,
t1
,
t2
,
t3
;
--
echo
#
--
echo
# BUG#44810: index merge and order by with low sort_buffer_size
--
echo
# crashes server!
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
128
),
b
VARCHAR
(
128
),
KEY
(
A
),
KEY
(
B
));
INSERT
INTO
t1
VALUES
(
REPEAT
(
'a'
,
128
),
REPEAT
(
'b'
,
128
));
INSERT
INTO
t1
SELECT
*
FROM
t1
;
INSERT
INTO
t1
SELECT
*
FROM
t1
;
INSERT
INTO
t1
SELECT
*
FROM
t1
;
INSERT
INTO
t1
SELECT
*
FROM
t1
;
INSERT
INTO
t1
SELECT
*
FROM
t1
;
INSERT
INTO
t1
SELECT
*
FROM
t1
;
SET
SESSION
sort_buffer_size
=
1
;
EXPLAIN
SELECT
*
FROM
t1
FORCE
INDEX
(
a
,
b
)
WHERE
a
LIKE
'a%'
OR
b
LIKE
'b%'
ORDER
BY
a
,
b
;
# we don't actually care about the result : we're checking if it crashes
--
disable_result_log
SELECT
*
FROM
t1
FORCE
INDEX
(
a
,
b
)
WHERE
a
LIKE
'a%'
OR
b
LIKE
'b%'
ORDER
BY
a
,
b
;
--
enable_result_log
SET
SESSION
sort_buffer_size
=
DEFAULT
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
mysql-test/r/index_merge_myisam.result
View file @
a575bc51
...
...
@@ -557,6 +557,30 @@ a
1
2
drop table t0, t1, t2, t3;
#
# BUG#44810: index merge and order by with low sort_buffer_size
# crashes server!
#
CREATE TABLE t1(a VARCHAR(128),b VARCHAR(128),KEY(A),KEY(B));
INSERT INTO t1 VALUES (REPEAT('a',128),REPEAT('b',128));
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
SET SESSION sort_buffer_size=1;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '1'
EXPLAIN
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
ORDER BY a,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 131,131 NULL 64 Using sort_union(a,b); Using where; Using filesort
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
ORDER BY a,b;
SET SESSION sort_buffer_size=DEFAULT;
DROP TABLE t1;
End of 5.0 tests
#---------------- ROR-index_merge tests -----------------------
SET SESSION STORAGE_ENGINE = MyISAM;
...
...
sql/sql_select.cc
View file @
a575bc51
...
...
@@ -13490,9 +13490,24 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
tab
->
records
=
table
->
sort
.
found_records
;
// For SQL_CALC_ROWS
if
(
select
)
{
/*
We need to preserve tablesort's output resultset here, because
QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT (called by
SQL_SELECT::cleanup()) may free it assuming it's the result of the quick
select operation that we no longer need. Note that all the other parts of
this data structure are cleaned up when
QUICK_INDEX_MERGE_SELECT::get_next encounters end of data, so the next
SQL_SELECT::cleanup() call changes sort.io_cache alone.
*/
IO_CACHE
*
tablesort_result_cache
;
tablesort_result_cache
=
table
->
sort
.
io_cache
;
table
->
sort
.
io_cache
=
NULL
;
select
->
cleanup
();
// filesort did select
tab
->
select
=
0
;
table
->
quick_keys
.
clear_all
();
// as far as we cleanup select->quick
table
->
sort
.
io_cache
=
tablesort_result_cache
;
}
tab
->
select_cond
=
0
;
tab
->
last_inner
=
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