mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
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:
parent
1555c6d125
commit
b92391d5b1
3 changed files with 66 additions and 0 deletions
|
|
@ -1155,3 +1155,37 @@ count(*)
|
|||
319
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
#
|
||||
# MDEV-24242: set expression with empty intermediate result
|
||||
# when tmp_memory_table_size is set to 0
|
||||
#
|
||||
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);
|
||||
select * from t1
|
||||
except all
|
||||
select * from t1
|
||||
except
|
||||
select * from t1
|
||||
union all
|
||||
select * from t2;
|
||||
a b
|
||||
12 12
|
||||
11 11
|
||||
13 13
|
||||
set tmp_memory_table_size=0;
|
||||
select * from t1
|
||||
except all
|
||||
select * from t1
|
||||
except
|
||||
select * from t1
|
||||
union all
|
||||
select * from t2;
|
||||
a b
|
||||
12 12
|
||||
11 11
|
||||
13 13
|
||||
set tmp_memory_table_size=default;
|
||||
drop table t1,t2;
|
||||
# End of 10.4 tests
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -880,6 +880,10 @@ bool select_unit_ext::send_eof()
|
|||
table->file->ha_rnd_end();
|
||||
}
|
||||
|
||||
/* Clean up table buffers for the next set operation from pipeline */
|
||||
if (next_sl)
|
||||
restore_record(table,s->default_values);
|
||||
|
||||
if (unlikely(error))
|
||||
table->file->print_error(error, MYF(0));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue