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
635924e0
Commit
635924e0
authored
Jun 02, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
8cbd7df2
a3c5ba4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
0 deletions
+82
-0
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_innodb.result
+32
-0
mysql-test/t/index_merge_innodb.test
mysql-test/t/index_merge_innodb.test
+33
-0
sql/opt_range.cc
sql/opt_range.cc
+17
-0
No files found.
mysql-test/r/index_merge_innodb.result
View file @
635924e0
...
...
@@ -745,4 +745,36 @@ WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref i,v i 5 const 2 Using where
DROP TABLE t1;
#
# BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
pk int auto_increment,
zone_id int,
modified tinyint,
primary key(pk),
key (zone_id),
key (modified)
) engine=innodb;
insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D;
update t1 set zone_id=487, modified=9 where pk=7259;
update t1 set zone_id=487, modified=9 where pk=7260;
update t1 set zone_id=830, modified=9 where pk=8434;
update t1 set zone_id=830, modified=9 where pk=8435;
update t1 set zone_id=830, modified=9 where pk=8436;
update t1 set zone_id=830, modified=9 where pk=8437;
select * from t1 where t1.zone_id=830 AND modified=9;
pk zone_id modified
8434 830 9
8435 830 9
8436 830 9
8437 830 9
begin;
DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9;
commit;
select * from t1 where t1.zone_id=830 AND modified=9;
pk zone_id modified
drop table t0, t1;
set optimizer_switch= @optimizer_switch_save;
mysql-test/t/index_merge_innodb.test
View file @
635924e0
...
...
@@ -125,5 +125,38 @@ WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
DROP
TABLE
t1
;
--
echo
#
--
echo
# BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows
--
echo
#
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
pk
int
auto_increment
,
zone_id
int
,
modified
tinyint
,
primary
key
(
pk
),
key
(
zone_id
),
key
(
modified
)
)
engine
=
innodb
;
insert
into
t1
(
zone_id
,
modified
)
select
0
,
0
from
t0
A
,
t0
B
,
t0
C
,
t0
D
;
update
t1
set
zone_id
=
487
,
modified
=
9
where
pk
=
7259
;
update
t1
set
zone_id
=
487
,
modified
=
9
where
pk
=
7260
;
update
t1
set
zone_id
=
830
,
modified
=
9
where
pk
=
8434
;
update
t1
set
zone_id
=
830
,
modified
=
9
where
pk
=
8435
;
update
t1
set
zone_id
=
830
,
modified
=
9
where
pk
=
8436
;
update
t1
set
zone_id
=
830
,
modified
=
9
where
pk
=
8437
;
select
*
from
t1
where
t1
.
zone_id
=
830
AND
modified
=
9
;
begin
;
DELETE
t1
FROM
t1
WHERE
t1
.
zone_id
=
830
AND
modified
=
9
;
commit
;
select
*
from
t1
where
t1
.
zone_id
=
830
AND
modified
=
9
;
drop
table
t0
,
t1
;
set
optimizer_switch
=
@
optimizer_switch_save
;
sql/opt_range.cc
View file @
635924e0
...
...
@@ -2041,7 +2041,24 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
doing_key_read
=
1
;
head
->
mark_columns_used_by_index
(
index
);
}
head
->
prepare_for_position
();
if
(
head
->
no_keyread
)
{
/*
We can get here when doing multi-table delete and having index_merge
condition on a table that we're deleting from. It probably doesn't make
sense to use index_merge, but de-facto it is used.
When it is used, we need to index columns to be read (before maria-5.3,
read_multi_range_first() would set it).
We shouldn't call mark_columns_used_by_index(), because it calls
enable_keyread(), which is not allowed.
*/
head
->
mark_columns_used_by_index_no_reset
(
index
,
head
->
read_set
);
}
head
->
file
=
org_file
;
head
->
key_read
=
org_key_read
;
bitmap_copy
(
&
column_bitmap
,
head
->
read_set
);
...
...
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