Permalink
Browse files

BUG#26848813: INDEXED COLUMN CAN'T BE CHANGED FROM VARCHAR(15)

              TO VARCHAR(40) INSTANTANEOUSLY

Analysis
========

Indexed VARCHAR columns are not expanded instantaneously (without index rebuild)for
InnoDB tables using INPLACE algorithm. The other problems uncovered as part of this
bug are:
a) Indexed VARCHAR columns when converted from unpacked
   keys to packed keys(key size > 8 bytes) by expanding
   the VARCHAR column was not instantaneous for InnoDB
   tables using INPLACE algorithm even though pack keys
   is a no-op for InnoDB tables.
b) CREATE/ALTER of InnoDB tables where the index size
   exceeds the SE limit of 767 bytes for COMPACT or
   REDUNDANT row_format did not report error in STRICT
   mode and warning in non-strict mode.

SQL layer determines if there has been a change in index definition and sets the
appropriate handler flags which helps the SE to determine whether a index rebuild
needs to be performed. The 'has_index_def_changed()' did not check if the change
in length had a compatible packed data representation and marked it as a change in
index by setting the handler flags DROP_INDEX and ADD_INDEX triggering a recreation
of indexes in InnoDB.

When 'PACK_KEYS' option is not specified, indexes on columns with string types are
marked for packing through HA_PACK_KEY. Currently only MyISAM engine supports it.
Indexes on columns with length greater than 8 bytes were marked for packing
irrespective of the storage engine. Converting the indexes from non-packed to packed
i.e expanding the varchar column from lesser than 8 chars to more than 8 chars using
ALTER was marked as a change in index definition during the check in
'has_index_def_changed()' even though InnoDB does not support packed keys.

The handler API ha_innobase::max_supported_key_part_length() returned an incorrect
maximum support key part length since the row format of the table was not taken into
account. Hence creation of tables using REDUNDANT/COMPACT row format with index size
exceeding the SE limit were allowed.

Fix:
===
a) A new handler flag 'Alter_inplace_info::ALTER_COLUMN_INDEX_LENGTH"
   is introduced. This is set in 'has_index_def_changed()' when the
   index length differs due to column modification and has compatible
   packed data representation while determining if the index definition
   has changed.

b) Introduced a handlerton flag 'HTON_SUPPORTS_PACKED_KEYS' to check for
   'PACK_KEYS' support which is currently set for MyISAM engine since it
   is the only engine which supports packed keys. The 'HTON_SUPPORTS_PACKED_KEYS'
   is checked prior to setting the index flag 'HA_BINARY_PACK_KEY' for packed keys.
   Hence for InnoDB the packed key flag for indexes is not set.

c) The handler API max_supported_key_part_length() has been modified to take 'create_info'
   as a parameter from which the row_format can be fetched and appropriate index limit can
   be computed and returned by the InnoDB implementation of the handler API. More details
   on the behavior is mentioned in the table below.

   - Since the index limit is computed correctly and checked at the SQL layer,
     the error message 'ER_TOO_LONG_KEY' is reported at the SQL layer instead of
     'ER_INDEX_COLUMN_TOO_LONG' (which was reported by the handler interface
     after mapping the error returned by SE).
   - For COMPACT and REDUNDANT row format, when the index size exceeds 767 bytes,
     a warning is reported in non-STRICT mode and the index is truncated to fit
     767 bytes. In a STRICT mode, an error is reported.

This table describes the behavior of INDEX limit, Type of INDEX and
behavior under STRICT and NON_STRICT mode.
IL===> Index Limit.
-------------------------------------------------------------------------------|
  Row Format          |INDEX LIMIT | STRICT MODE(>IL) | NON-STRICT MODE(>IL)   |
----------------------|--------------------------------------------------------|
Compact/Redundant     |  767 bytes |    Error         | Index truncation(767)  |
(Non Unique Index)    |            |                  | and warning.           |
--------------------------------------------------------------------------------
Compact/Redundant     |  767 bytes |    Error         | Error                  |
(Unique/Primary Index)|            |                  |                        |
--------------------------------------------------------------------------------
Dynamic/Compressed    |  3072 byes |    Error         | Index truncation(3072) |
(Non Unique Index)    |            |                  | and warning            |
--------------------------------------------------------------------------------
Dynamic/Compressed    |  3072 bytes|    Error         | Error                  |
(Unique/Primary Index)|            |                  |                        |
--------------------------------------------------------------------------------

(cherry picked from commit bdc97b75674ade0251bdbc3ea2dc7d36871f73cd)
  • Loading branch information...
Nisha Gopalakrishnan authored and gipulla committed May 30, 2018
1 parent 3e38cf4 commit 913071c0b16cc03e703308250d795bc381627e37
Showing with 432 additions and 87 deletions.
  1. +103 −0 mysql-test/r/alter_table.result
  2. +19 −0 mysql-test/r/innodb_mysql_sync.result
  3. +1 −1 mysql-test/suite/innodb/r/default_row_format_compatibility.result
  4. +3 −3 mysql-test/suite/innodb/r/innodb-large-prefix.result
  5. +1 −1 mysql-test/suite/innodb/t/default_row_format_compatibility.test
  6. +3 −3 mysql-test/suite/innodb/t/innodb-large-prefix.test
  7. +4 −4 mysql-test/suite/innodb_zip/r/index_large_prefix.result
  8. +3 −3 mysql-test/suite/innodb_zip/r/index_large_prefix_4k.result
  9. +4 −4 mysql-test/suite/innodb_zip/r/index_large_prefix_8k.result
  10. +2 −2 mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
  11. +4 −3 mysql-test/suite/innodb_zip/r/wl6469.result
  12. +4 −4 mysql-test/suite/innodb_zip/t/index_large_prefix.test
  13. +3 −3 mysql-test/suite/innodb_zip/t/index_large_prefix_4k.test
  14. +4 −4 mysql-test/suite/innodb_zip/t/index_large_prefix_8k.test
  15. +2 −2 mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test
  16. +3 −3 mysql-test/suite/innodb_zip/t/wl6469.test
  17. +123 −0 mysql-test/t/alter_table.test
  18. +28 −0 mysql-test/t/innodb_mysql_sync.test
  19. +3 −2 sql/ha_ndbcluster.cc
  20. +2 −2 sql/ha_ndbcluster.h
  21. +2 −1 sql/handler.cc
  22. +16 −3 sql/handler.h
  23. +27 −13 sql/sql_table.cc
  24. +2 −2 sql/sql_tmp_table.cc
  25. +4 −2 storage/archive/ha_archive.h
  26. +4 −2 storage/blackhole/ha_blackhole.h
  27. +4 −2 storage/federated/ha_federated.h
  28. +4 −2 storage/heap/ha_heap.h
  29. +13 −4 storage/innobase/handler/ha_innodb.cc
  30. +2 −2 storage/innobase/handler/ha_innodb.h
  31. +2 −1 storage/innobase/handler/handler0alter.cc
  32. +2 −1 storage/myisam/ha_myisam.cc
  33. +4 −2 storage/myisam/ha_myisam.h
  34. +4 −2 storage/myisammrg/ha_myisammrg.h
  35. +19 −2 storage/partition/ha_partition.cc
  36. +4 −2 storage/partition/ha_partition.h
