Skip to content

Commit fc78b25

Browse files
committed
Merge mariadb-10.6.15 into 10.6
2 parents e0398c5 + 0d16eb3 commit fc78b25

File tree

9 files changed

+98
-14
lines changed

9 files changed

+98
-14
lines changed

include/no_valgrind_without_big.inc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# include/no_valgrind_without_big.inc
2+
#
3+
# If we are running with Valgrind ($VALGRIND_TEST <> 0) than the resource
4+
# consumption (storage space needed, runtime ...) will be extreme.
5+
# Therefore we require that the option "--big-test" is also set.
6+
#
7+
8+
if ($VALGRIND_TEST) {
9+
if (!$BIG_TEST)
10+
{
11+
--skip Need "--big-test" when running with Valgrind
12+
}
13+
}

mysql-test/main/join_cache.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6256,3 +6256,19 @@ length(concat(t1.f,t2.f))
62566256
DROP TABLE t;
62576257
set @@optimizer_switch=@org_optimizer_switch;
62586258
set @@join_buffer_size=@org_join_buffer_size;
6259+
#
6260+
# MDEV-31348 Assertion `last_key_entry >= end_pos' failed in
6261+
# virtual bool JOIN_CACHE_HASHED::put_record()
6262+
#
6263+
SET JOIN_buffer_size=1;
6264+
Warnings:
6265+
Warning 1292 Truncated incorrect join_buffer_size value: '1'
6266+
SET SESSION JOIN_cache_level=4;
6267+
SET SESSION optimizer_switch='optimize_JOIN_buffer_size=OFF';
6268+
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
6269+
ERROR HY001: Could not create a join buffer. Please check and adjust the value of the variables 'JOIN_BUFFER_SIZE (128)' and 'JOIN_BUFFER_SPACE_LIMIT (2097152)'
6270+
SET JOIN_buffer_size=16384;
6271+
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
6272+
#
6273+
# End of 10.4 tests
6274+
#

mysql-test/main/join_cache.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4230,3 +4230,22 @@ SELECT length(concat(t1.f,t2.f)) FROM t t1, t t2;
42304230
DROP TABLE t;
42314231
set @@optimizer_switch=@org_optimizer_switch;
42324232
set @@join_buffer_size=@org_join_buffer_size;
4233+
4234+
--echo #
4235+
--echo # MDEV-31348 Assertion `last_key_entry >= end_pos' failed in
4236+
--echo # virtual bool JOIN_CACHE_HASHED::put_record()
4237+
--echo #
4238+
4239+
SET JOIN_buffer_size=1;
4240+
SET SESSION JOIN_cache_level=4;
4241+
SET SESSION optimizer_switch='optimize_JOIN_buffer_size=OFF';
4242+
--error ER_OUTOFMEMORY
4243+
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
4244+
SET JOIN_buffer_size=16384;
4245+
--disable_result_log
4246+
SELECT * FROM information_schema.statistics JOIN information_schema.COLUMNS USING (table_name,column_name);
4247+
--enable_result_log
4248+
4249+
--echo #
4250+
--echo # End of 10.4 tests
4251+
--echo #

mysql-test/main/join_cache_notasan.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
# Tests that should be in join_cache but cannot be run with ASAN
33

44
--source include/have_64bit.inc
5+
# Disable asan it asan builds crashes when trying to allocate too much memory
56
--source include/not_asan.inc
67
--source include/not_msan.inc
8+
# Valgrind is useful here, but very slow as lots of memory is allocated
9+
--source include/no_valgrind_without_big.inc
710
--source include/have_innodb.inc
811

912
--echo #

mysql-test/main/sp.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8972,3 +8972,15 @@ select @counter;
89728972
5
89738973
drop function f1;
89748974
drop table t1,t2;
8975+
#
8976+
# MDEV-31877: ASAN errors in Exec_time_tracker::get_cycles with innodb slow log verbosity
8977+
#
8978+
CREATE TABLE t1 (a INT, b INT);
8979+
INSERT INTO t1 VALUES (1,2);
8980+
SET @tmp=@@log_slow_verbosity;
8981+
SET SESSION log_slow_verbosity= 'innodb';
8982+
BEGIN NOT ATOMIC DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1); SELECT r.a; END $
8983+
r.a
8984+
1
8985+
SET SESSION log_slow_verbosity= @tmp;
8986+
DROP TABLE t1;

mysql-test/main/sp.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10573,3 +10573,19 @@ select f1(col1) from t2 order by col2 desc limit 5;
1057310573
select @counter;
1057410574
drop function f1;
1057510575
drop table t1,t2;
10576+
10577+
--echo #
10578+
--echo # MDEV-31877: ASAN errors in Exec_time_tracker::get_cycles with innodb slow log verbosity
10579+
--echo #
10580+
CREATE TABLE t1 (a INT, b INT);
10581+
INSERT INTO t1 VALUES (1,2);
10582+
SET @tmp=@@log_slow_verbosity;
10583+
SET SESSION log_slow_verbosity= 'innodb';
10584+
--delimiter $
10585+
BEGIN NOT ATOMIC DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1); SELECT r.a; END $
10586+
--delimiter ;
10587+
10588+
SET SESSION log_slow_verbosity= @tmp;
10589+
# Cleanup
10590+
DROP TABLE t1;
10591+

sql/sp_head.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3807,7 +3807,6 @@ int
38073807
sp_instr_set::exec_core(THD *thd, uint *nextp)
38083808
{
38093809
int res= get_rcontext(thd)->set_variable(thd, m_offset, &m_value);
3810-
delete_explain_query(thd->lex);
38113810
*nextp = m_ip+1;
38123811
return res;
38133812
}
@@ -3849,7 +3848,6 @@ sp_instr_set_row_field::exec_core(THD *thd, uint *nextp)
38493848
int res= get_rcontext(thd)->set_variable_row_field(thd, m_offset,
38503849
m_field_offset,
38513850
&m_value);
3852-
delete_explain_query(thd->lex);
38533851
*nextp= m_ip + 1;
38543852
return res;
38553853
}
@@ -3897,7 +3895,6 @@ sp_instr_set_row_field_by_name::exec_core(THD *thd, uint *nextp)
38973895
int res= get_rcontext(thd)->set_variable_row_field_by_name(thd, m_offset,
38983896
m_field_name,
38993897
&m_value);
3900-
delete_explain_query(thd->lex);
39013898
*nextp= m_ip + 1;
39023899
return res;
39033900
}

sql/sql_join_cache.cc

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,18 @@ size_t JOIN_CACHE::get_min_join_buffer_size()
800800
}
801801

802802

803+
size_t JOIN_CACHE::calc_avg_record_length()
804+
{
805+
size_t len= 0;
806+
for (JOIN_TAB *tab= start_tab; tab != join_tab;
807+
tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
808+
{
809+
len+= tab->get_used_fieldlength();
810+
}
811+
len+= get_record_max_affix_length();
812+
return len;
813+
}
814+
803815
/*
804816
Get the maximum possible size of the cache join buffer
805817
@@ -822,9 +834,9 @@ size_t JOIN_CACHE::get_min_join_buffer_size()
822834
'max_buff_size' in order to use it directly at the next
823835
invocations of the function.
824836
825-
826837
RETURN VALUE
827-
The maximum possible size of the join buffer of this cache
838+
The maximum possible size of the join buffer of this cache
839+
avg_record_length is also updated if optimize_buff_size != 0
828840
*/
829841

830842
size_t JOIN_CACHE::get_max_join_buffer_size(bool optimize_buff_size,
@@ -839,19 +851,13 @@ size_t JOIN_CACHE::get_max_join_buffer_size(bool optimize_buff_size,
839851
return max_buff_size= limit_sz;
840852

841853
size_t max_sz;
842-
size_t len= 0;
854+
size_t len;
843855
double max_records, partial_join_cardinality=
844856
(join_tab-1)->get_partial_join_cardinality();
845857
/* Expected join buffer space used for one record */
846858
size_t space_per_record;
847859

848-
for (JOIN_TAB *tab= start_tab; tab != join_tab;
849-
tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
850-
{
851-
len+= tab->get_used_fieldlength();
852-
}
853-
len+= get_record_max_affix_length();
854-
avg_record_length= len;
860+
len= avg_record_length= calc_avg_record_length();
855861
len+= get_max_key_addon_space_per_record() + avg_aux_buffer_incr;
856862
space_per_record= len;
857863

@@ -2794,7 +2800,6 @@ bool JOIN_CACHE_BKAH::save_explain_data(EXPLAIN_BKA_TYPE *explain)
27942800
int JOIN_CACHE_HASHED::init(bool for_explain)
27952801
{
27962802
TABLE_REF *ref= &join_tab->ref;
2797-
27982803
DBUG_ENTER("JOIN_CACHE_HASHED::init");
27992804

28002805
hash_table= 0;
@@ -2881,6 +2886,8 @@ int JOIN_CACHE_HASHED::init_hash_table()
28812886
hash_table= 0;
28822887
key_entries= 0;
28832888

2889+
avg_record_length= calc_avg_record_length();
2890+
28842891
/* Calculate the minimal possible value of size_of_key_ofs greater than 1 */
28852892
uint max_size_of_key_ofs= MY_MAX(2, get_size_of_rec_offset());
28862893
for (size_of_key_ofs= 2;

sql/sql_join_cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class JOIN_CACHE :public Sql_alloc
130130
case 4: int4store(ptr, (uint32) ofs); return;
131131
}
132132
}
133+
size_t calc_avg_record_length();
133134

134135
/*
135136
The maximum total length of the fields stored for a record in the cache.

0 commit comments

Comments
 (0)