List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:February 3 2011 11:30am
Subject:bzr push into mysql-5.5-telco-7.0 branch (magnus.blaudd:3169 to 3170)
View as plain text  
 3170 Magnus Blåudd	2011-02-03
      ndb
       - add MCP patch for bug56438 to 5.5-telco-7.0

    modified:
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/handler.h
      sql/partition_info.h
      sql/sql_partition.cc
 3169 Magnus Blåudd	2011-02-02
      ndb
       - add include file to check for ALTER [ONLINE|OFFLINE] syntax support
       - include it in tests which rely on this functionality

    added:
      mysql-test/include/ndb_have_online_alter.inc
    modified:
      mysql-test/suite/ndb/t/ndb_add_partition.test
      mysql-test/suite/ndb/t/ndb_addnode.test
      mysql-test/suite/ndb/t/ndb_alter_table_online.test
      mysql-test/suite/ndb/t/ndb_alter_table_online2.test
      mysql-test/suite/ndb/t/ndb_database.test
      mysql-test/suite/ndb/t/ndb_native_default_support.test
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2010-11-16 12:37:26 +0000
+++ b/sql/ha_partition.cc	2011-02-03 11:29:18 +0000
@@ -6300,6 +6300,32 @@ uint8 ha_partition::table_cache_type()
   DBUG_RETURN(m_file[0]->table_cache_type());
 }
 
+#ifndef MCP_BUG56438
+/**
+  Calculate hash value for KEY partitioning using an array of fields.
+
+  @param field_array   An array of the fields in KEY partitioning
+
+  @return hash_value calculated
+
+  @note Uses the hash function on the character set of the field.
+  Integer and floating point fields use the binary character set by default.
+*/
+
+uint32 ha_partition::calculate_key_hash_value(Field **field_array)
+{
+  ulong nr1= 1;
+  ulong nr2= 4;
+
+  do
+  {
+    Field *field= *field_array;
+    field->hash(&nr1, &nr2);
+  } while (*(++field_array));
+  return (uint32) nr1;
+}
+#endif
+
 
 /****************************************************************************
                 MODULE print messages

=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h	2010-11-16 12:37:26 +0000
+++ b/sql/ha_partition.h	2011-02-03 11:29:18 +0000
@@ -166,7 +166,11 @@ private:
   enum_monotonicity_info m_part_func_monotonicity_info;
 public:
   handler *clone(MEM_ROOT *mem_root);
+#ifndef MCP_BUG56438
+  virtual void set_part_info(partition_info *part_info, bool early)
+#else
   virtual void set_part_info(partition_info *part_info)
+#endif
   {
      m_part_info= part_info;
      m_is_sub_partitioned= part_info->is_sub_partitioned();
@@ -599,6 +603,11 @@ public:
   virtual uint8 table_cache_type();
   virtual ha_rows records();
 
+#ifndef MCP_BUG56438
+  /* Calculate hash value for PARTITION BY KEY tables. */
+  uint32 calculate_key_hash_value(Field **field_array);
+#endif
+
   /*
     -------------------------------------------------------------------------
     MODULE print messages

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2010-11-16 12:37:26 +0000
+++ b/sql/handler.h	2011-02-03 11:29:18 +0000
@@ -1563,6 +1563,10 @@ 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);
+#ifndef MCP_BUG56438
+  virtual uint32 calculate_key_hash_value(Field **field_array)
+  { DBUG_ASSERT(0); return 0; }
+#endif
   virtual int extra(enum ha_extra_function operation)
   { return 0; }
   virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
@@ -1700,7 +1704,11 @@ public:
     *no_parts= 0;
     return 0;
   }
+#ifndef MCP_BUG56438
+  virtual void set_part_info(partition_info *part_info, bool early) {return;}
+#else
   virtual void set_part_info(partition_info *part_info) {return;}
+#endif
 
   virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
 

=== modified file 'sql/partition_info.h'
--- a/sql/partition_info.h	2010-11-16 12:37:26 +0000
+++ b/sql/partition_info.h	2011-02-03 11:29:18 +0000
@@ -157,6 +157,10 @@ public:
   uint curr_list_object;
   uint num_columns;
 
+#ifndef MCP_BUG56438
+  TABLE *table;
+#endif
+
   /*
     These key_map's are used for Partitioning to enable quick decisions
     on whether we can derive more information about which partition to

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2010-11-16 12:37:26 +0000
+++ b/sql/sql_partition.cc	2011-02-03 11:29:18 +0000
@@ -1880,6 +1880,9 @@ bool fix_partition_func(THD *thd, TABLE
   set_up_partition_key_maps(table, part_info);
   set_up_partition_func_pointers(part_info);
   set_up_range_analysis_info(part_info);
+#ifndef MCP_BUG56438
+  table->file->set_part_info(part_info, FALSE);
+#endif
   result= FALSE;
 end:
   thd->mark_used_columns= save_mark_used_columns;
@@ -2717,6 +2720,14 @@ static inline int part_val_int(Item *ite
   hash value and some parameters calculated from the number of partitions.
 */
 
+#ifndef MCP_BUG56438
+/*
+  Obsoleted by handler::calculate_key_hash_value
+  Handlers can now implement their own calculate_key_hash_value function
+  or use the method defined in ha_partition.cc
+*/
+#else
+
 /*
   Calculate hash value for KEY partitioning using an array of fields.
 
@@ -2744,7 +2755,7 @@ static uint32 calculate_key_value(Field
   } while (*(++field_array));
   return (uint32) nr1;
 }
-
+#endif
 
 /*
   A simple support function to calculate part_id given local part and
@@ -2846,12 +2857,21 @@ static int get_part_id_linear_hash(parti
 */
 
 inline
+#ifndef MCP_BUG56438
+static uint32 get_part_id_key(handler *file,
+                              Field **field_array,
+#else
 static uint32 get_part_id_key(Field **field_array,
+#endif
                               uint num_parts,
                               longlong *func_value)
 {
   DBUG_ENTER("get_part_id_key");
+#ifndef MCP_BUG56438
+  *func_value= file->calculate_key_hash_value(field_array);
+#else
   *func_value= calculate_key_value(field_array);
+#endif
   DBUG_RETURN((uint32) (*func_value % num_parts));
 }
 
@@ -2878,7 +2898,11 @@ static uint32 get_part_id_linear_key(par
 {
   DBUG_ENTER("get_part_id_linear_key");
 
+#ifndef MCP_BUG56438
+  *func_value= part_info->table->file->calculate_key_hash_value(field_array);
+#else
   *func_value= calculate_key_value(field_array);
+#endif
   DBUG_RETURN(get_part_id_from_linear_hash(*func_value,
                                            part_info->linear_hash_mask,
                                            num_parts));
@@ -3566,7 +3590,12 @@ int get_partition_id_key_nosub(partition
                                 uint32 *part_id,
                                 longlong *func_value)
 {
+#ifndef MCP_BUG56438
+  *part_id= get_part_id_key(part_info->table->file,
+                            part_info->part_field_array,
+#else
   *part_id= get_part_id_key(part_info->part_field_array,
+#endif
                             part_info->num_parts, func_value);
   return 0;
 }
@@ -3656,7 +3685,12 @@ int get_partition_id_key_sub(partition_i
                              uint32 *part_id)
 {
   longlong func_value;
+#ifndef MCP_BUG56438
+  *part_id= get_part_id_key(part_info->table->file,
+                            part_info->subpart_field_array,
+#else
   *part_id= get_part_id_key(part_info->subpart_field_array,
+#endif
                             part_info->num_subparts, &func_value);
   return FALSE;
 }
@@ -4272,7 +4306,12 @@ bool mysql_unpack_partition(THD *thd,
     *work_part_info_used= true;
   }
   table->part_info= part_info;
+#ifndef MCP_BUG56438
+  part_info->table= table;
+  table->file->set_part_info(part_info, TRUE);
+#else
   table->file->set_part_info(part_info);
+#endif
   if (!part_info->default_engine_type)
     part_info->default_engine_type= default_db_type;
   DBUG_ASSERT(part_info->default_engine_type == default_db_type);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-telco-7.0 branch (magnus.blaudd:3169 to 3170) Magnus Blåudd3 Feb