@@ -3683,3 +3683,106 @@ ERROR 22004: Invalid use of NULL value
ALTER TABLE t2 MODIFY fld0 POINT NOT NULL;
ERROR 22004: Invalid use of NULL value
DROP TABLE t1, t2;
#
# BUG#26848813: INDEXED COLUMN CAN'T BE CHANGED FROM VARCHAR(15)
# TO VARCHAR(40) INSTANTANEOUSLY
SET @orig_sql_mode= @@sql_mode;
SET @orig_innodb_large_prefix= @@global.innodb_large_prefix;
SET GLOBAL innodb_large_prefix= ON;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
# Tests where an error is reported under strict mode when the index
# limit exceeds the maximum supported length by SE.
CREATE TABLE t1 (fld1 VARCHAR(768), KEY(fld1)) CHARSET latin1 ENGINE =InnoDB
ROW_FORMAT= COMPACT;
ERROR 42000: Specified key was too long; max key length is 767 bytes
CREATE TABLE t2 (fld1 VARCHAR(3073), KEY(fld1)) CHARSET latin1 ENGINE= InnoDB;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
# Test with innodb prefix indexes where the index limit is 767 bytes
CREATE TABLE t1 (fld1 VARCHAR(767), KEY(fld1)) CHARSET latin1 ENGINE=INNODB
ROW_FORMAT=COMPACT;
ALTER TABLE t1 MODIFY fld1 VARCHAR(768), ALGORITHM= INPLACE;
ERROR 42000: Specified key was too long; max key length is 767 bytes
ALTER TABLE t1 MODIFY fld1 VARCHAR(768), ALGORITHM= COPY;
ERROR 42000: Specified key was too long; max key length is 767 bytes
# Test with innodb prefix indexes where the index limit is 3072 bytes
CREATE TABLE t2 (fld1 VARCHAR(3072), KEY(fld1)) CHARSET latin1 ENGINE=INNODB
ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 MODIFY fld1 VARCHAR(3073), ALGORITHM= INPLACE;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
ALTER TABLE t2 MODIFY fld1 VARCHAR(3073), ALGORITHM= COPY;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
# Tests with innodb_large_prefix disabled and strict mode.
SET GLOBAL innodb_large_prefix= OFF;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
CREATE TABLE t3 (fld1 VARCHAR(3072), KEY(fld1)) CHARSET latin1 ENGINE= InnoDB;
ERROR 42000: Specified key was too long; max key length is 767 bytes
DROP TABLE t1, t2;
SET sql_mode= '';
Warnings:
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
SET GLOBAL innodb_large_prefix= ON;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
# Test where the indexes are truncated to fit the index limit and
# a warning is reported under non-strict mode when the index exceeds
# the SE limit.
CREATE TABLE t1 (fld1 VARCHAR(768), KEY(fld1)) ENGINE= InnoDB
ROW_FORMAT=COMPACT;
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
CREATE TABLE t2 (fld1 VARCHAR(3073), KEY(fld1)) ENGINE= InnoDB;
Warnings:
Warning 1071 Specified key was too long; max key length is 3072 bytes
# Test with innodb prefix indexes where the index limit is 767 bytes.
CREATE TABLE t3 (fld1 VARCHAR(767), KEY(fld1))ENGINE=INNODB ROW_FORMAT=COMPACT;
ALTER TABLE t3 MODIFY fld1 VARCHAR(768), ALGORITHM= INPLACE;
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
ALTER TABLE t3 MODIFY fld1 VARCHAR(800), ALGORITHM= COPY;
# Test with innodb prefix indexes where the index limit is 3072 bytes.
CREATE TABLE t4 (fld1 VARCHAR(3072), KEY(fld1))ENGINE=INNODB
ROW_FORMAT=DYNAMIC;
ALTER TABLE t4 MODIFY fld1 VARCHAR(3073), ALGORITHM= INPLACE;
Warnings:
Warning 1071 Specified key was too long; max key length is 3072 bytes
ALTER TABLE t4 MODIFY fld1 VARCHAR(3074), ALGORITHM= COPY;
# For unique and primary keys, an error is reported even in non-strict
# mode.
CREATE TABLE t5(fld1 VARCHAR(768) PRIMARY KEY) ENGINE= InnoDB
ROW_FORMAT=COMPACT;
ERROR 42000: Specified key was too long; max key length is 767 bytes
CREATE TABLE t5(fld1 VARCHAR(3073), UNIQUE KEY(fld1)) ENGINE= InnoDB;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
# Tests with innodb_large_prefix disabled and strict mode.
SET GLOBAL innodb_large_prefix= OFF;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
CREATE TABLE t5 (fld1 VARCHAR(3072), KEY(fld1)) CHARSET latin1 ENGINE= InnoDB;
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
DROP TABLE t1, t2, t3, t4, t5;
SET sql_mode= @orig_sql_mode;
SET GLOBAL innodb_large_prefix= ON;
# Tests added for coverage.
CREATE TABLE t1(fld1 VARCHAR(3), KEY(fld1)) ENGINE=MYISAM;
# Conversion of unpacked keys to packed keys reports
# error for INPLACE Alter.
ALTER TABLE t1 MODIFY fld1 VARCHAR(10), ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
# Succeeds with index rebuild.
ALTER TABLE t1 MODIFY fld1 VARCHAR(10), ALGORITHM=COPY;
# Succeeds since the row format is dynamic.
CREATE TABLE t2(fld1 VARCHAR(768), KEY(fld1)) ENGINE= InnoDB ROW_FORMAT= DYNAMIC;
# An error is reported when the index exceeds the column size
# in both strict and non-strict mode.
ALTER TABLE t2 ADD INDEX idx1(fld1(769));
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
SET sql_mode= '';
ALTER TABLE t2 ADD INDEX idx1(fld1(769));
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
# Cleanup.
DROP TABLE t1, t2;
SET sql_mode= @orig_sql_mode;
SET GLOBAL innodb_large_prefix= @orig_innodb_large_prefix;
@@ -746,3 +746,22 @@ ALTER TABLE t1 MODIFY fld1 CHAR(20);
#cleanup
DROP TABLE t1;
SET debug="-d,innodb_index_drop_count_zero";
#
# BUG#26848813: INDEXED COLUMN CAN'T BE CHANGED FROM VARCHAR(15)
# TO VARCHAR(40) INSTANTANEOUSLY
CREATE TABLE t1(fld1 VARCHAR(5), KEY(fld1)) ENGINE= InnoDB;
SET DEBUG="+d,innodb_index_drop_count_zero";
# Without patch, an error is reported.
ALTER TABLE t1 MODIFY fld1 VARCHAR(7), ALGORITHM= INPLACE;
# Scenario where non-packed keys is converted to packed keys
# before the patch, an error is reported.
ALTER TABLE t1 MODIFY fld1 VARCHAR(9), ALGORITHM= INPLACE;
SET DEBUG="-d,innodb_index_drop_count_zero";
# Tests added for covering cases where rebuild is required.
# Reducing the size of the field.
ALTER TABLE t1 MODIFY fld1 VARCHAR(3), ALGORITHM= INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY.
# Increasing the size of the field to boundary condition.
ALTER TABLE t1 MODIFY fld1 VARCHAR(256), ALGORITHM= INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY.
DROP TABLE t1;
@@ -72,7 +72,7 @@ Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
test/tab test/tab 33 5 Dynamic 0 Single
SET GLOBAL innodb_default_row_format=COMPACT;
ALTER TABLE tab ROW_FORMAT=COMPACT;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
DROP TABLE tab;
SET GLOBAL innodb_default_row_format=Default;
SELECT @@innodb_default_row_format;
@@ -5,14 +5,14 @@ CREATE TABLE t1(a int not null,key(a,a)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ERROR 42S21: Duplicate column name 'a'
CREATE TABLE t1(a int,b text,key(b(768))) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=COMPACT;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
CREATE TABLE t1(a int not null,b text) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=COMPACT;
INSERT INTO t1 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
CREATE INDEX t1aa ON t1(a,a);
ERROR 42S21: Duplicate column name 'a'
CREATE INDEX t1b ON t1(b(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -35,7 +35,7 @@ INSERT INTO t2 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
CREATE INDEX t2aa ON t2(a,a);
ERROR 42S21: Duplicate column name 'a'
CREATE INDEX t2b ON t2(b(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
SELECT * FROM t2;
a b
1
@@ -160,7 +160,7 @@ SELECT * FROM tab;
SET GLOBAL innodb_default_row_format=COMPACT;
# Check error ERROR 1709 (HY000): Index column size too large
-- error ER_INDEX_COLUMN_TOO_LONG
--error ER_TOO_LONG_KEY
ALTER TABLE tab ROW_FORMAT=COMPACT;
# Cleanup
@@ -9,15 +9,15 @@
--error ER_DUP_FIELDNAME
CREATE TABLE t1(a int not null,key(a,a)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
CREATE TABLE t1(a int,b text,key(b(768))) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=COMPACT;
CREATE TABLE t1(a int not null,b text) ENGINE=InnoDB DEFAULT CHARSET=latin1
ROW_FORMAT=COMPACT;
INSERT INTO t1 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
--error ER_DUP_FIELDNAME
CREATE INDEX t1aa ON t1(a,a);
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
CREATE INDEX t1b ON t1(b(768));
SHOW CREATE TABLE t1;
SELECT * FROM t1;
@@ -28,7 +28,7 @@ ROW_FORMAT=COMPACT;
INSERT INTO t2 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
--error ER_DUP_FIELDNAME
CREATE INDEX t2aa ON t2(a,a);
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
CREATE INDEX t2b ON t2(b(768));
SELECT * FROM t2;
DROP TABLE t2;
@@ -494,11 +494,11 @@ drop table worklog5743;
### Test 6 ###
create table worklog5743(a TEXT not null, primary key (a(1000)))
row_format=compact;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create table worklog5743(a TEXT)
row_format=compact;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx on worklog5743(a(767));
insert into worklog5743 values(repeat("a", 20000));
begin;
@@ -546,12 +546,12 @@ drop table worklog5743;
SET sql_mode= default;
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
SET GLOBAL innodb_file_per_table=1;
@@ -362,7 +362,7 @@ create table worklog5743(a TEXT not null, primary key (a(1000)));
ERROR 42000: Specified key was too long; max key length is 768 bytes
create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx on worklog5743(a(767));
insert into worklog5743 values(repeat("a", 20000));
begin;
@@ -417,12 +417,12 @@ insert into worklog5743 values(repeat("a", 768));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
SET GLOBAL innodb_file_per_table=1;
@@ -404,10 +404,10 @@ drop table worklog5743;
### Test 6 ###
create table worklog5743(a TEXT not null, primary key (a(1000)))
row_format=compact;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create table worklog5743(a TEXT) row_format=compact;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx on worklog5743(a(767));
insert into worklog5743 values(repeat("a", 20000));
begin;
@@ -455,12 +455,12 @@ worklog5743 CREATE TABLE `worklog5743` (
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create index idx2 on worklog5743(a(767));
drop table worklog5743;
SET GLOBAL innodb_file_per_table=1;
@@ -30,9 +30,9 @@ col_1_varchar = REPEAT("c", 4000)
0
1
ALTER TABLE worklog5743 ROW_FORMAT=REDUNDANT;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
ALTER TABLE worklog5743 ROW_FORMAT=COMPACT;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
ALTER TABLE worklog5743 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
DROP TABLE worklog5743;
CREATE TABLE worklog5743 (
@@ -270,16 +270,17 @@ SET sql_mode = default;
set global innodb_large_prefix = 1;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SET sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';
Warnings:
Warning 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
SET innodb_strict_mode=OFF;
create temporary table t (
a int not null,
b blob not null,
index sk (b(3021))
) row_format = compact engine=innodb;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create temporary table t (
a int not null,
b blob not null,
@@ -299,7 +300,7 @@ a int not null,
b blob not null,
index sk (b(3021))
) row_format = compact engine=innodb;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
ERROR 42000: Specified key was too long; max key length is 767 bytes
create temporary table t (
a int not null,
b blob not null,
@@ -370,15 +370,15 @@ drop table worklog5743;
-- echo ### Test 6 ###
# Create a table with old format, and the limit is 768 bytes.
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create table worklog5743(a TEXT not null, primary key (a(1000)))
row_format=compact;
create table worklog5743(a TEXT)
row_format=compact;
# Excercise the column length check in ha_innobase::add_index()
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create index idx on worklog5743(a(768));
# This should be successful
@@ -426,13 +426,13 @@ SET sql_mode= default;
# We have a limit of 767 bytes for Antelope tables
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
@@ -334,7 +334,7 @@ create table worklog5743(a TEXT not null, primary key (a(1000)));
create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
# Excercise the column length check in ha_innobase::add_index()
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create index idx on worklog5743(a(768));
# This should be successful
@@ -385,13 +385,13 @@ drop table worklog5743;
# We have a limit of 767 bytes for Antelope tables
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
-- error ER_INDEX_COLUMN_TOO_LONG
-- error ER_TOO_LONG_KEY
create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
Oops, something went wrong.

0 comments on commit 913071c

Please sign in to comment.