Commit 0b7c49e7 authored by Marko Mäkelä's avatar Marko Mäkelä

btr_index_rec_validate(): Account for instant ADD COLUMN

parent 4f1375e3
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);
SET @saved_dbug= @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_commit_inplace_fail_2';
ALTER TABLE t1 ADD COLUMN c CHAR(3) DEFAULT 'lie';
ERROR HY000: Internal error: Injected error!
SET DEBUG_DBUG= @saved_dbug;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
BEGIN;
UPDATE t1 SET b=a+1;
INSERT INTO t1 VALUES (0,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;
ERROR HY000: Internal error: Injected error!
SET DEBUG_DBUG= @saved_dbug;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
BEGIN;
DELETE FROM t1;
INSERT INTO t1 VALUES (1,2,'foo');
......@@ -34,7 +40,7 @@ t1 CREATE TABLE `t1` (
`c` char(3) DEFAULT 'lie',
PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
PARTITION BY KEY ()
PARTITIONS 3
DROP TABLE t1;
......@@ -3,13 +3,14 @@
--source include/have_partition.inc
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);
SET @saved_dbug= @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_commit_inplace_fail_2';
--error ER_INTERNAL_ERROR
ALTER TABLE t1 ADD COLUMN c CHAR(3) DEFAULT 'lie';
SET DEBUG_DBUG= @saved_dbug;
CHECK TABLE t1;
BEGIN;
UPDATE t1 SET b=a+1;
INSERT INTO t1 VALUES (0,1);
......@@ -20,6 +21,7 @@ SET DEBUG_DBUG='+d,ib_commit_inplace_fail_1';
--error ER_INTERNAL_ERROR
ALTER TABLE t1 ADD COLUMN d INT NOT NULL DEFAULT -42;
SET DEBUG_DBUG= @saved_dbug;
CHECK TABLE t1;
BEGIN;
DELETE FROM t1;
INSERT INTO t1 VALUES (1,2,'foo');
......
......@@ -4659,8 +4659,6 @@ btr_index_rec_validate(
and page on error */
{
ulint len;
ulint n;
ulint i;
const page_t* page;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
......@@ -4691,31 +4689,34 @@ btr_index_rec_validate(
return(FALSE);
}
n = dict_index_get_n_fields(index);
if (!page_is_comp(page)
&& (rec_get_n_fields_old(rec) != n
/* a record for older SYS_INDEXES table
(missing merge_threshold column) is acceptable. */
&& !(index->id == DICT_INDEXES_ID
&& rec_get_n_fields_old(rec) == n - 1))) {
btr_index_rec_validate_report(page, rec, index);
if (!page_is_comp(page)) {
const ulint n_rec_fields = rec_get_n_fields_old(rec);
if (n_rec_fields == DICT_FLD__SYS_INDEXES__MERGE_THRESHOLD
&& index->id == DICT_INDEXES_ID) {
/* A record for older SYS_INDEXES table
(missing merge_threshold column) is acceptable. */
} else if (n_rec_fields < index->n_core_fields
|| n_rec_fields > index->n_fields) {
btr_index_rec_validate_report(page, rec, index);
ib::error() << "Has " << rec_get_n_fields_old(rec)
<< " fields, should have " << n;
ib::error() << "Has " << rec_get_n_fields_old(rec)
<< " fields, should have "
<< index->n_core_fields << ".."
<< index->n_fields;
if (dump_on_error) {
fputs("InnoDB: corrupt record ", stderr);
rec_print_old(stderr, rec);
putc('\n', stderr);
if (dump_on_error) {
fputs("InnoDB: corrupt record ", stderr);
rec_print_old(stderr, rec);
putc('\n', stderr);
}
return(FALSE);
}
return(FALSE);
}
offsets = rec_get_offsets(rec, index, offsets, page_is_leaf(page),
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);
ulint fixed_size = dict_col_get_fixed_size(
dict_field_get_col(field),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment