Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Apr 6, 2022
2 parents aed87f1 + f089f8d commit cacb61b
Show file tree
Hide file tree
Showing 66 changed files with 679 additions and 555 deletions.
1 change: 1 addition & 0 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ static const char *expected_errors[]=
"ERROR 1347", /* 'mysql.user' is not of type 'BASE TABLE' */
"ERROR 1348", /* Column 'Show_db_priv' is not updatable */
"ERROR 1356", /* definer of view lack rights (UPDATE) */
"ERROR 1449", /* definer ('mariadb.sys'@'localhost') of mysql.user does not exist */
0
};

Expand Down
5 changes: 4 additions & 1 deletion client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8587,7 +8587,10 @@ void run_prepare_stmt(struct st_connection *cn, struct st_command *command, cons
separate string
*/
if (!disable_warnings)
{
append_warnings(&ds_prepare_warnings, mysql);
dynstr_free(&ds_prepare_warnings);
}
end:
DBUG_VOID_RETURN;
}
Expand Down Expand Up @@ -8666,7 +8669,7 @@ void run_bind_stmt(struct st_connection *cn, struct st_command *command,
else
{
ps_params[i].buffer_type= MYSQL_TYPE_STRING;
ps_params[i].buffer= strdup(p);
ps_params[i].buffer= my_strdup(PSI_NOT_INSTRUMENTED, p, MYF(MY_WME));
ps_params[i].buffer_length= (unsigned long)strlen(p);
}
}
Expand Down
44 changes: 22 additions & 22 deletions extra/innochecksum.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2014, 2021, MariaDB Corporation.
Copyright (c) 2014, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -877,7 +877,7 @@ parse_page(

is_leaf = (!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL)));

if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tIndex page\t\t\t|"
"\tindex id=%llu,", cur_page_num, id);

Expand Down Expand Up @@ -929,7 +929,7 @@ parse_page(
index.total_data_bytes += data_bytes;
index.pages_in_size_range[size_range_id] ++;
}
} else {
} else if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tEncrypted Index page\t\t\t|"
"\tkey_version " UINT32PF ",%s\n", cur_page_num, key_version, str);
}
Expand All @@ -940,7 +940,7 @@ parse_page(
page_type.n_fil_page_undo_log++;
undo_page_type = mach_read_from_2(page +
TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE);
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tUndo log page\t\t\t|",
cur_page_num);
}
Expand All @@ -950,23 +950,23 @@ parse_page(
switch (undo_page_type) {
case TRX_UNDO_ACTIVE:
page_type.n_undo_state_active++;
if (page_type_dump) {
if (file) {
fprintf(file, ", %s", "Undo log of "
"an active transaction");
}
break;

case TRX_UNDO_CACHED:
page_type.n_undo_state_cached++;
if (page_type_dump) {
if (file) {
fprintf(file, ", %s", "Page is "
"cached for quick reuse");
}
break;

case TRX_UNDO_TO_PURGE:
page_type.n_undo_state_to_purge++;
if (page_type_dump) {
if (file) {
fprintf(file, ", %s", "Will be "
"freed in purge when all undo"
"data in it is removed");
Expand All @@ -975,7 +975,7 @@ parse_page(

case TRX_UNDO_PREPARED:
page_type.n_undo_state_prepared++;
if (page_type_dump) {
if (file) {
fprintf(file, ", %s", "Undo log of "
"an prepared transaction");
}
Expand All @@ -985,110 +985,110 @@ parse_page(
page_type.n_undo_state_other++;
break;
}
if(page_type_dump) {
if(file) {
fprintf(file, ", %s\n", str);
}
break;

case FIL_PAGE_INODE:
page_type.n_fil_page_inode++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tInode page\t\t\t|"
"\t%s\n",cur_page_num, str);
}
break;

case FIL_PAGE_IBUF_FREE_LIST:
page_type.n_fil_page_ibuf_free_list++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert buffer free list"
" page\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_ALLOCATED:
page_type.n_fil_page_type_allocated++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tFreshly allocated "
"page\t\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_IBUF_BITMAP:
page_type.n_fil_page_ibuf_bitmap++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert Buffer "
"Bitmap\t\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_SYS:
page_type.n_fil_page_type_sys++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tSystem page\t\t\t|"
"\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_TRX_SYS:
page_type.n_fil_page_type_trx_sys++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tTransaction system "
"page\t\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_FSP_HDR:
page_type.n_fil_page_type_fsp_hdr++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tFile Space "
"Header\t\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_XDES:
page_type.n_fil_page_type_xdes++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tExtent descriptor "
"page\t\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_BLOB:
page_type.n_fil_page_type_blob++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tBLOB page\t\t\t|\t%s\n",
cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_ZBLOB:
page_type.n_fil_page_type_zblob++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tCompressed BLOB "
"page\t\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_TYPE_ZBLOB2:
page_type.n_fil_page_type_zblob2++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tSubsequent Compressed "
"BLOB page\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_PAGE_COMPRESSED:
page_type.n_fil_page_type_page_compressed++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed "
"page\t|\t%s\n", cur_page_num, str);
}
break;

case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
page_type.n_fil_page_type_page_compressed_encrypted++;
if (page_type_dump) {
if (file) {
fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed encrypted "
"page\t|\t%s\n", cur_page_num, str);
}
Expand Down
5 changes: 4 additions & 1 deletion include/my_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals)
!ltime->hour && !ltime->minute && !ltime->second)
ltime->neg= FALSE;
}
#ifdef _WIN32
#define suseconds_t long
#endif
static inline void my_timeval_trunc(struct timeval *tv, uint decimals)
{
tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals);
tv->tv_usec-= (suseconds_t) my_time_fraction_remainder(tv->tv_usec, decimals);
}


Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/backup_locks.result
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ create sequence seq2;
backup lock seq1;
connection con1;
CREATE OR REPLACE SEQUENCE seq1 START -28;
ERROR HY000: Sequence 'test.seq1' values are conflicting
ERROR HY000: Sequence 'test.seq1' has out of range value for options
SET STATEMENT max_statement_time=10 FOR CREATE OR REPLACE SEQUENCE seq1 START 50;
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
SET STATEMENT max_statement_time=10 FOR ALTER SEQUENCE IF EXISTS seq1 NOMAXVALUE;
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/main/information_schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -2392,5 +2392,11 @@ DROP TABLE t1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
#
# MDEV-27673 Warning after "select progress from information_schema.processlist"
#
select progress from information_schema.processlist limit 1;
progress
0.000
#
# End of 10.3 tests
#
5 changes: 4 additions & 1 deletion mysql-test/main/information_schema.test
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,10 @@ DROP TABLE t1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;


--echo #
--echo # MDEV-27673 Warning after "select progress from information_schema.processlist"
--echo #
select progress from information_schema.processlist limit 1;

--echo #
--echo # End of 10.3 tests
Expand Down
35 changes: 35 additions & 0 deletions mysql-test/main/ps.result
Original file line number Diff line number Diff line change
Expand Up @@ -5582,6 +5582,28 @@ a
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or
# different plan upon 2nd execution of PS with EXPLAIN
#
CREATE TABLE t1 (a INT);
PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
# Without the patch the second execution of the 'stmt' prepared statement
# would result in server crash.
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 10.2 tests
#
#
Expand Down Expand Up @@ -5646,5 +5668,18 @@ connection default;
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
DROP USER user1@localhost;
#
# MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
#
CREATE TABLE t1 (a INT);
EXECUTE IMMEDIATE "CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));";
ERROR 42000: PROCEDURE does not support subqueries or stored functions
DROP TABLE t1;
BEGIN NOT ATOMIC
PREPARE stmt FROM 'SELECT ?';
EXECUTE stmt USING ((SELECT 1));
END;
$
ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
#
# End of 10.4 tests
#
32 changes: 32 additions & 0 deletions mysql-test/main/ps.test
Original file line number Diff line number Diff line change
Expand Up @@ -5005,6 +5005,19 @@ DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1;

--echo #
--echo # MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or
--echo # different plan upon 2nd execution of PS with EXPLAIN
--echo #
CREATE TABLE t1 (a INT);
PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )';
EXECUTE stmt;
--echo # Without the patch the second execution of the 'stmt' prepared statement
--echo # would result in server crash.
EXECUTE stmt;
# Cleanup
DEALLOCATE PREPARE stmt;
DROP TABLE t1;

--echo # End of 10.2 tests
--echo #
Expand Down Expand Up @@ -5082,6 +5095,25 @@ connection default;
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
DROP USER user1@localhost;

--echo #
--echo # MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
--echo #
CREATE TABLE t1 (a INT);

--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE "CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));";
DROP TABLE t1;

delimiter $;
--error ER_SUBQUERIES_NOT_SUPPORTED
BEGIN NOT ATOMIC
PREPARE stmt FROM 'SELECT ?';
EXECUTE stmt USING ((SELECT 1));
END;
$

delimiter ;$

--echo #
--echo # End of 10.4 tests
--echo #
19 changes: 19 additions & 0 deletions mysql-test/main/sp.result
Original file line number Diff line number Diff line change
Expand Up @@ -8900,6 +8900,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
BEGIN
RETURN '';
END' at line 2
#
# MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION

# Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error.
# Check that CREATE PROCEDURE doesn't crash server if the statement
# CREATE SEQUNCE ... RESTART is specified in its body.
#
CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1
# CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are
# handled by different grammar rules, so check the both cases.
CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1
# End of 10.3 tests
#
# Start of 10.4 tests
Expand All @@ -8914,5 +8927,11 @@ END;
$$
ERROR 42000: Incorrect usage/placement of 'HIGH_PRIORITY'
#
# MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
#
CREATE TABLE t1 (a INT);
CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions
DROP TABLE t1;
# End of 10.4 tests
#
Loading

0 comments on commit cacb61b

Please sign in to comment.