mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
- Let QUICK_RANGE_SELECT::init_ror_merged_scan() call quick->reset() only after we've set the column read bitmaps.
This commit is contained in:
@ -777,4 +777,19 @@ commit;
|
||||
select * from t1 where t1.zone_id=830 AND modified=9;
|
||||
pk zone_id modified
|
||||
drop table t0, t1;
|
||||
#
|
||||
# MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INT, b CHAR(1), c CHAR(1), KEY(a), KEY(b)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (8,'v','v'),(8,'m','m'),(9,'d','d');
|
||||
SELECT ta.* FROM t1 AS ta, t1 AS tb
|
||||
WHERE ( tb.b != ta.b OR tb.a = ta.a )
|
||||
AND ( tb.b = ta.c OR tb.b = ta.b );
|
||||
a b c
|
||||
8 v v
|
||||
8 m m
|
||||
9 d d
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch= @optimizer_switch_save;
|
||||
|
@ -156,6 +156,21 @@ select * from t1 where t1.zone_id=830 AND modified=9;
|
||||
|
||||
drop table t0, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
a INT, b CHAR(1), c CHAR(1), KEY(a), KEY(b)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES (8,'v','v'),(8,'m','m'),(9,'d','d');
|
||||
|
||||
|
||||
SELECT ta.* FROM t1 AS ta, t1 AS tb
|
||||
WHERE ( tb.b != ta.b OR tb.a = ta.a )
|
||||
AND ( tb.b = ta.c OR tb.b = ta.b );
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
set optimizer_switch= @optimizer_switch_save;
|
||||
|
||||
|
@ -2008,7 +2008,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
|
||||
if (reuse_handler)
|
||||
{
|
||||
DBUG_PRINT("info", ("Reusing handler 0x%lx", (long) file));
|
||||
if (init() || reset())
|
||||
if (init())
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -2043,7 +2043,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
|
||||
if (file->ha_external_lock(thd, F_RDLCK))
|
||||
goto failure;
|
||||
|
||||
if (init() || reset())
|
||||
if (init())
|
||||
{
|
||||
file->ha_external_lock(thd, F_UNLCK);
|
||||
file->ha_close();
|
||||
@ -2091,6 +2091,17 @@ end:
|
||||
bitmap_copy(&column_bitmap, head->read_set);
|
||||
head->column_bitmaps_set(&column_bitmap, &column_bitmap);
|
||||
|
||||
if (reset())
|
||||
{
|
||||
if (!reuse_handler)
|
||||
{
|
||||
file->ha_external_lock(thd, F_UNLCK);
|
||||
file->ha_close();
|
||||
goto failure;
|
||||
}
|
||||
else
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
||||
failure:
|
||||
|
Reference in New Issue
Block a user