| Bug #56438 | Make it possible for handler to affect the hash value for partition | ||
|---|---|---|---|
| Submitted: | 1 Sep 2010 8:56 | Modified: | 27 Jan 2011 16:55 | 
| Reporter: | Magnus Blåudd | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Partitions | Severity: | S2 (Serious) | 
| Version: | 5.5.7-m3 | OS: | Any | 
| Assigned to: | Mattias Jonsson | CPU Architecture: | Any | 
| Tags: | SEAGULL | ||
   [1 Sep 2010 9:15]
   Magnus Blåudd        
  Function can actually be marked 'const', there should be no need for the handler to update any of its member data as part if this call.
   [8 Sep 2010 11:43]
   Mattias Jonsson        
  [Mikael] This is a necessary fix to the partitioning to enable handlers to take care of the hash value calculation. This is a must for the NDB engine. Fix should have been done already on 5.1 but this wasn't done for some reason.
   [28 Oct 2010 15:22]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/122220 3545 Mattias Jonsson 2010-10-28 Bug#56438: Make it possible for handler to affect the hash value for partition This is a necessary fix to the partitioning to enable handlers to take care of the hash value calculation. This is a must for the NDB engine. Fix should have been done already on 5.1 but this wasn't done for some reason. @ sql/ha_partition.cc Moved calculate_key_value from sql_partition.cc to here as ha_partition::calculate_key_hash_value. @ sql/ha_partition.h Extended set_part_info and added calculate_key_hash_value @ sql/handler.h Extended set_part_info and added calculate_key_hash_value @ sql/partition_info.h Added a reference to the table instance. @ sql/sql_partition.cc Using the handlers calculate_key_hash_value (the old calculate_key_value was moved to ha_partition.cc) and setting the table reference on part_info
   [2 Nov 2010 13:21]
   Magnus Blåudd        
  Patch is OK.
   [2 Nov 2010 13:56]
   Mattias Jonsson        
  Related to bug#29550.
   [26 Jan 2011 21:15]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/129705 3557 Mattias Jonsson 2011-01-26 [merge] merge of bug#56438 into mysql-trunk
   [26 Jan 2011 21:16]
   Bugs System        
  Pushed into mysql-trunk 5.6.2 (revid:mattias.jonsson@oracle.com-20110126211256-7netk3waleausbsw) (version source revid:mattias.jonsson@oracle.com-20110126211256-7netk3waleausbsw) (merge vers: 5.6.2) (pib:24)
   [27 Jan 2011 16:41]
   Jon Stephens        
  Mattias, Magnus -- I don't see how this impacts end users. Can you help me out? Thanks!
   [27 Jan 2011 16:50]
   Mattias Jonsson        
  This does not impact any end user. Only internal for engine developers.
   [27 Jan 2011 16:55]
   Jon Stephens        
  That's what I thought. :) No end-user changes to document per developer comment above; closed without further action.

Description: It should be possible for a handler/engine to influence the hash value used for partitioning. How to repeat: . Suggested fix: Extend handler with with a new function 'calculate_key_hash_value' which takes an array of the fields which the partition key consist of and returns a uint32. This function would then be called instead of 'calculate_key_value' in the partitioning functions in sql_partition.cc The default 'calculate_key_value' implementation would be moved to ha_partition::calculate_key_hash_value. === modified file 'sql/handler.h' --- sql/handler.h 2010-08-18 11:55:37 +0000 +++ sql/handler.h 2010-09-01 08:50:18 +0000 @@ -1562,6 +1562,8 @@ public: virtual int info(uint)=0; // see my_base.h for full description virtual void get_dynamic_partition_info(PARTITION_STATS *stat_info, uint part_id); + virtual uint32 calculate_key_hash_value(Field **field_array) + { DBUG_ASSERT(0); return 0; } virtual int extra(enum ha_extra_function operation) { return 0; } virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)