[Commits] Rev 2878: 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
Thu Jan 13 16:45:14 EET 2011


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

------------------------------------------------------------
revno: 2878
revision-id: sergii at pisem.net-20110113144508-zyefft400puxfxv4
parent: sergii at pisem.net-20110113142920-1dxzs2zivni4p476
committer: Sergei Golubchik <sergii at pisem.net>
branch nick: 5.3-monty
timestamp: Thu 2011-01-13 15:45:08 +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-13 14:45:08 +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	2011-01-13 14:29:20 +0000
+++ b/storage/maria/ma_unique.c	2011-01-13 14:45:08 +0000
@@ -135,13 +135,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