MDEV-21665: Server crashes in my_qsort2 / Filesort_buffer::sort_buffer
Allocation should use ALIGN_SIZE when we need to make sure that we have atleast enough space to store one record in MERGEBUFF2 buffers
This commit is contained in:
parent
1a6f708ec5
commit
f0606a7530
@ -3466,3 +3466,35 @@ Note 1003 select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` A
|
|||||||
set histogram_size=@tmp_h, histogram_type=@tmp_ht, use_stat_tables=@tmp_u,
|
set histogram_size=@tmp_h, histogram_type=@tmp_ht, use_stat_tables=@tmp_u,
|
||||||
optimizer_use_condition_selectivity=@tmp_o;
|
optimizer_use_condition_selectivity=@tmp_o;
|
||||||
drop table t1,t2,t3,t4;
|
drop table t1,t2,t3,t4;
|
||||||
|
#
|
||||||
|
# MDEV-21655: Server crashes in my_qsort2 / Filesort_buffer::sort_buffer
|
||||||
|
#
|
||||||
|
set @save_sql_mode= @@sql_mode;
|
||||||
|
set sql_mode= 'PAD_CHAR_TO_FULL_LENGTH';
|
||||||
|
CREATE TABLE t1 ( a CHAR(255) charset utf8,
|
||||||
|
b CHAR(255) charset utf8, c TEXT);
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
('1','a', 'a'), ('2','b', 'b'), ('3','c', 'c'), ('4','d','d'),
|
||||||
|
('5','e', 'e'), ('6','f', 'f'), ('7','g','g'), ('8','h','h'),
|
||||||
|
('9','i', 'i'), ('10','j','j'), ('11','k','k'), ('12','l','l'),
|
||||||
|
('13','m','m'), ('14','n','n'), ('15','o','o');
|
||||||
|
set sort_buffer_size=517*30;
|
||||||
|
select c from t1 order by a,b;
|
||||||
|
c
|
||||||
|
a
|
||||||
|
j
|
||||||
|
k
|
||||||
|
l
|
||||||
|
m
|
||||||
|
n
|
||||||
|
o
|
||||||
|
b
|
||||||
|
c
|
||||||
|
d
|
||||||
|
e
|
||||||
|
f
|
||||||
|
g
|
||||||
|
h
|
||||||
|
i
|
||||||
|
set sql_mode= @save_sql_mode;
|
||||||
|
drop table t1;
|
||||||
|
@ -2292,3 +2292,24 @@ set histogram_size=@tmp_h, histogram_type=@tmp_ht, use_stat_tables=@tmp_u,
|
|||||||
optimizer_use_condition_selectivity=@tmp_o;
|
optimizer_use_condition_selectivity=@tmp_o;
|
||||||
|
|
||||||
drop table t1,t2,t3,t4;
|
drop table t1,t2,t3,t4;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-21655: Server crashes in my_qsort2 / Filesort_buffer::sort_buffer
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
set @save_sql_mode= @@sql_mode;
|
||||||
|
set sql_mode= 'PAD_CHAR_TO_FULL_LENGTH';
|
||||||
|
CREATE TABLE t1 ( a CHAR(255) charset utf8,
|
||||||
|
b CHAR(255) charset utf8, c TEXT);
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
('1','a', 'a'), ('2','b', 'b'), ('3','c', 'c'), ('4','d','d'),
|
||||||
|
('5','e', 'e'), ('6','f', 'f'), ('7','g','g'), ('8','h','h'),
|
||||||
|
('9','i', 'i'), ('10','j','j'), ('11','k','k'), ('12','l','l'),
|
||||||
|
('13','m','m'), ('14','n','n'), ('15','o','o');
|
||||||
|
|
||||||
|
set sort_buffer_size=517*30;
|
||||||
|
select c from t1 order by a,b;
|
||||||
|
|
||||||
|
set sql_mode= @save_sql_mode;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
@ -111,7 +111,8 @@ uchar *Filesort_buffer::alloc_sort_buffer(uint num_records,
|
|||||||
one key.
|
one key.
|
||||||
TODO varun: move this to the place where min_sort_memory is used.
|
TODO varun: move this to the place where min_sort_memory is used.
|
||||||
*/
|
*/
|
||||||
set_if_bigger(buff_size, (record_length +sizeof(uchar*)) * MERGEBUFF2);
|
set_if_bigger(buff_size,
|
||||||
|
ALIGN_SIZE((record_length +sizeof(uchar*)) * MERGEBUFF2));
|
||||||
|
|
||||||
if (m_rawmem)
|
if (m_rawmem)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user