[Commits] Rev 2877: Added to Aria better hash for packed numeric data for unique handling. in http://bazaar.launchpad.net/~maria-captains/maria/5.3/

serg at askmonty.org serg at askmonty.org
Fri Jan 14 12:37:26 EET 2011


At http://bazaar.launchpad.net/~maria-captains/maria/5.3/

------------------------------------------------------------
revno: 2877
revision-id: sergii at pisem.net-20110114103723-nb9v31w883l4ryzg
parent: sergii at pisem.net-20110114103441-x5yj6kyvctzwge92
committer: Sergei Golubchik <sergii at pisem.net>
branch nick: 5.3-monty
timestamp: Fri 2011-01-14 11:37:23 +0100
message:
  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.
-------------- next part --------------
=== modified file 'include/m_ctype.h'
--- a/include/m_ctype.h	2010-04-02 09:20:09 +0000
+++ b/include/m_ctype.h	2011-01-14 10:37:23 +0000
@@ -357,6 +357,9 @@ extern int  my_strnncollsp_simple(CHARSE
 extern void my_hash_sort_simple(CHARSET_INFO *cs,
                                 const uchar *key, size_t len,
                                 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);
 

=== modified file 'storage/maria/ma_unique.c'
--- a/storage/maria/ma_unique.c	2010-09-07 20:57:00 +0000
+++ b/storage/maria/ma_unique.c	2011-01-14 10:37:23 +0000
@@ -134,13 +134,14 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUE
       keyseg->charset->coll->hash_sort(keyseg->charset,
                                        (const uchar*) pos, length, &seed1,
                                        &seed2);
-      crc^= seed1;
+      crc+= seed1;
     }
     else
-      while (pos != end)
-        crc=((crc << 8) +
-             (((uchar)  *pos++))) +
-          (crc >> (8*sizeof(ha_checksum)-8));
+    {
+      my_hash_sort_bin((CHARSET_INFO*) 0, pos, (size_t) (end-pos),
+                       &seed1, &seed2);
+      crc+= seed1;
+    }
   }
   return crc;
 }



More information about the commits mailing list