mariadb/storage/heap
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
..
mysql-test/mtr2 overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
_check.c Merge branch '10.0' into 10.1 2018-02-22 14:12:02 +01:00
_rectest.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
ChangeLog
CMakeLists.txt MDEV-672 : storage/maria and storage/perfschema do not appear to honor WITH_UNIT_TESTS 2012-10-30 23:05:55 +01:00
ha_heap.cc Merge branch 'bb-10.2-ext' into 10.3 2018-02-23 08:43:34 +01:00
ha_heap.h MDEV-371 Unique Index for long columns 2019-02-22 00:35:40 +01:00
heapdef.h hash (storage): hp_hashnr is local 2019-02-13 23:15:55 +04:00
hp_block.c Fixed typo in comments 2017-01-03 14:27:53 +01:00
hp_clear.c Fix that end_bulk_insert() doesn't write to to-be-deleted files 2017-05-17 00:34:48 +03:00
hp_close.c Updated/added copyright headers 2011-06-30 17:46:53 +02:00
hp_create.c Merge branch '10.0' into 10.1 2018-10-30 15:10:01 +01:00
hp_delete.c Merge branch 'bb-10.2-ext' into 10.3 2018-02-23 08:43:34 +01:00
hp_extra.c MDEV-13459 Warnings, when compiling with gcc-7.x 2017-10-17 07:37:39 +02:00
hp_hash.c hash (storage): hp_hashnr is local 2019-02-13 23:15:55 +04:00
hp_info.c Sage cleanup in heap storage engine 2015-11-10 13:46:56 +02:00
hp_open.c Sage cleanup in heap storage engine 2015-11-10 13:46:56 +02:00
hp_panic.c Updated/added copyright headers 2011-06-30 17:46:53 +02:00
hp_rename.c Updated/added copyright headers 2011-06-30 17:46:53 +02:00
hp_rfirst.c MySQL-5.5.36 merge 2014-02-17 11:00:51 +01:00
hp_rkey.c Sage cleanup in heap storage engine 2015-11-10 13:46:56 +02:00
hp_rlast.c MySQL-5.5.36 merge 2014-02-17 11:00:51 +01:00
hp_rnext.c MySQL-5.5.36 merge 2014-02-17 11:00:51 +01:00
hp_rprev.c MySQL-5.5.36 merge 2014-02-17 11:00:51 +01:00
hp_rrnd.c Merge branch '10.0' into 10.1 2018-02-22 14:12:02 +01:00
hp_rsame.c bug: ha_heap was unilaterally increasing reclength 2018-02-11 18:36:54 +01:00
hp_scan.c bug: ha_heap was unilaterally increasing reclength 2018-02-11 18:36:54 +01:00
hp_static.c fixes for test failures 2012-09-27 20:09:46 +02:00
hp_test1.c Sage cleanup in heap storage engine 2015-11-10 13:46:56 +02:00
hp_test2.c Sage cleanup in heap storage engine 2015-11-10 13:46:56 +02:00
hp_update.c MDEV-8360 Clean-up CHARSET_INFO: strnncollsp: diff_if_only_endspace_difference 2016-03-31 11:04:48 +04:00
hp_write.c Merge branch '10.1' into 10.2 2018-02-22 16:46:02 +01:00