Commit fba96f7c authored by Sergei Golubchik's avatar Sergei Golubchik

Added to Aria better hash for packed numeric data for unique handling.

This was needed as the old code caused us to have LOTS of duplicate
hash values when used by optimizer.

include/m_ctype.h:
  Made my_hash_sort_bin() exernal
storage/maria/ma_unique.c:
  Better hash for packed numeric data for unique handling.
  This was needed as the old code caused us to have LOTS
  of duplicate hash values when used by optimizer.
parent 3d5868c6
...@@ -357,6 +357,9 @@ extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t, ...@@ -357,6 +357,9 @@ extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
extern void my_hash_sort_simple(CHARSET_INFO *cs, extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, size_t len, const uchar *key, size_t len,
ulong *nr1, ulong *nr2); ulong *nr1, ulong *nr2);
extern void my_hash_sort_bin(CHARSET_INFO *cs,
const uchar *key, size_t len, ulong *nr1,
ulong *nr2);
extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length); extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
......
...@@ -134,13 +134,14 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record) ...@@ -134,13 +134,14 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
keyseg->charset->coll->hash_sort(keyseg->charset, keyseg->charset->coll->hash_sort(keyseg->charset,
(const uchar*) pos, length, &seed1, (const uchar*) pos, length, &seed1,
&seed2); &seed2);
crc^= seed1; crc+= seed1;
} }
else else
while (pos != end) {
crc=((crc << 8) + my_hash_sort_bin((CHARSET_INFO*) 0, pos, (size_t) (end-pos),
(((uchar) *pos++))) + &seed1, &seed2);
(crc >> (8*sizeof(ha_checksum)-8)); crc+= seed1;
}
} }
return crc; return crc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment