Skip to content

Commit 05f7fd5

Browse files
committed
Merge 10.2 into 10.3
2 parents e34877a + 2bf6f2c commit 05f7fd5

File tree

4 files changed

+81
-27
lines changed

4 files changed

+81
-27
lines changed

mysql-test/main/information_schema-big.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA
3434
GLOBAL_STATUS VARIABLE_NAME
3535
GLOBAL_VARIABLES VARIABLE_NAME
3636
INDEX_STATISTICS TABLE_SCHEMA
37+
KEYWORDS WORD
3738
KEY_CACHES KEY_CACHE_NAME
3839
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
3940
PARAMETERS SPECIFIC_SCHEMA
@@ -48,6 +49,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA
4849
SESSION_STATUS VARIABLE_NAME
4950
SESSION_VARIABLES VARIABLE_NAME
5051
SPATIAL_REF_SYS SRID
52+
SQL_FUNCTIONS FUNCTION
5153
STATISTICS TABLE_SCHEMA
5254
SYSTEM_VARIABLES VARIABLE_NAME
5355
TABLES TABLE_SCHEMA
@@ -92,6 +94,7 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA
9294
GLOBAL_STATUS VARIABLE_NAME
9395
GLOBAL_VARIABLES VARIABLE_NAME
9496
INDEX_STATISTICS TABLE_SCHEMA
97+
KEYWORDS WORD
9598
KEY_CACHES KEY_CACHE_NAME
9699
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
97100
PARAMETERS SPECIFIC_SCHEMA
@@ -106,6 +109,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA
106109
SESSION_STATUS VARIABLE_NAME
107110
SESSION_VARIABLES VARIABLE_NAME
108111
SPATIAL_REF_SYS SRID
112+
SQL_FUNCTIONS FUNCTION
109113
STATISTICS TABLE_SCHEMA
110114
SYSTEM_VARIABLES VARIABLE_NAME
111115
TABLES TABLE_SCHEMA

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
#
2+
# MDEV-26077 Assertion failure err != DB_DUPLICATE_KEY
3+
# or unexpected ER_TABLE_EXISTS_ERROR
4+
#
5+
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB;
6+
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
7+
connect con1,localhost,root,,test;
8+
START TRANSACTION;
9+
INSERT INTO t2 (pk) VALUES (1);
10+
SAVEPOINT sp;
11+
INSERT INTO t1 (pk) VALUES (1);
12+
ROLLBACK TO SAVEPOINT sp;
13+
connection default;
14+
SET lock_wait_timeout=0;
15+
SET innodb_lock_wait_timeout=0;
16+
ALTER TABLE t1 PARTITION BY HASH(pk);
17+
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
18+
SHOW CREATE TABLE t1;
19+
Table Create Table
20+
t1 CREATE TABLE `t1` (
21+
`pk` int(11) NOT NULL,
22+
PRIMARY KEY (`pk`)
23+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
24+
connection con1;
25+
COMMIT;
26+
connection default;
27+
ALTER TABLE t2 PARTITION BY HASH(pk);
28+
disconnect con1;
29+
connection default;
30+
DROP TABLE t1, t2;
31+
# End of 10.2 tests
132
CREATE TABLE t1(a INT, b VARCHAR(10), INDEX(a))ENGINE=InnoDB
233
PARTITION BY RANGE(a)
334
(PARTITION pa VALUES LESS THAN (3),
@@ -8,3 +39,4 @@ PARTITION BY RANGE(a)
839
PARTITION pb VALUES LESS THAN (4));
940
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
1041
DROP TABLE t1;
42+
# End of 10.3 tests

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
--source include/have_innodb.inc
22
--source include/have_partition.inc
33

4+
--echo #
5+
--echo # MDEV-26077 Assertion failure err != DB_DUPLICATE_KEY
6+
--echo # or unexpected ER_TABLE_EXISTS_ERROR
7+
--echo #
8+
9+
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB;
10+
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
11+
12+
--connect (con1,localhost,root,,test)
13+
14+
START TRANSACTION;
15+
INSERT INTO t2 (pk) VALUES (1);
16+
SAVEPOINT sp;
17+
INSERT INTO t1 (pk) VALUES (1);
18+
ROLLBACK TO SAVEPOINT sp;
19+
20+
--connection default
21+
SET lock_wait_timeout=0;
22+
SET innodb_lock_wait_timeout=0;
23+
--error ER_LOCK_WAIT_TIMEOUT
24+
ALTER TABLE t1 PARTITION BY HASH(pk);
25+
26+
SHOW CREATE TABLE t1;
27+
--connection con1
28+
COMMIT;
29+
--connection default
30+
ALTER TABLE t2 PARTITION BY HASH(pk);
31+
# Cleanup
32+
--disconnect con1
33+
--connection default
34+
DROP TABLE t1, t2;
35+
36+
--echo # End of 10.2 tests
37+
438
CREATE TABLE t1(a INT, b VARCHAR(10), INDEX(a))ENGINE=InnoDB
539
PARTITION BY RANGE(a)
640
(PARTITION pa VALUES LESS THAN (3),
@@ -13,3 +47,5 @@ PARTITION BY RANGE(a)
1347
PARTITION pb VALUES LESS THAN (4));
1448

1549
DROP TABLE t1;
50+
51+
--echo # End of 10.3 tests

sql/transaction.cc

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2009, 2021, MariaDB Corporation.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -701,32 +702,6 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_CSTRING name)
701702
if (WSREP_ON)
702703
wsrep_register_hton(thd, thd->in_multi_stmt_transaction_mode());
703704

