MDEV-24242 Query returns wrong result while using big_tables=1

When executing set operations in a pipeline using only one temporary table
additional scans of intermediate results may be needed. The scans are
performed with usage of the rnd_next() handler function that might
leave record buffers used for the temporary table not in a state that
is good for following writes into the table. For example it happens for
aria engine when the last call of rnd_next() encounters only deleted
records. Thus a cleanup of record buffers is needed after each such scan
of the temporary table.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
This commit is contained in:
Igor Babaev 2020-11-24 20:05:54 -08:00
commit b92391d5b1
3 changed files with 66 additions and 0 deletions

View file

@ -524,3 +524,31 @@ select count(*) from
drop table t1;
drop table t2;
--echo #
--echo # MDEV-24242: set expression with empty intermediate result
--echo # when tmp_memory_table_size is set to 0
--echo #
create table t1 (a int, b int) engine=MyISAM;
insert into t1 values (1,1), (2,2);
create table t2 (a int, b int) engine=MyISAM;
insert into t2 values (11,11), (12,12), (13,13);
let $q=
select * from t1
except all
select * from t1
except
select * from t1
union all
select * from t2;
eval $q;
set tmp_memory_table_size=0;
eval $q;
set tmp_memory_table_size=default;
drop table t1,t2;
--echo # End of 10.4 tests