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
672590af
Commit
672590af
authored
Sep 08, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust the imported innodb.alter_crash test for MariaDB
trx_undo_assign_undo(): Restore the fault injection.
parent
13d4dfd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
25 deletions
+33
-25
mysql-test/suite/innodb/r/alter_crash.result
mysql-test/suite/innodb/r/alter_crash.result
+13
-15
mysql-test/suite/innodb/t/alter_crash.opt
mysql-test/suite/innodb/t/alter_crash.opt
+1
-0
mysql-test/suite/innodb/t/alter_crash.test
mysql-test/suite/innodb/t/alter_crash.test
+13
-10
storage/innobase/trx/trx0undo.cc
storage/innobase/trx/trx0undo.cc
+6
-0
No files found.
mysql-test/suite/innodb/r/alter_crash.result
View file @
672590af
...
...
@@ -2,18 +2,18 @@
# Bug#20015132 ALTER TABLE FAILS TO CHECK IF TABLE IS CORRUPTED
#
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB;
SET DEBUG='+d,ib_create_table_fail_too_many_trx';
SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_create_table_fail_too_many_trx';
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
ERROR HY000: Too many active concurrent transactions
SET DEBUG
='-d,ib_create_table_fail_too_many_trx'
;
SET DEBUG
_DBUG=@saved_debug_dbug
;
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
SET DEBUG='+d,dict_set_index_corrupted';
SET DEBUG
_DBUG
='+d,dict_set_index_corrupted';
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB:
The B-tree of index c2 is corrupted.
test.t1 check Warning InnoDB:
The B-tree of index c3 is corrupted.
test.t1 check Warning InnoDB:
Index c2 is marked as corrupted
test.t1 check Warning InnoDB:
Index c3 is marked as corrupted
test.t1 check error Corrupt
# restart
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index c2 is marked as corrupted
...
...
@@ -25,7 +25,7 @@ Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
test.t1 check error Corrupt
ALTER TABLE t1 ADD INDEX (c2,c3);
ERROR
42000: Can't open table
ERROR
HY000: Index c3 is corrupted
ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL;
CHECK TABLE t1;
Table Op Msg_type Msg_text
...
...
@@ -40,11 +40,10 @@ DROP TABLE t1;
# just after committing the dictionary changes.
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
INSERT INTO t1 VALUES (1,2),(3,4);
SET DEBUG
='
d,innodb_alter_commit_crash_after_commit';
SET DEBUG
_DBUG='+
d,innodb_alter_commit_crash_after_commit';
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
ERROR HY000: Lost connection to MySQL server during query
# Restart mysqld after the crash and reconnect.
# restart
# Manual *.frm recovery begin.
# Manual recovery end
FLUSH TABLES;
...
...
@@ -80,11 +79,10 @@ DROP TABLE t1;
# is not committed, the renames will not be replayed.
CREATE TABLE t2 (f1 int not null, f2 int not null) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,2),(3,4);
SET DEBUG
='
d,innodb_alter_commit_crash_before_commit';
SET DEBUG
_DBUG='+
d,innodb_alter_commit_crash_before_commit';
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
ERROR HY000: Lost connection to MySQL server during query
# Startup the server after the crash
# restart
# Read and remember the temporary table name
# Manual *.frm recovery begin. The dictionary was not updated
# and the files were not renamed. The rebuilt table
...
...
@@ -118,13 +116,13 @@ DROP TABLE t2;
# Bug#19330255 WL#7142 - CRASH DURING ALTER TABLE LEADS TO
# DATA DICTIONARY INCONSISTENCY
#
CREATE TABLE t1(a int PRIMARY KEY, b varchar(255), c int NOT NULL);
CREATE TABLE t1(a int PRIMARY KEY, b varchar(255), c int NOT NULL)
ENGINE=InnoDB;
INSERT INTO t1 SET a=1,c=2;
SET DEBUG
='
d,innodb_alter_commit_crash_after_commit';
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int;
SET DEBUG
_DBUG='+
d,innodb_alter_commit_crash_after_commit';
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int
, ALGORITHM=INPLACE
;
ERROR HY000: Lost connection to MySQL server during query
# Restart mysqld after the crash and reconnect.
# restart
# Manual *.frm recovery begin.
# Manual recovery end
FLUSH TABLES;
...
...
mysql-test/suite/innodb/t/alter_crash.opt
0 → 100644
View file @
672590af
--loose-innodb-sys-tables
mysql-test/suite/innodb/t/alter_crash.test
View file @
672590af
...
...
@@ -18,14 +18,15 @@ call mtr.add_suppression('InnoDB: Index `c[23]` .*is corrupted');
--
echo
#
CREATE
TABLE
t1
(
c1
INT
PRIMARY
KEY
,
c2
CHAR
(
1
),
c3
INT
UNSIGNED
)
ENGINE
=
InnoDB
;
SET
DEBUG
=
'+d,ib_create_table_fail_too_many_trx'
;
SET
@
saved_debug_dbug
=
@@
SESSION
.
debug_dbug
;
SET
DEBUG_DBUG
=
'+d,ib_create_table_fail_too_many_trx'
;
--
error
ER_TOO_MANY_CONCURRENT_TRXS
ALTER
TABLE
t1
ADD
INDEX
(
c2
),
ADD
INDEX
(
c3
);
SET
DEBUG
=
'-d,ib_create_table_fail_too_many_trx'
;
SET
DEBUG
_DBUG
=@
saved_debug_dbug
;
ALTER
TABLE
t1
ADD
INDEX
(
c2
),
ADD
INDEX
(
c3
);
# Flag the secondary indexes corrupted.
SET
DEBUG
=
'+d,dict_set_index_corrupted'
;
SET
DEBUG
_DBUG
=
'+d,dict_set_index_corrupted'
;
CHECK
TABLE
t1
;
# Ensure that the corruption is permanent.
...
...
@@ -35,7 +36,7 @@ ALTER TABLE t1 DROP INDEX c2;
CHECK
TABLE
t1
;
# We refuse an ALTER TABLE that would modify the InnoDB data dictionary
# while leaving some of the table corrupted.
--
error
ER_
CHECK_NO_SUCH_TABLE
--
error
ER_
INDEX_CORRUPT
ALTER
TABLE
t1
ADD
INDEX
(
c2
,
c3
);
# This will rebuild the table, uncorrupting all secondary indexes.
ALTER
TABLE
t1
CHANGE
c3
c3
INT
NOT
NULL
;
...
...
@@ -59,7 +60,7 @@ let datadir= `select @@datadir`;
CREATE
TABLE
t1
(
f1
INT
NOT
NULL
,
f2
INT
NOT
NULL
)
ENGINE
=
innodb
;
INSERT
INTO
t1
VALUES
(
1
,
2
),(
3
,
4
);
SET
DEBUG
=
'
d,innodb_alter_commit_crash_after_commit'
;
SET
DEBUG
_DBUG
=
'+
d,innodb_alter_commit_crash_after_commit'
;
let
$orig_table_id
=
`SELECT table_id
FROM information_schema.innodb_sys_tables
...
...
@@ -118,7 +119,7 @@ DROP TABLE t1;
CREATE
TABLE
t2
(
f1
int
not
null
,
f2
int
not
null
)
ENGINE
=
InnoDB
;
INSERT
INTO
t2
VALUES
(
1
,
2
),(
3
,
4
);
SET
DEBUG
=
'
d,innodb_alter_commit_crash_before_commit'
;
SET
DEBUG
_DBUG
=
'+
d,innodb_alter_commit_crash_before_commit'
;
let
$orig_table_id
=
`SELECT table_id
FROM information_schema.innodb_sys_tables
...
...
@@ -177,18 +178,20 @@ DROP TABLE t2;
--
echo
# DATA DICTIONARY INCONSISTENCY
--
echo
#
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
,
b
varchar
(
255
),
c
int
NOT
NULL
);
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
,
b
varchar
(
255
),
c
int
NOT
NULL
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
SET
a
=
1
,
c
=
2
;
SET
DEBUG
=
'
d,innodb_alter_commit_crash_after_commit'
;
SET
DEBUG
_DBUG
=
'+
d,innodb_alter_commit_crash_after_commit'
;
let
$orig_table_id
=
`select table_id from
information_schema.innodb_sys_tables where name = 'test/t1'`
;
# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE
# Write file to make mysql-test-run.pl expect crash
--
exec
echo
"restart"
>
$MYSQLTEST_VARDIR
/
tmp
/
mysqld
.
1.
expect
#
--
error
2013
ALTER
TABLE
t1
ADD
INDEX
(
b
),
CHANGE
c
d
int
;
ALTER
TABLE
t1
ADD
INDEX
(
b
),
CHANGE
c
d
int
,
ALGORITHM
=
INPLACE
;
--
echo
# Restart mysqld after the crash and reconnect.
--
source
include
/
start_mysqld
.
inc
...
...
storage/innobase/trx/trx0undo.cc
View file @
672590af
...
...
@@ -1687,6 +1687,12 @@ trx_undo_assign_undo(
mutex_enter
(
&
rseg
->
mutex
);
DBUG_EXECUTE_IF
(
"ib_create_table_fail_too_many_trx"
,
err
=
DB_TOO_MANY_CONCURRENT_TRXS
;
goto
func_exit
;
);
*
undo
=
trx_undo_reuse_cached
(
trx
,
rseg
,
type
,
trx
->
id
,
trx
->
xid
,
&
mtr
);
if
(
*
undo
==
NULL
)
{
...
...
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