Commit a441b064 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.1 into 10.2

parents 84261653 83a520db
...@@ -406,6 +406,20 @@ Opened_table_definitions 2 ...@@ -406,6 +406,20 @@ Opened_table_definitions 2
Opened_tables 2 Opened_tables 2
drop function foo; drop function foo;
drop table t2, t1; drop table t2, t1;
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB;
XA START 'xid';
INSERT INTO t1 VALUES (1,2);
CREATE TABLE x AS SELECT * FROM t1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
connect con1,localhost,root,,test;
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
XA END 'xid';
XA ROLLBACK 'xid';
DROP TABLE t1;
# Start of 10.2 tests # Start of 10.2 tests
# #
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint # MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
......
...@@ -407,6 +407,20 @@ show status like '%opened_tab%'; ...@@ -407,6 +407,20 @@ show status like '%opened_tab%';
drop function foo; drop function foo;
drop table t2, t1; drop table t2, t1;
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB;
XA START 'xid';
INSERT INTO t1 VALUES (1,2);
--error ER_XAER_RMFAIL
CREATE TABLE x AS SELECT * FROM t1;
--connect (con1,localhost,root,,test)
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;# Cleanup
--disconnect con1
--connection default
XA END 'xid';
XA ROLLBACK 'xid';
DROP TABLE t1;
# #
# End of 10.1 tests # End of 10.1 tests
# #
......
...@@ -5148,6 +5148,12 @@ prepare_inplace_alter_table_dict( ...@@ -5148,6 +5148,12 @@ prepare_inplace_alter_table_dict(
trx_free_for_mysql(ctx->trx); trx_free_for_mysql(ctx->trx);
trx_commit_for_mysql(ctx->prebuilt->trx); trx_commit_for_mysql(ctx->prebuilt->trx);
for (uint i = 0; i < ctx->num_to_add_fk; i++) {
if (ctx->add_fk[i]) {
dict_foreign_free(ctx->add_fk[i]);
}
}
delete ctx; delete ctx;
ha_alter_info->handler_ctx = NULL; ha_alter_info->handler_ctx = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -577,12 +577,6 @@ struct rw_lock_t ...@@ -577,12 +577,6 @@ struct rw_lock_t
/** number of granted SX locks. */ /** number of granted SX locks. */
volatile ulint sx_recursive; volatile ulint sx_recursive;
/** This is TRUE if the writer field is RW_LOCK_X_WAIT; this field
is located far from the memory update hotspot fields which are at
the start of this struct, thus we can peek this field without
causing much memory bus traffic */
bool writer_is_wait_ex;
/** The value is typically set to thread id of a writer thread making /** The value is typically set to thread id of a writer thread making
normal rw_locks recursive. In case of asynchronous IO, when a non-zero normal rw_locks recursive. In case of asynchronous IO, when a non-zero
value of 'pass' is passed then we keep the lock non-recursive. value of 'pass' is passed then we keep the lock non-recursive.
......
...@@ -3388,6 +3388,12 @@ prepare_inplace_alter_table_dict( ...@@ -3388,6 +3388,12 @@ prepare_inplace_alter_table_dict(
trx_free_for_mysql(ctx->trx); trx_free_for_mysql(ctx->trx);
trx_commit_for_mysql(ctx->prebuilt->trx); trx_commit_for_mysql(ctx->prebuilt->trx);
for (uint i = 0; i < ctx->num_to_add_fk; i++) {
if (ctx->add_fk[i]) {
dict_foreign_free(ctx->add_fk[i]);
}
}
delete ctx; delete ctx;
ha_alter_info->handler_ctx = NULL; ha_alter_info->handler_ctx = NULL;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -763,13 +764,6 @@ struct rw_lock_t { ...@@ -763,13 +764,6 @@ struct rw_lock_t {
/* last s-lock file/line is not guaranteed to be correct */ /* last s-lock file/line is not guaranteed to be correct */
const char* last_s_file_name;/*!< File name where last s-locked */ const char* last_s_file_name;/*!< File name where last s-locked */
const char* last_x_file_name;/*!< File name where last x-locked */ const char* last_x_file_name;/*!< File name where last x-locked */
ibool writer_is_wait_ex;
/*!< This is TRUE if the writer field is
RW_LOCK_WAIT_EX; this field is located far
from the memory update hotspot fields which
are at the start of this struct, thus we can
peek this field without causing much memory
bus traffic */
unsigned cline:14; /*!< Line where created */ unsigned cline:14; /*!< Line where created */
unsigned last_s_line:14; /*!< Line number where last time s-locked */ unsigned last_s_line:14; /*!< Line number where last time s-locked */
unsigned last_x_line:14; /*!< Line number where last time x-locked */ unsigned last_x_line:14; /*!< Line number where last time x-locked */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment