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
4a2ad0ce
Commit
4a2ad0ce
authored
Oct 05, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Demonstrate what gets stored in the data files
parent
1fff8df9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
4 deletions
+88
-4
mysql-test/suite/innodb/r/instant_alter_crash.result
mysql-test/suite/innodb/r/instant_alter_crash.result
+35
-3
mysql-test/suite/innodb/t/instant_alter_crash.test
mysql-test/suite/innodb/t/instant_alter_crash.test
+53
-1
No files found.
mysql-test/suite/innodb/r/instant_alter_crash.result
View file @
4a2ad0ce
#
# MDEV-11369: Instant ADD COLUMN for InnoDB
#
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB;
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES(1,2);
BEGIN;
...
...
@@ -27,6 +28,7 @@ BEGIN;
DELETE FROM t1;
ROLLBACK;
InnoDB 0 transactions not purged
INSERT INTO t2 VALUES (64,42,'De finibus bonorum'), (347,33101,' et malorum');
connect ddl, localhost, root;
SET DEBUG_SYNC='innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever';
ALTER TABLE t2 ADD COLUMN (c4 TEXT NOT NULL DEFAULT ' et malorum');
...
...
@@ -43,11 +45,41 @@ id c2
SELECT * FROM t2;
id c2 c3
2 1 De finibus bonorum
64 42 De finibus bonorum
347 33101 et malorum
BEGIN;
INSERT INTO t1 SET id=1;
DELETE FROM t2;
ROLLBACK;
InnoDB 0 transactions not purged
FLUSH TABLE t1,t2 FOR EXPORT;
t1 clustered index root page(type 17855):
N_RECS=0; LEVEL=0
header=0x010000030074 (id=0x696e66696d756d00)
header=0x010008030000 (id=0x73757072656d756d00)
t2 clustered index root page(type 18):
N_RECS=4; LEVEL=0
header=0x010000030123 (id=0x696e66696d756d00)
header=0x1000300b0087 (id=0x80000000,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=NULL(4 bytes),
c3=0x44652066696e6962757320626f6e6f72756d)
header=0x0000100900d8 (id=0x80000002,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x80000001)
header=0x0000200900f8 (id=0x80000040,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x8000002a)
header=0x0000280b0074 (id=0x8000015b,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x8000814d,
c3=0x206574206d616c6f72756d)
header=0x050008030000 (id=0x73757072656d756d00)
UNLOCK TABLES;
DELETE FROM t2;
InnoDB 0 transactions not purged
SHOW CREATE TABLE t1;
...
...
@@ -57,7 +89,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `c2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=REDUNDANT
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
...
...
@@ -66,6 +98,6 @@ t2 CREATE TABLE `t2` (
`c3` text NOT NULL DEFAULT 'De finibus bonorum',
PRIMARY KEY (`id`),
UNIQUE KEY `c2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=REDUNDANT
DROP TABLE t1,t2;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@saved_frequency;
mysql-test/suite/innodb/t/instant_alter_crash.test
View file @
4a2ad0ce
...
...
@@ -4,11 +4,15 @@
--
source
include
/
have_debug
.
inc
--
source
include
/
have_debug_sync
.
inc
let
INNODB_PAGE_SIZE
=
`select @@innodb_page_size`
;
let
MYSQLD_DATADIR
=
`select @@datadir`
;
--
echo
#
--
echo
# MDEV-11369: Instant ADD COLUMN for InnoDB
--
echo
#
CREATE
TABLE
t1
(
id
INT
PRIMARY
KEY
,
c2
INT
UNIQUE
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t1
(
id
INT
PRIMARY
KEY
,
c2
INT
UNIQUE
)
ENGINE
=
InnoDB
ROW_FORMAT
=
REDUNDANT
;
CREATE
TABLE
t2
LIKE
t1
;
INSERT
INTO
t1
VALUES
(
1
,
2
);
BEGIN
;
...
...
@@ -37,6 +41,8 @@ DELETE FROM t1;
ROLLBACK
;
--
source
include
/
wait_all_purged
.
inc
INSERT
INTO
t2
VALUES
(
64
,
42
,
'De finibus bonorum'
),
(
347
,
33101
,
' et malorum'
);
connect
ddl
,
localhost
,
root
;
SET
DEBUG_SYNC
=
'innodb_alter_inplace_before_commit SIGNAL ddl WAIT_FOR ever'
;
--
send
...
...
@@ -61,6 +67,52 @@ INSERT INTO t1 SET id=1;
DELETE
FROM
t2
;
ROLLBACK
;
--
source
include
/
wait_all_purged
.
inc
FLUSH
TABLE
t1
,
t2
FOR
EXPORT
;
# At this point, t1 is empty and t2 contains a 'default row'.
# The following is based on innodb.table_flags and innodb.dml_purge:
--
perl
use
strict
;
my
$ps
=
$ENV
{
INNODB_PAGE_SIZE
};
foreach
my
$table
(
't1'
,
't2'
)
{
my
$file
=
"
$ENV
{
MYSQLD_DATADIR
}
/test/
$table
.ibd"
;
open
(
FILE
,
"<"
,
$file
)
||
die
"Unable to open
$file
\n
"
;
my
$page
;
sysseek
(
FILE
,
3
*
$ps
,
0
)
||
die
"Unable to seek
$file
"
;
die
"Unable to read
$file
"
unless
sysread
(
FILE
,
$page
,
$ps
)
==
$ps
;
print
"
$table
clustered index root page"
;
print
"(type "
,
unpack
(
"n"
,
substr
(
$page
,
24
,
2
)),
"):
\n
"
;
print
"N_RECS="
,
unpack
(
"n"
,
substr
(
$page
,
38
+
16
,
2
));
print
"; LEVEL="
,
unpack
(
"n"
,
substr
(
$page
,
38
+
26
,
2
)),
"
\n
"
;
my
@
fields
=
(
"id"
,
"DB_TRX_ID"
,
"DB_ROLL_PTR"
,
"c2"
,
"c3"
,
"c4"
);
for
(
my
$offset
=
0x65
;
$offset
;
$offset
=
unpack
(
"n"
,
substr
(
$page
,
$offset
-
2
,
2
)))
{
print
"header=0x"
,
unpack
(
"H*"
,
substr
(
$page
,
$offset
-
6
,
6
)),
" ("
;
my
$n_fields
=
unpack
(
"n"
,
substr
(
$page
,
$offset
-
4
,
2
))
>>
1
&
0x3ff
;
my
$start
=
0
;
my
$name
;
for
(
my
$i
=
0
;
$i
<
$n_fields
;
$i
++
)
{
my
$end
=
unpack
(
"C"
,
substr
(
$page
,
$offset
-
7
-
$i
,
1
));
print
",
\n
"
if
$i
;
print
"
$fields[$i]
="
;
if
(
$end
&
0x80
)
{
print
"NULL("
,
(
$end
&
0x7f
)
-
$start
,
" bytes)"
}
else
{
print
"0x"
,
unpack
(
"H*"
,
substr
(
$page
,
$offset
+
$start
,
$end
-
$start
))
}
$start
=
$end
&
0x7f
;
}
print
")
\n
"
;
}
close
(
FILE
)
||
die
"Unable to close
$file
\n
"
;
}
EOF
UNLOCK
TABLES
;
DELETE
FROM
t2
;
--
source
include
/
wait_all_purged
.
inc
...
...
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