From 9e2b7fa7d5f0cbe4920be5567314b6de1af660a4 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 31 May 2011 02:12:32 -0700 Subject: Implement worklog #5743 InnoDB: Lift the limit of index key prefixes. With this change, the index prefix column length lifted from 767 bytes to 3072 bytes if "innodb_large_prefix" is set to "true". rb://603 approved by Marko --- storage/innobase/row/row0mysql.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'storage/innobase/row/row0mysql.c') diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index aef4595f5fe..e1ada387729 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1997,6 +1997,7 @@ row_create_index_for_mysql( ulint i; ulint len; char* table_name; + dict_table_t* table; #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); @@ -2010,6 +2011,8 @@ row_create_index_for_mysql( que_run_threads()) and thus index->table_name is not available. */ table_name = mem_strdup(index->table_name); + table = dict_table_get_low(table_name); + trx_start_if_not_started(trx); /* Check that the same column does not appear twice in the index. @@ -2042,7 +2045,7 @@ row_create_index_for_mysql( } /* Check also that prefix_len and actual length - < DICT_MAX_INDEX_COL_LEN */ + is less than that from DICT_MAX_FIELD_LEN_BY_FORMAT() */ len = dict_index_get_nth_field(index, i)->prefix_len; @@ -2050,8 +2053,9 @@ row_create_index_for_mysql( len = ut_max(len, field_lengths[i]); } - if (len >= DICT_MAX_INDEX_COL_LEN) { - err = DB_TOO_BIG_RECORD; + /* Column or prefix length exceeds maximum column length */ + if (len > (ulint) DICT_MAX_FIELD_LEN_BY_FORMAT(table)) { + err = DB_TOO_BIG_INDEX_COL; goto error_handling; } @@ -2076,6 +2080,7 @@ row_create_index_for_mysql( que_graph_free((que_t*) que_node_get_parent(thr)); error_handling: + if (err != DB_SUCCESS) { /* We have special error handling here */ -- cgit v1.2.1