Skip to content

Commit 88a480c

Browse files
committed
Merge 10.3 into 10.4
2 parents 0070830 + b6f2039 commit 88a480c

File tree

9 files changed

+128
-17
lines changed

9 files changed

+128
-17
lines changed

mysql-test/main/cte_recursive.result

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,6 +3606,54 @@ Mandelbrot Set
36063606
..............................................................................
36073607
...........................................................................
36083608
........................................................................
3609+
#
3610+
# MDEV-17871: EXPLAIN for query with not used recursive cte
3611+
#
3612+
create table t1 (a int);
3613+
insert into t1 values (2), (1), (4), (3);
3614+
explain extended
3615+
with recursive cte as
3616+
(select * from t1 where a=1 union select a+1 from cte where a<3)
3617+
select * from cte as t;
3618+
id select_type table type possible_keys key key_len ref rows filtered Extra
3619+
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00
3620+
2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00 Using where
3621+
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 100.00 Using where
3622+
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
3623+
Warnings:
3624+
Note 1003 with recursive cte as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union /* select#3 */ select `cte`.`a` + 1 AS `a+1` from `cte` where `cte`.`a` < 3)/* select#1 */ select `t`.`a` AS `a` from `cte` `t`
3625+
with recursive cte as
3626+
(select * from t1 where a=1 union select a+1 from cte where a<3)
3627+
select * from cte as t;
3628+
a
3629+
1
3630+
2
3631+
3
3632+
explain extended
3633+
with recursive cte as
3634+
(select * from t1 where a=1 union select a+1 from cte where a<3)
3635+
select * from t1 as t;
3636+
id select_type table type possible_keys key key_len ref rows filtered Extra
3637+
1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00
3638+
Warnings:
3639+
Note 1003 with recursive cte as (/* select#2 */ select `*` AS `*` from `test`.`t1` where `a` = 1 union /* select#3 */ select `a` + 1 AS `a+1` from `cte` where `a` < 3)/* select#1 */ select `test`.`t`.`a` AS `a` from `test`.`t1` `t`
3640+
with recursive cte as
3641+
(select * from t1 where a=1 union select a+1 from cte where a<3)
3642+
select * from t1 as t;
3643+
a
3644+
2
3645+
1
3646+
4
3647+
3
3648+
create table t2 ( i1 int, i2 int);
3649+
insert into t2 values (1,1),(2,2);
3650+
explain
3651+
with recursive cte as
3652+
( select * from t1 union select s1.* from t1 as s1, cte where s1.i1 = cte.i2 )
3653+
select * from t1 as t;
3654+
id select_type table type possible_keys key key_len ref rows Extra
3655+
1 PRIMARY t ALL NULL NULL NULL NULL 4
3656+
drop table t1,t2;
36093657
# End of 10.2 tests
36103658
#
36113659
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field

mysql-test/main/cte_recursive.test

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,6 +2496,45 @@ SELECT GROUP_CONCAT(
24962496
GROUP BY Iy
24972497
ORDER BY Iy;
24982498

2499+
--echo #
2500+
--echo # MDEV-17871: EXPLAIN for query with not used recursive cte
2501+
--echo #
2502+
2503+
create table t1 (a int);
2504+
insert into t1 values (2), (1), (4), (3);
2505+
2506+
let $rec_cte =
2507+
with recursive cte as
2508+
(select * from t1 where a=1 union select a+1 from cte where a<3);
2509+
2510+
eval
2511+
explain extended
2512+
$rec_cte
2513+
select * from cte as t;
2514+
2515+
eval
2516+
$rec_cte
2517+
select * from cte as t;
2518+
2519+
eval
2520+
explain extended
2521+
$rec_cte
2522+
select * from t1 as t;
2523+
2524+
eval
2525+
$rec_cte
2526+
select * from t1 as t;
2527+
2528+
create table t2 ( i1 int, i2 int);
2529+
insert into t2 values (1,1),(2,2);
2530+
2531+
explain
2532+
with recursive cte as
2533+
( select * from t1 union select s1.* from t1 as s1, cte where s1.i1 = cte.i2 )
2534+
select * from t1 as t;
2535+
2536+
drop table t1,t2;
2537+
24992538
--echo # End of 10.2 tests
25002539

25012540
--echo #

mysql-test/suite/galera/disabled.def

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ MW-416 : MDEV-13549 Galera test failures
2929
MW-388 : MDEV-13549 Galera test failures
3030
MW-44 : MDEV-15809 Test failure on galera.MW-44
3131
galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
32+
galera_drop_database : MDEV-17421 mtr does not restart the server whose parameters were changed
3233
galera_kill_applier : race condition at the start of the test
3334
galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
3435
pxc-421: Lock timeout exceeded
3536
galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure
3637
galera_sst_xtrabackup-v2-options : Failed to read uuid:seqno and wsrep_gtid_domain_id from joiner script
37-
MW-328C : Timeouts
3838
galera_gcs_fc_limit : Timeouts
3939
pool_of_threads: WSREP has not yet prepared node for application use
4040
galera_var_innodb_disallow_writes : Timeout
@@ -47,7 +47,6 @@ galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit
4747
galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion
4848
galera_wan : MDEV-17259: Test failure on galera.galera_wan
4949
galera_pc_ignore_sb : MDEV-17357 Test failure on galera.galera_pc_ignore_sb
50-
galera_drop_database : test
51-
galera.MW-328A : MDEV-17847 Galera test failure on MW-328[A|B|C]
52-
galera.MW-328B : MDEV-17847 Galera test failure on MW-328[A|B|C]
53-
galera.MW-328C : MDEV-17847 Galera test failure on MW-328[A|B|C]
50+
MW-328A : MDEV-17847 Galera test failure on MW-328[A|B|C]
51+
MW-328B : MDEV-17847 Galera test failure on MW-328[A|B|C]
52+
MW-328C : MDEV-17847 Galera test failure on MW-328[A|B|C]

mysql-test/suite/innodb/r/table_flags.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,8 @@ ib_logfile0
192192
ib_logfile1
193193
ibdata1
194194
sys_tables.bin
195+
call mtr.add_suppression("ERROR HY000: Can't create table `test`.`t1`");
196+
CREATE TABLE t1(f1 INT, f2 VARCHAR(1), KEY k1(f2),
197+
FULLTEXT KEY(f2),
198+
FOREIGN KEY (f2) REFERENCES t1(f3))ENGINE=InnoDB;
199+
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")

mysql-test/suite/innodb/t/table_flags.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,9 @@ DROP TABLE tr,tc,td,tz,tp;
216216
--list_files $bugdir
217217
--remove_files_wildcard $bugdir
218218
--rmdir $bugdir
219+
220+
call mtr.add_suppression("ERROR HY000: Can't create table `test`.`t1`");
221+
--error ER_CANT_CREATE_TABLE
222+
CREATE TABLE t1(f1 INT, f2 VARCHAR(1), KEY k1(f2),
223+
FULLTEXT KEY(f2),
224+
FOREIGN KEY (f2) REFERENCES t1(f3))ENGINE=InnoDB;

sql/sql_select.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25737,13 +25737,13 @@ int JOIN::save_explain_data_intern(Explain_query *output,
2573725737
(1) they are not parts of ON clauses that were eliminated by table
2573825738
elimination.
2573925739
(2) they are not merged derived tables
25740-
(3) they are not unreferenced CTE
25740+
(3) they are not hanging CTEs (they are needed for execution)
2574125741
*/
2574225742
if (!(tmp_unit->item && tmp_unit->item->eliminated) && // (1)
2574325743
(!tmp_unit->derived ||
2574425744
tmp_unit->derived->is_materialized_derived()) && // (2)
25745-
!(tmp_unit->with_element &&
25746-
!tmp_unit->with_element->is_referenced())) // (3)
25745+
!(tmp_unit->with_element &&
25746+
(!tmp_unit->derived || !tmp_unit->derived->derived_result))) // (3)
2574725747
{
2574825748
explain->add_child(tmp_unit->first_select()->select_number);
2574925749
}
@@ -25804,11 +25804,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
2580425804
Save plans for child subqueries, when
2580525805
(1) they are not parts of eliminated WHERE/ON clauses.
2580625806
(2) they are not VIEWs that were "merged for INSERT".
25807-
(3) they are not unreferenced CTE.
25807+
(3) they are not hanging CTEs (they are needed for execution)
2580825808
*/
2580925809
if (!(unit->item && unit->item->eliminated) && // (1)
2581025810
!(unit->derived && unit->derived->merged_for_insert) && // (2)
25811-
!(unit->with_element && !unit->with_element->is_referenced())) // (3)
25811+
!(unit->with_element &&
25812+
(!unit->derived || !unit->derived->derived_result))) // (3)
2581225813
{
2581325814
if (mysql_explain_union(thd, unit, result))
2581425815
DBUG_VOID_RETURN;

sql/sql_union.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,8 +1046,11 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
10461046
0))
10471047
goto err;
10481048
if (!derived_arg->table)
1049-
derived_arg->table= derived_arg->derived_result->table=
1050-
with_element->rec_result->rec_tables.head();
1049+
{
1050+
derived_arg->table= with_element->rec_result->rec_tables.head();
1051+
if (derived_arg->derived_result)
1052+
derived_arg->derived_result->table= derived_arg->table;
1053+
}
10511054
with_element->mark_as_with_prepared_anchor();
10521055
is_rec_result_table_created= true;
10531056
}

