mirror of
https://github.com/MariaDB/server.git
synced 2025-04-28 06:45:23 +03:00
DB_COL_APPEARS_TWICE_IN_INDEX: Remove. This condition is already checked and reported by MySQL before passing the index definition to the storage engine. row_create_index_for_mysql(): Remove the redundant check for DB_COL_APPEARS_TWICE_IN_INDEX. When enforcing the column prefix index limit, invoke dict_mem_index_free(index) to plug the memory leak. In the loop, use index->n_def instead of dict_index_get_n_fields(index), because the latter would be 0 for indexes that have not been copied to the data dictionary cache. innodb-use-sys-malloc.test: Add test cases for attempting to trigger the error checks in row_create_index_for_mysql(). Before MySQL 5.5 and WL#5743, the leak is only reproducible if ha_innobase::max_supported_key_part_length() returned a higher limit than the one used in row_create_index_for_mysql(). In MySQL 5.5 and later, the leak is reproducible with innodb_large_prefix=true. rb:688 approved by Jimmy Yang
46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
-- source include/have_innodb.inc
|
|
|
|
#display current value of innodb_use_sys_malloc
|
|
SELECT @@GLOBAL.innodb_use_sys_malloc;
|
|
--echo 1 Expected
|
|
|
|
#try changing it. Should fail.
|
|
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
|
SET @@GLOBAL.innodb_use_sys_malloc=0;
|
|
--echo Expected error 'Read only variable'
|
|
|
|
SELECT @@GLOBAL.innodb_use_sys_malloc;
|
|
--echo 1 Expected
|
|
|
|
|
|
# Do some stuff to see if it works.
|
|
# Also, test the code paths of
|
|
# Bug #12699505 MEMORY LEAK IN ROW_CREATE_INDEX_FOR_MYSQL()
|
|
# (the leak would only be triggered if
|
|
# ha_innobase::max_supported_key_part_length() were set
|
|
# higher than the limit used in row_create_index_for_mysql())
|
|
|
|
--error ER_DUP_FIELDNAME
|
|
create table t1(a int not null,key(a,a)) engine=innodb DEFAULT CHARSET=latin1;
|
|
# thanks to --innodb-large-prefix=1 this will not be truncated to b(767)
|
|
-- error ER_INDEX_COLUMN_TOO_LONG
|
|
create table t1(a int,b text,key(b(768))) engine=innodb DEFAULT CHARSET=latin1;
|
|
create table t1(a int not null,b text) engine=innodb DEFAULT CHARSET=latin1;
|
|
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
|
|
create index t1b on t1(b(768));
|
|
SHOW CREATE TABLE t1;
|
|
select * from t1;
|
|
|
|
drop table t1;
|
|
CREATE TABLE t2(a int primary key, b text) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
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
|
|
CREATE INDEX t2b on t2(b(768));
|
|
SELECT * FROM t2;
|
|
DROP TABLE t2;
|