mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
branches/zip: Skip the undo log size check on REDUNDANT and COMPACT tables.
In ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED, column prefix indexes require that prefixes of externally stored columns be written to the undo log. This may make the undo log record bigger than the record on the B-tree page. The maximum size of an undo log record is the page size. That must be checked for, in dict_index_add_to_cache(). dict_index_add_to_cache(): Skip the undo log size check for REDUNDANT and COMPACT tables. These tables store prefixes of externally stored columns locally within the clustered index record. There are no special considerations for the undo log record size. innodb-index.test: Ensure that the check exists for ROW_FORMAT=DYNAMIC, but not for ROW_FORMAT=COMPACT. This fixes issue #99. rb://28 approved by Sunny.
This commit is contained in:
parent
8ec95fc761
commit
bb4b3f4008
3 changed files with 46 additions and 3 deletions
|
@ -1461,6 +1461,29 @@ too_big:
|
|||
n_ord = new_index->n_uniq;
|
||||
}
|
||||
|
||||
switch (dict_table_get_format(table)) {
|
||||
case DICT_TF_FORMAT_51:
|
||||
/* ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT store
|
||||
prefixes of externally stored columns locally within
|
||||
the record. There are no special considerations for
|
||||
the undo log record size. */
|
||||
goto undo_size_ok;
|
||||
|
||||
case DICT_TF_FORMAT_ZIP:
|
||||
/* In ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED,
|
||||
column prefix indexes require that prefixes of
|
||||
externally stored columns are written to the undo log.
|
||||
This may make the undo log record bigger than the
|
||||
record on the B-tree page. The maximum size of an
|
||||
undo log record is the page size. That must be
|
||||
checked for below. */
|
||||
break;
|
||||
|
||||
#if DICT_TF_FORMAT_ZIP != DICT_TF_FORMAT_MAX
|
||||
# error "DICT_TF_FORMAT_ZIP != DICT_TF_FORMAT_MAX"
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < n_ord; i++) {
|
||||
const dict_field_t* field
|
||||
= dict_index_get_nth_field(new_index, i);
|
||||
|
@ -1494,6 +1517,7 @@ too_big:
|
|||
}
|
||||
}
|
||||
|
||||
undo_size_ok:
|
||||
/* Flag the ordering columns */
|
||||
|
||||
for (i = 0; i < n_ord; i++) {
|
||||
|
|
|
@ -886,10 +886,12 @@ a
|
|||
44
|
||||
commit;
|
||||
drop table t1;
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
|
||||
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
|
||||
q blob,r blob,s blob,t blob,u blob)
|
||||
engine=innodb;
|
||||
engine=innodb row_format=dynamic;
|
||||
create index t1a on t1 (a(1));
|
||||
create index t1b on t1 (b(1));
|
||||
create index t1c on t1 (c(1));
|
||||
|
@ -960,8 +962,14 @@ t1 CREATE TABLE `t1` (
|
|||
KEY `t1s` (`s`(1)),
|
||||
KEY `t1t` (`t`(1)),
|
||||
KEY `t1st` (`s`(1),`t`(1))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
create index t1u on t1 (u(1));
|
||||
ERROR HY000: Too big row
|
||||
alter table t1 row_format=compact;
|
||||
create index t1u on t1 (u(1));
|
||||
drop table t1;
|
||||
set global innodb_file_per_table=0;
|
||||
set global innodb_file_format=Antelope;
|
||||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||
CREATE TABLE t1(
|
||||
|
|
|
@ -354,6 +354,10 @@ disconnect b;
|
|||
|
||||
drop table t1;
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
# Test creating a table that could lead to undo log overflow.
|
||||
# In the undo log, we write a 768-byte prefix (REC_MAX_INDEX_COL_LEN)
|
||||
# of each externally stored column that appears as a column prefix in an index.
|
||||
|
@ -361,7 +365,7 @@ drop table t1;
|
|||
create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
|
||||
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
|
||||
q blob,r blob,s blob,t blob,u blob)
|
||||
engine=innodb;
|
||||
engine=innodb row_format=dynamic;
|
||||
create index t1a on t1 (a(1));
|
||||
create index t1b on t1 (b(1));
|
||||
create index t1c on t1 (c(1));
|
||||
|
@ -388,7 +392,14 @@ create index t1u on t1 (u(1));
|
|||
create index t1ut on t1 (u(1), t(1));
|
||||
create index t1st on t1 (s(1), t(1));
|
||||
show create table t1;
|
||||
--error 139
|
||||
create index t1u on t1 (u(1));
|
||||
alter table t1 row_format=compact;
|
||||
create index t1u on t1 (u(1));
|
||||
|
||||
drop table t1;
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format=$format;
|
||||
|
||||
#
|
||||
# Test to check whether CREATE INDEX handles implicit foreign key
|
||||
|
|
Loading…
Add table
Reference in a new issue