1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-06 05:21:19 +03:00

MDEV-7374 : Losing connection to MySQL while running ALTER TABLE

Backport from 10.1.
This commit is contained in:
Nirbhay Choubey 2015-01-24 18:39:21 -05:00
parent bb93d46241
commit fffc9f585d
5 changed files with 75 additions and 46 deletions

View File

@ -0,0 +1,8 @@
#
# MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
#
CREATE TABLE t1(i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e;
ALTER TABLE t1 MODIFY i FLOAT;
DROP TABLE t1;

View File

@ -0,0 +1 @@
--wsrep-on=0

View File

@ -0,0 +1,10 @@
--source include/have_innodb.inc
--echo #
--echo # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
--echo #
CREATE TABLE t1(i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e;
ALTER TABLE t1 MODIFY i FLOAT;
DROP TABLE t1;

View File

@ -5747,6 +5747,7 @@ no_commit:
; ;
} else if (src_table == prebuilt->table) { } else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on(user_thd)) {
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{ {
case WSREP_TRX_OK: case WSREP_TRX_OK:
@ -5760,6 +5761,7 @@ no_commit:
if (binlog_hton->commit(binlog_hton, user_thd, 1)) if (binlog_hton->commit(binlog_hton, user_thd, 1))
DBUG_RETURN(1); DBUG_RETURN(1);
wsrep_post_commit(user_thd, TRUE); wsrep_post_commit(user_thd, TRUE);
}
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* Source table is not in InnoDB format: /* Source table is not in InnoDB format:
no need to re-acquire locks on it. */ no need to re-acquire locks on it. */
@ -5772,6 +5774,7 @@ no_commit:
prebuilt->sql_stat_start = TRUE; prebuilt->sql_stat_start = TRUE;
} else { } else {
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on(user_thd)) {
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{ {
case WSREP_TRX_OK: case WSREP_TRX_OK:
@ -5781,9 +5784,11 @@ no_commit:
case WSREP_TRX_ERROR: case WSREP_TRX_ERROR:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (binlog_hton->commit(binlog_hton, user_thd, 1)) if (binlog_hton->commit(binlog_hton, user_thd, 1))
DBUG_RETURN(1); DBUG_RETURN(1);
wsrep_post_commit(user_thd, TRUE); wsrep_post_commit(user_thd, TRUE);
}
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* Ensure that there are no other table locks than /* Ensure that there are no other table locks than
LOCK_IX and LOCK_AUTO_INC on the destination table. */ LOCK_IX and LOCK_AUTO_INC on the destination table. */

View File

@ -6711,6 +6711,7 @@ no_commit:
; ;
} else if (src_table == prebuilt->table) { } else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on(user_thd)) {
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{ {
case WSREP_TRX_OK: case WSREP_TRX_OK:
@ -6724,6 +6725,7 @@ no_commit:
if (binlog_hton->commit(binlog_hton, user_thd, 1)) if (binlog_hton->commit(binlog_hton, user_thd, 1))
DBUG_RETURN(1); DBUG_RETURN(1);
wsrep_post_commit(user_thd, TRUE); wsrep_post_commit(user_thd, TRUE);
}
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* Source table is not in InnoDB format: /* Source table is not in InnoDB format:
no need to re-acquire locks on it. */ no need to re-acquire locks on it. */
@ -6736,6 +6738,7 @@ no_commit:
prebuilt->sql_stat_start = TRUE; prebuilt->sql_stat_start = TRUE;
} else { } else {
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on(user_thd)) {
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{ {
case WSREP_TRX_OK: case WSREP_TRX_OK:
@ -6745,9 +6748,11 @@ no_commit:
case WSREP_TRX_ERROR: case WSREP_TRX_ERROR:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (binlog_hton->commit(binlog_hton, user_thd, 1)) if (binlog_hton->commit(binlog_hton, user_thd, 1))
DBUG_RETURN(1); DBUG_RETURN(1);
wsrep_post_commit(user_thd, TRUE); wsrep_post_commit(user_thd, TRUE);
}
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* Ensure that there are no other table locks than /* Ensure that there are no other table locks than
LOCK_IX and LOCK_AUTO_INC on the destination table. */ LOCK_IX and LOCK_AUTO_INC on the destination table. */