704-
/**
705-
Checking whether it is safe to release metadata locks acquired after
706-
savepoint, if rollback to savepoint is successful.
707-
708-
Whether it is safe to release MDL after rollback to savepoint depends
709-
on storage engines participating in transaction:
710-
711-
- InnoDB doesn't release any row-locks on rollback to savepoint so it
712-
is probably a bad idea to release MDL as well.
713-
- Binary log implementation in some cases (e.g when non-transactional
714-
tables involved) may choose not to remove events added after savepoint
715-
from transactional cache, but instead will write them to binary
716-
log accompanied with ROLLBACK TO SAVEPOINT statement. Since the real
717-
write happens at the end of transaction releasing MDL on tables
718-
mentioned in these events (i.e. acquired after savepoint and before
719-
rollback ot it) can break replication, as concurrent DROP TABLES
720-
statements will be able to drop these tables before events will get
721-
into binary log,
722-
723-
For backward-compatibility reasons we always release MDL if binary
724-
logging is off.
725-
*/
726-
bool mdl_can_safely_rollback_to_savepoint=
727-
(!(mysql_bin_log.is_open() && thd->variables.sql_log_bin) ||
728-
ha_rollback_to_savepoint_can_release_mdl(thd));
729-
730705
if (ha_rollback_to_savepoint(thd, sv))
731706
res= TRUE;
732707
else if (((thd->variables.option_bits & OPTION_KEEP_LOG) ||
@@ -738,7 +713,14 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_CSTRING name)
738713

739714
thd->transaction.savepoints= sv;
740715

741-
if (!res && mdl_can_safely_rollback_to_savepoint)
716+
if (res)
717+
/* An error occurred during rollback; we cannot release any MDL */;
718+
else if (thd->variables.sql_log_bin && mysql_bin_log.is_open())
719+
/* In some cases (such as with non-transactional tables) we may
720+
choose to preserve events that were added after the SAVEPOINT,
721+
delimiting them by SAVEPOINT and ROLLBACK TO SAVEPOINT statements.
722+
Prematurely releasing MDL on such objects would break replication. */;
723+
else if (ha_rollback_to_savepoint_can_release_mdl(thd))
742724
thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint);
743725

744726
DBUG_RETURN(MY_TEST(res));

0 commit comments

Comments
 (0)