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
0b7c49e7
Commit
0b7c49e7
authored
Oct 05, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btr_index_rec_validate(): Account for instant ADD COLUMN
parent
4f1375e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
22 deletions
+31
-22
mysql-test/suite/innodb/r/instant_alter_inject.result
mysql-test/suite/innodb/r/instant_alter_inject.result
+8
-2
mysql-test/suite/innodb/t/instant_alter_inject.test
mysql-test/suite/innodb/t/instant_alter_inject.test
+3
-1
storage/innobase/btr/btr0btr.cc
storage/innobase/btr/btr0btr.cc
+20
-19
No files found.
mysql-test/suite/innodb/r/instant_alter_inject.result
View file @
0b7c49e7
CREATE TABLE t1(a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB
CREATE TABLE t1(a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB
PARTITION BY KEY() PARTITIONS 3;
ROW_FORMAT=REDUNDANT
PARTITION BY KEY() PARTITIONS 3;
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5);
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5);
SET @saved_dbug= @@SESSION.debug_dbug;
SET @saved_dbug= @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_commit_inplace_fail_2';
SET DEBUG_DBUG='+d,ib_commit_inplace_fail_2';
ALTER TABLE t1 ADD COLUMN c CHAR(3) DEFAULT 'lie';
ALTER TABLE t1 ADD COLUMN c CHAR(3) DEFAULT 'lie';
ERROR HY000: Internal error: Injected error!
ERROR HY000: Internal error: Injected error!
SET DEBUG_DBUG= @saved_dbug;
SET DEBUG_DBUG= @saved_dbug;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
BEGIN;
BEGIN;
UPDATE t1 SET b=a+1;
UPDATE t1 SET b=a+1;
INSERT INTO t1 VALUES (0,1);
INSERT INTO t1 VALUES (0,1);
...
@@ -22,6 +25,9 @@ SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1';
...
@@ -22,6 +25,9 @@ SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1';
ALTER TABLE t1 ADD COLUMN d INT NOT NULL DEFAULT -42;
ALTER TABLE t1 ADD COLUMN d INT NOT NULL DEFAULT -42;
ERROR HY000: Internal error: Injected error!
ERROR HY000: Internal error: Injected error!
SET DEBUG_DBUG= @saved_dbug;
SET DEBUG_DBUG= @saved_dbug;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
BEGIN;
BEGIN;
DELETE FROM t1;
DELETE FROM t1;
INSERT INTO t1 VALUES (1,2,'foo');
INSERT INTO t1 VALUES (1,2,'foo');
...
@@ -34,7 +40,7 @@ t1 CREATE TABLE `t1` (
...
@@ -34,7 +40,7 @@ t1 CREATE TABLE `t1` (
`c` char(3) DEFAULT 'lie',
`c` char(3) DEFAULT 'lie',
PRIMARY KEY (`a`),
PRIMARY KEY (`a`),
KEY `b` (`b`)
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=REDUNDANT
PARTITION BY KEY ()
PARTITION BY KEY ()
PARTITIONS 3
PARTITIONS 3
DROP TABLE t1;
DROP TABLE t1;
mysql-test/suite/innodb/t/instant_alter_inject.test
View file @
0b7c49e7
...
@@ -3,13 +3,14 @@
...
@@ -3,13 +3,14 @@
--
source
include
/
have_partition
.
inc
--
source
include
/
have_partition
.
inc
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
,
b
INT
,
KEY
(
b
))
ENGINE
=
InnoDB
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
,
b
INT
,
KEY
(
b
))
ENGINE
=
InnoDB
PARTITION
BY
KEY
()
PARTITIONS
3
;
ROW_FORMAT
=
REDUNDANT
PARTITION
BY
KEY
()
PARTITIONS
3
;
INSERT
INTO
t1
(
a
)
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
);
INSERT
INTO
t1
(
a
)
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
);
SET
@
saved_dbug
=
@@
SESSION
.
debug_dbug
;
SET
@
saved_dbug
=
@@
SESSION
.
debug_dbug
;
SET
DEBUG_DBUG
=
'+d,ib_commit_inplace_fail_2'
;
SET
DEBUG_DBUG
=
'+d,ib_commit_inplace_fail_2'
;
--
error
ER_INTERNAL_ERROR
--
error
ER_INTERNAL_ERROR
ALTER
TABLE
t1
ADD
COLUMN
c
CHAR
(
3
)
DEFAULT
'lie'
;
ALTER
TABLE
t1
ADD
COLUMN
c
CHAR
(
3
)
DEFAULT
'lie'
;
SET
DEBUG_DBUG
=
@
saved_dbug
;
SET
DEBUG_DBUG
=
@
saved_dbug
;
CHECK
TABLE
t1
;
BEGIN
;
BEGIN
;
UPDATE
t1
SET
b
=
a
+
1
;
UPDATE
t1
SET
b
=
a
+
1
;
INSERT
INTO
t1
VALUES
(
0
,
1
);
INSERT
INTO
t1
VALUES
(
0
,
1
);
...
@@ -20,6 +21,7 @@ SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1';
...
@@ -20,6 +21,7 @@ SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1';
--
error
ER_INTERNAL_ERROR
--
error
ER_INTERNAL_ERROR
ALTER
TABLE
t1
ADD
COLUMN
d
INT
NOT
NULL
DEFAULT
-
42
;
ALTER
TABLE
t1
ADD
COLUMN
d
INT
NOT
NULL
DEFAULT
-
42
;
SET
DEBUG_DBUG
=
@
saved_dbug
;
SET
DEBUG_DBUG
=
@
saved_dbug
;
CHECK
TABLE
t1
;
BEGIN
;
BEGIN
;
DELETE
FROM
t1
;
DELETE
FROM
t1
;
INSERT
INTO
t1
VALUES
(
1
,
2
,
'foo'
);
INSERT
INTO
t1
VALUES
(
1
,
2
,
'foo'
);
...
...
storage/innobase/btr/btr0btr.cc
View file @
0b7c49e7
...
@@ -4659,8 +4659,6 @@ btr_index_rec_validate(
...
@@ -4659,8 +4659,6 @@ btr_index_rec_validate(
and page on error */
and page on error */
{
{
ulint
len
;
ulint
len
;
ulint
n
;
ulint
i
;
const
page_t
*
page
;
const
page_t
*
page
;
mem_heap_t
*
heap
=
NULL
;
mem_heap_t
*
heap
=
NULL
;
ulint
offsets_
[
REC_OFFS_NORMAL_SIZE
];
ulint
offsets_
[
REC_OFFS_NORMAL_SIZE
];
...
@@ -4691,31 +4689,34 @@ btr_index_rec_validate(
...
@@ -4691,31 +4689,34 @@ btr_index_rec_validate(
return
(
FALSE
);
return
(
FALSE
);
}
}
n
=
dict_index_get_n_fields
(
index
);
if
(
!
page_is_comp
(
page
))
{
const
ulint
n_rec_fields
=
rec_get_n_fields_old
(
rec
);
if
(
!
page_is_comp
(
page
)
if
(
n_rec_fields
==
DICT_FLD__SYS_INDEXES__MERGE_THRESHOLD
&&
(
rec_get_n_fields_old
(
rec
)
!=
n
&&
index
->
id
==
DICT_INDEXES_ID
)
{
/* a
record for older SYS_INDEXES table
/* A
record for older SYS_INDEXES table
(missing merge_threshold column) is acceptable. */
(missing merge_threshold column) is acceptable. */
&&
!
(
index
->
id
==
DICT_INDEXES_ID
}
else
if
(
n_rec_fields
<
index
->
n_core_fields
&&
rec_get_n_fields_old
(
rec
)
==
n
-
1
))
)
{
||
n_rec_fields
>
index
->
n_fields
)
{
btr_index_rec_validate_report
(
page
,
rec
,
index
);
btr_index_rec_validate_report
(
page
,
rec
,
index
);
ib
::
error
()
<<
"Has "
<<
rec_get_n_fields_old
(
rec
)
ib
::
error
()
<<
"Has "
<<
rec_get_n_fields_old
(
rec
)
<<
" fields, should have "
<<
n
;
<<
" fields, should have "
<<
index
->
n_core_fields
<<
".."
<<
index
->
n_fields
;
if
(
dump_on_error
)
{
if
(
dump_on_error
)
{
fputs
(
"InnoDB: corrupt record "
,
stderr
);
fputs
(
"InnoDB: corrupt record "
,
stderr
);
rec_print_old
(
stderr
,
rec
);
rec_print_old
(
stderr
,
rec
);
putc
(
'\n'
,
stderr
);
putc
(
'\n'
,
stderr
);
}
return
(
FALSE
);
}
}
return
(
FALSE
);
}
}
offsets
=
rec_get_offsets
(
rec
,
index
,
offsets
,
page_is_leaf
(
page
),
offsets
=
rec_get_offsets
(
rec
,
index
,
offsets
,
page_is_leaf
(
page
),
ULINT_UNDEFINED
,
&
heap
);
ULINT_UNDEFINED
,
&
heap
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
index
->
n_fields
;
i
++
)
{
dict_field_t
*
field
=
dict_index_get_nth_field
(
index
,
i
);
dict_field_t
*
field
=
dict_index_get_nth_field
(
index
,
i
);
ulint
fixed_size
=
dict_col_get_fixed_size
(
ulint
fixed_size
=
dict_col_get_fixed_size
(
dict_field_get_col
(
field
),
dict_field_get_col
(
field
),
...
...
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