storage/innobase/fil/fil0crypt.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,7 +2562,7 @@ fil_space_verify_crypt_checksum(
25622562
return (true);
25632563
}
25642564

2565-
uint32 cchecksum1, cchecksum2;
2565+
uint32_t cchecksum1, cchecksum2;
25662566

25672567
/* Calculate checksums */
25682568
if (page_size.is_compressed()) {
@@ -2645,10 +2645,19 @@ fil_space_verify_crypt_checksum(
26452645
#else /* UNIV_INNOCHECKSUM */
26462646
ib::error()
26472647
<< " Page " << space << ":" << offset
2648-
<< " may be corrupted."
2649-
" Post encryption checksum " << checksum
2650-
<< " stored [" << checksum1 << ":" << checksum2
2648+
<< " may be corrupted.";
2649+
ib::info()
2650+
<< "If encrypted: stored checksum" << checksum
2651+
<< " calculated checksum [" << cchecksum1 << ":" << cchecksum2
26512652
<< "] key_version " << key_version;
2653+
ib::info()
2654+
<< "If unencrypted: stored checksum [" << checksum1
2655+
<< ":" << checksum2 << "] calculated crc32 ["
2656+
<< buf_calc_page_crc32(page, false) << ":"
2657+
<< buf_calc_page_crc32(page, true) << "] innodb ["
2658+
<< buf_calc_page_old_checksum(page) << ":"
2659+
<< buf_calc_page_new_checksum(page) << "] LSN "
2660+
<< mach_read_from_4(page + FIL_PAGE_LSN);
26522661
#endif
26532662
encrypted = false;
26542663
}

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12600,7 +12600,8 @@ ha_innobase::create(
1260012600
if (info.drop_before_rollback()) {
1260112601
trx->error_state = DB_SUCCESS;
1260212602
row_drop_table_for_mysql(info.table_name(),
12603-
trx, SQLCOM_TRUNCATE, true);
12603+
trx, SQLCOM_TRUNCATE, true,
12604+
false);
1260412605
}
1260512606
trx_rollback_for_mysql(trx);
1260612607
row_mysql_unlock_data_dictionary(trx);

0 commit comments

Comments
 (0)