mirror of
https://github.com/MariaDB/server.git
synced 2026-02-18 16:49:03 +01:00
PARTITION BY [LINEAR] KEY ALGORITHM={MYSQL51|MYSQL55|BASE31|CRC32C|XXH32|XXH3}
- The MYSQL5X algorithms are the existing algorithms, with MYSQL55
being the default
- The BASE31 algorithm uses a base-31 representation of the bytes, see
Modular hashing in https://algs4.cs.princeton.edu/34hash/. It serves
as a simple baseline that distributes better than the old mysql5x
algorithms
- CRC32C uses my_crc32c.
- XXH32 and XXH3 are xxhash algorithms - xxhash.h copied from latest
release (0.8.3) of https://github.com/Cyan4973/xxHash
For performance (esp. xxh) we use one-shot hash functions in binary
hash_sort, and streaming hash function otherwise for byte-by-byte
hashing. XXH is the only stateful hash function. The other hash
algorithms are stateless and homomorphic, so streaming and one-shot
functions are identical.
Also updated the columnstore hash due to the change of MY_HASH_ADD
signature.
The following testing commands were run at an earlier version of the
patch with the following patch that changes the default algorithm from
MYSQL55 to CRC32C, and XXH32 (changing the patch accordingly)
mtr --suite main --do-test=.*partition
mtr --suite parts
modified sql/ha_partition.cc
@@ -10336,6 +10336,8 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
switch ((*field_array)->table->part_info->key_algorithm)
{
case partition_info::KEY_ALGORITHM_NONE:
+ hasher.set_algorithm(HASH_ALGORITHM_CRC32C);
+ break;
case partition_info::KEY_ALGORITHM_55:
/* Hasher default to mysql55 */
break;
modified sql/partition_info.cc
@@ -2328,7 +2328,7 @@ bool partition_info::fix_parser_data(THD *thd)
if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
key_algorithm == KEY_ALGORITHM_NONE)
- key_algorithm= KEY_ALGORITHM_55;
+ key_algorithm= PARTITION_INFO_DEFAULT_ALGORITHM;
}
DBUG_RETURN(FALSE);
}
@@ -2344,7 +2344,7 @@ bool partition_info::fix_parser_data(THD *thd)
if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
key_algorithm == KEY_ALGORITHM_NONE)
- key_algorithm= KEY_ALGORITHM_55;
+ key_algorithm= PARTITION_INFO_DEFAULT_ALGORITHM;
}
defined_max_value= FALSE; // in case it already set (CREATE TABLE LIKE)
do
modified sql/partition_info.h
@@ -446,6 +446,8 @@ class partition_info : public DDL_LOG_STATE, public Sql_alloc
int gen_part_type(THD *thd, String *str) const;
};
+#define PARTITION_INFO_DEFAULT_ALGORITHM partition_info::KEY_ALGORITHM_CRC32C
+
void part_type_error(THD *thd, partition_info *work_part_info,
const char *part_type, partition_info *tab_part_info);
modified sql/sql_partition.cc
@@ -2471,7 +2471,7 @@ static int add_key_with_algorithm(String *str, const partition_info *part_info)
err+= str->append(STRING_WITH_LEN("KEY "));
if (part_info->key_algorithm != partition_info::KEY_ALGORITHM_NONE &&
- part_info->key_algorithm != partition_info::KEY_ALGORITHM_55)
+ part_info->key_algorithm != PARTITION_INFO_DEFAULT_ALGORITHM)
{
err+= str->append(STRING_WITH_LEN("ALGORITHM = "));
switch (part_info->key_algorithm)
@@ -2479,6 +2479,9 @@ static int add_key_with_algorithm(String *str, const partition_info *part_info)
case partition_info::KEY_ALGORITHM_51:
err+= str->append(STRING_WITH_LEN("MYSQL51"));
break;
+ case partition_info::KEY_ALGORITHM_55:
+ err+= str->append(STRING_WITH_LEN("MYSQL55"));
+ break;
case partition_info::KEY_ALGORITHM_BASE31:
err+= str->append(STRING_WITH_LEN("BASE31"));
break;
|
||
|---|---|---|
| .. | ||
| ftbench | ||
| mysql-test | ||
| ChangeLog | ||
| CMakeLists.txt | ||
| ft_boolean_search.c | ||
| ft_myisam.c | ||
| ft_nlq_search.c | ||
| ft_parser.c | ||
| ft_static.c | ||
| ft_stopwords.c | ||
| ft_update.c | ||
| ftdefs.h | ||
| fulltext.h | ||
| ha_myisam.cc | ||
| ha_myisam.h | ||
| mi_cache.c | ||
| mi_changed.c | ||
| mi_check.c | ||
| mi_checksum.c | ||
| mi_close.c | ||
| mi_create.c | ||
| mi_dbug.c | ||
| mi_delete.c | ||
| mi_delete_all.c | ||
| mi_delete_table.c | ||
| mi_dynrec.c | ||
| mi_extra.c | ||
| mi_extrafunc.h | ||
| mi_info.c | ||
| mi_key.c | ||
| mi_keycache.c | ||
| mi_locking.c | ||
| mi_log.c | ||
| mi_open.c | ||
| mi_packrec.c | ||
| mi_page.c | ||
| mi_panic.c | ||
| mi_preload.c | ||
| mi_range.c | ||
| mi_rename.c | ||
| mi_rfirst.c | ||
| mi_rkey.c | ||
| mi_rlast.c | ||
| mi_rnext.c | ||
| mi_rnext_same.c | ||
| mi_rprev.c | ||
| mi_rrnd.c | ||
| mi_rsame.c | ||
| mi_rsamepos.c | ||
| mi_scan.c | ||
| mi_search.c | ||
| mi_static.c | ||
| mi_statrec.c | ||
| mi_test1.c | ||
| mi_test2.c | ||
| mi_test3.c | ||
| mi_test_all.res | ||
| mi_test_all.sh | ||
| mi_unique.c | ||
| mi_update.c | ||
| mi_write.c | ||
| myisam_ftdump.c | ||
| myisamchk.c | ||
| myisamdef.h | ||
| myisamlog.c | ||
| myisampack.c | ||
| NEWS | ||
| rt_index.c | ||
| rt_index.h | ||
| rt_key.c | ||
| rt_key.h | ||
| rt_mbr.c | ||
| rt_mbr.h | ||
| rt_split.c | ||
| rt_test.c | ||
| sort.c | ||
| sp_defs.h | ||
| sp_key.c | ||
| sp_test.c | ||
| test_pack | ||