mariadb/storage/tokudb
Sachin d00f19e832 MDEV-371 Unique Index for long columns
This patch implements engine independent unique hash index.

Usage:- Unique HASH index can be created automatically for blob/varchar/test column whose key
 length > handler->max_key_length()
or it can be explicitly specified.

  Automatic Creation:-
   Create TABLE t1 (a blob unique);
  Explicit Creation:-
   Create TABLE t1 (a int , unique(a) using HASH);

Internal KEY_PART Representations:-
 Long unique key_info will have 2 representations.
 (lets understand this with an example create table t1(a blob, b blob , unique(a, b)); )

 1. User Given Representation:- key_info->key_part array will be similar to what user has defined.
 So in case of example it will have 2 key_parts (a, b)

 2. Storage Engine Representation:- In this case there will be only one key_part and it will point to
 HASH_FIELD. This key_part will be always after user defined key_parts.

 So:- User Given Representation          [a] [b] [hash_key_part]
                  key_info->key_part ----^
  Storage Engine Representation          [a] [b] [hash_key_part]
                  key_info->key_part ------------^

 Table->s->key_info will have User Given Representation, While table->key_info will have Storage Engine
 Representation.Representation can be changed into each other by calling re/setup_keyinfo_hash function.

Working:-

1. So when user specifies HASH_INDEX or key_length is > handler->max_key_length(), In mysql_prepare_create_table
One extra vfield is added (for each long unique key). And key_info->algorithm is set to HA_KEY_ALG_LONG_HASH.

2. In init_from_binary_frm_image values for hash_keypart is set (like fieldnr , field and flags)

3. In parse_vcol_defs, HASH_FIELD->vcol_info is created. Item_func_hash is used with list of Item_fields,
   When Explicit length is given by user then Item_left is used to concatenate Item_field values.

4. In ha_write_row/ha_update_row check_duplicate_long_entry_key is called which will create the hash key from
table->record[0] and then call ha_index_read_map , if we found duplicated hash , we will compare the result
field by field.
2019-02-22 00:35:40 +01:00
..
doc 5.6.26-74.0 2015-10-26 12:57:57 +01:00
mysql-test MDEV-371 Unique Index for long columns 2019-02-22 00:35:40 +01:00
PerconaFT Merge branch '10.3' into 10.4 2019-02-21 14:40:52 +01:00
tests 5.6.26-74.0 2015-10-26 12:57:57 +01:00
tools 5.6.26-74.0 2015-10-26 12:57:57 +01:00
CMakeLists.txt TokuDB: generate tokudb.cnf unconditionally 2018-12-21 11:38:42 +01:00
ha_tokudb.cc MDEV-371 Unique Index for long columns 2019-02-22 00:35:40 +01:00
ha_tokudb.h MDEV-16188 Post merge fixes fot TokuDB 2019-02-08 01:07:27 -08:00
ha_tokudb_admin.cc Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
ha_tokudb_alter_55.cc Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
ha_tokudb_alter_56.cc MDEV-371 Unique Index for long columns 2019-02-22 00:35:40 +01:00
ha_tokudb_alter_common.cc Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
ha_tokudb_mrr_maria.cc 5.6.26-74.0 2015-10-26 12:57:57 +01:00
ha_tokudb_mrr_mysql.cc 5.6.26-74.0 2015-10-26 12:57:57 +01:00
ha_tokudb_update.cc MDEV-371 Unique Index for long columns 2019-02-22 00:35:40 +01:00
hatoku_cmp.cc Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
hatoku_cmp.h 5.6.41-84.1 2018-09-03 16:29:29 +02:00
hatoku_defines.h Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
hatoku_hton.cc dirty merge 2019-02-07 13:59:31 +01:00
hatoku_hton.h Merge 10.1 into 10.1 2019-02-02 13:00:15 +02:00
tokudb.cnf.in MDEV-13403 Mariadb (with TokuDB) excessive memory usage/leak 2018-06-21 10:15:27 +02:00
tokudb.conf.in MDEV-13403 Mariadb (with TokuDB) excessive memory usage/leak 2018-06-21 10:15:27 +02:00
tokudb_background.cc 5.6.42-84.2 2019-01-24 17:31:13 +01:00
tokudb_background.h 5.6.38-83.0 2018-01-23 19:20:10 +02:00
tokudb_buffer.h 5.6.27-76.0 2015-12-15 17:23:58 +01:00
tokudb_card.h Changed KEY names to use LEX_CSTRING 2017-08-24 01:05:53 +02:00
tokudb_debug.h 5.6.41-84.1 2018-09-03 16:29:29 +02:00
tokudb_dir_cmd.cc MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operations 2018-07-04 19:13:55 +02:00
tokudb_dir_cmd.h 5.6.41-84.1 2018-09-03 16:29:29 +02:00
tokudb_information_schema.cc Merge branch '11.0' into 10.1 2018-09-06 22:45:19 +02:00
tokudb_information_schema.h Merge branch 'merge-tokudb-5.6' into 10.0-tokudb-merge 2016-06-10 20:48:59 +02:00
tokudb_math.h 5.6.27-76.0 2015-12-15 17:23:58 +01:00
tokudb_memory.h Merge branch 'merge-tokudb-5.6' into 10.0-tokudb-merge 2016-06-10 20:48:59 +02:00
tokudb_status.h 5.6.27-76.0 2015-12-15 17:23:58 +01:00
tokudb_sysvars.cc Merge branch '10.3' into 10.4 2019-02-21 14:40:52 +01:00
tokudb_sysvars.h Merge branch 'merge-tokudb-5.6' into 10.0 2019-01-28 20:15:57 +01:00
tokudb_thread.cc 5.6.38-83.0 2018-01-23 19:20:10 +02:00
tokudb_thread.h Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
tokudb_time.h 5.6.27-76.0 2015-12-15 17:23:58 +01:00
tokudb_txn.h 5.6.36-82.1 2017-08-03 11:48:44 +03:00
tokudb_update_fun.cc 5.6.41-84.1 2018-09-03 16:29:29 +02:00
tokudb_vlq.h 5.6.26-74.0 2015-10-26 12:57:57 +01:00