Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0db66ab1
Commit
0db66ab1
authored
May 07, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.0 into 10.1
parents
b4e8ad50
7b9486d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
46 deletions
+104
-46
mysql-test/suite/innodb/r/alter_partitioned_xa.result
mysql-test/suite/innodb/r/alter_partitioned_xa.result
+15
-0
mysql-test/suite/innodb/t/alter_partitioned_xa.test
mysql-test/suite/innodb/t/alter_partitioned_xa.test
+31
-0
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+29
-23
storage/xtradb/handler/handler0alter.cc
storage/xtradb/handler/handler0alter.cc
+29
-23
No files found.
mysql-test/suite/innodb/r/alter_partitioned_xa.result
0 → 100644
View file @
0db66ab1
#
# MDEV-14693 XA: Assertion `!clust_index->online_log' failed
# in rollback_inplace_alter_table
#
CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2;
XA START 'xid';
INSERT INTO t1 VALUES (1,10);
CREATE DATABASE IF NOT EXISTS db;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
SET innodb_lock_wait_timeout= 1, lock_wait_timeout= 2;
ALTER TABLE t1 FORCE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
XA END 'xid';
XA ROLLBACK 'xid';
DROP TABLE t1;
mysql-test/suite/innodb/t/alter_partitioned_xa.test
0 → 100644
View file @
0db66ab1
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_partition
.
inc
--
echo
#
--
echo
# MDEV-14693 XA: Assertion `!clust_index->online_log' failed
--
echo
# in rollback_inplace_alter_table
--
echo
#
# A bug in meta-data locking (MDL) for XA transactions causes
# a bug in InnoDB error handling for ALTER TABLE to be triggered.
CREATE
TABLE
t1
(
a
INT
,
b
INT
)
ENGINE
=
InnoDB
PARTITION
BY
HASH
(
a
)
PARTITIONS
2
;
XA
START
'xid'
;
INSERT
INTO
t1
VALUES
(
1
,
10
);
# XA bug: The following releases the MDL on t1!
--
error
ER_XAER_RMFAIL
CREATE
DATABASE
IF
NOT
EXISTS
db
;
--
connect
(
con1
,
localhost
,
root
,,
test
)
SET
innodb_lock_wait_timeout
=
1
,
lock_wait_timeout
=
2
;
# Here, innodb_lock_wait_timeout would be exceeded, causing the operation
# to roll back when InnoDB is attempting to commit.
# (Instead, lock_wait_timeout should be exceeded!)
--
error
ER_LOCK_WAIT_TIMEOUT
ALTER
TABLE
t1
FORCE
;
# Cleanup
--
disconnect
con1
--
connection
default
XA
END
'xid'
;
XA
ROLLBACK
'xid'
;
DROP
TABLE
t1
;
storage/innobase/handler/handler0alter.cc
View file @
0db66ab1
...
...
@@ -4413,12 +4413,16 @@ rollback_inplace_alter_table(
row_mysql_lock_data_dictionary
(
ctx
->
trx
);
if
(
ctx
->
need_rebuild
())
{
dberr_t
err
;
ulint
flags
=
ctx
->
new_table
->
flags
;
/* DML threads can access ctx->new_table via the
online rebuild log. Free it first. */
innobase_online_rebuild_log_free
(
prebuilt
->
table
);
}
if
(
!
ctx
->
new_table
)
{
ut_ad
(
ctx
->
need_rebuild
());
}
else
if
(
ctx
->
need_rebuild
())
{
dberr_t
err
;
ulint
flags
=
ctx
->
new_table
->
flags
;
/* Since the FTS index specific auxiliary tables has
not yet registered with "table->fts" by fts_add_index(),
...
...
@@ -5786,21 +5790,6 @@ ha_innobase::commit_inplace_alter_table(
ut_ad
(
prebuilt
->
table
==
ctx0
->
old_table
);
ha_alter_info
->
group_commit_ctx
=
NULL
;
/* Free the ctx->trx of other partitions, if any. We will only
use the ctx0->trx here. Others may have been allocated in
the prepare stage. */
for
(
inplace_alter_handler_ctx
**
pctx
=
&
ctx_array
[
1
];
*
pctx
;
pctx
++
)
{
ha_innobase_inplace_ctx
*
ctx
=
static_cast
<
ha_innobase_inplace_ctx
*>
(
*
pctx
);
if
(
ctx
->
trx
)
{
trx_free_for_mysql
(
ctx
->
trx
);
ctx
->
trx
=
NULL
;
}
}
trx_start_if_not_started_xa
(
prebuilt
->
trx
);
for
(
inplace_alter_handler_ctx
**
pctx
=
ctx_array
;
*
pctx
;
pctx
++
)
{
...
...
@@ -6186,10 +6175,6 @@ ha_innobase::commit_inplace_alter_table(
covering all partitions. */
share
->
idx_trans_tbl
.
index_count
=
0
;
if
(
trx
==
ctx0
->
trx
)
{
ctx0
->
trx
=
NULL
;
}
/* Tell the InnoDB server that there might be work for
utility threads: */
...
...
@@ -6212,10 +6197,31 @@ ha_innobase::commit_inplace_alter_table(
}
row_mysql_unlock_data_dictionary
(
trx
);
trx_free_for_mysql
(
trx
);
if
(
trx
!=
ctx0
->
trx
)
{
trx_free_for_mysql
(
trx
);
}
DBUG_RETURN
(
true
);
}
if
(
trx
==
ctx0
->
trx
)
{
ctx0
->
trx
=
NULL
;
}
/* Free the ctx->trx of other partitions, if any. We will only
use the ctx0->trx here. Others may have been allocated in
the prepare stage. */
for
(
inplace_alter_handler_ctx
**
pctx
=
&
ctx_array
[
1
];
*
pctx
;
pctx
++
)
{
ha_innobase_inplace_ctx
*
ctx
=
static_cast
<
ha_innobase_inplace_ctx
*>
(
*
pctx
);
if
(
ctx
->
trx
)
{
trx_free_for_mysql
(
ctx
->
trx
);
ctx
->
trx
=
NULL
;
}
}
/* Release the table locks. */
trx_commit_for_mysql
(
prebuilt
->
trx
);
...
...
storage/xtradb/handler/handler0alter.cc
View file @
0db66ab1
...
...
@@ -4429,12 +4429,16 @@ rollback_inplace_alter_table(
row_mysql_lock_data_dictionary
(
ctx
->
trx
);
if
(
ctx
->
need_rebuild
())
{
dberr_t
err
;
ulint
flags
=
ctx
->
new_table
->
flags
;
/* DML threads can access ctx->new_table via the
online rebuild log. Free it first. */
innobase_online_rebuild_log_free
(
prebuilt
->
table
);
}
if
(
!
ctx
->
new_table
)
{
ut_ad
(
ctx
->
need_rebuild
());
}
else
if
(
ctx
->
need_rebuild
())
{
dberr_t
err
;
ulint
flags
=
ctx
->
new_table
->
flags
;
/* Since the FTS index specific auxiliary tables has
not yet registered with "table->fts" by fts_add_index(),
...
...
@@ -5796,21 +5800,6 @@ ha_innobase::commit_inplace_alter_table(
ut_ad
(
prebuilt
->
table
==
ctx0
->
old_table
);
ha_alter_info
->
group_commit_ctx
=
NULL
;
/* Free the ctx->trx of other partitions, if any. We will only
use the ctx0->trx here. Others may have been allocated in
the prepare stage. */
for
(
inplace_alter_handler_ctx
**
pctx
=
&
ctx_array
[
1
];
*
pctx
;
pctx
++
)
{
ha_innobase_inplace_ctx
*
ctx
=
static_cast
<
ha_innobase_inplace_ctx
*>
(
*
pctx
);
if
(
ctx
->
trx
)
{
trx_free_for_mysql
(
ctx
->
trx
);
ctx
->
trx
=
NULL
;
}
}
trx_start_if_not_started_xa
(
prebuilt
->
trx
);
for
(
inplace_alter_handler_ctx
**
pctx
=
ctx_array
;
*
pctx
;
pctx
++
)
{
...
...
@@ -6189,10 +6178,6 @@ ha_innobase::commit_inplace_alter_table(
covering all partitions. */
share
->
idx_trans_tbl
.
index_count
=
0
;
if
(
trx
==
ctx0
->
trx
)
{
ctx0
->
trx
=
NULL
;
}
/* Tell the InnoDB server that there might be work for
utility threads: */
...
...
@@ -6215,10 +6200,31 @@ ha_innobase::commit_inplace_alter_table(
}
row_mysql_unlock_data_dictionary
(
trx
);
trx_free_for_mysql
(
trx
);
if
(
trx
!=
ctx0
->
trx
)
{
trx_free_for_mysql
(
trx
);
}
DBUG_RETURN
(
true
);
}
if
(
trx
==
ctx0
->
trx
)
{
ctx0
->
trx
=
NULL
;
}
/* Free the ctx->trx of other partitions, if any. We will only
use the ctx0->trx here. Others may have been allocated in
the prepare stage. */
for
(
inplace_alter_handler_ctx
**
pctx
=
&
ctx_array
[
1
];
*
pctx
;
pctx
++
)
{
ha_innobase_inplace_ctx
*
ctx
=
static_cast
<
ha_innobase_inplace_ctx
*>
(
*
pctx
);
if
(
ctx
->
trx
)
{
trx_free_for_mysql
(
ctx
->
trx
);
ctx
->
trx
=
NULL
;
}
}
/* Release the table locks. */
trx_commit_for_mysql
(
prebuilt
->
trx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment