List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:February 10 2011 9:05am
Subject:bzr push into mysql-trunk branch (mattias.jonsson:3598 to 3599) WL#5217
View as plain text  
 3599 Mattias Jonsson	2011-02-09
      WL#5217 Add explicit partition selection
      
      Updates according to joh's review:
      Fix so it also compiles without partitioning.
      Changed function names from has_unique_fields/names
      to find_duplicate_field/name.
      Added comments in sql_base.cc that I should move
      the code to prune_partitions when implementing
      worklog 4443.
     @ mysql-test/t/partition_binlog.test
        Disabled test for non partition builds
     @ sql/partition_info.cc
        Renamed has_unique_fields/names to find_duplicate_field/name
     @ sql/partition_info.h
        Renamed has_unique_fields/names to find_duplicate_field/name
     @ sql/sql_base.cc
        Added comment to move the code to prune_partitions
        when implementing worklog 4443.
     @ sql/table.cc
        Fix so it compiles without partitioning

    modified:
      mysql-test/t/partition_binlog.test
      sql/partition_info.cc
      sql/partition_info.h
      sql/sql_base.cc
      sql/table.cc
 3598 Mattias Jonsson	2011-02-03
      fix of failing test on windows; parts.partition_debug_innodb

    modified:
      mysql-test/suite/parts/inc/partition_fail.inc
=== modified file 'mysql-test/t/partition_binlog.test'
--- a/mysql-test/t/partition_binlog.test	2010-12-03 13:05:33 +0000
+++ b/mysql-test/t/partition_binlog.test	2011-02-09 22:35:46 +0000
@@ -1,4 +1,5 @@
 --source include/have_log_bin.inc
+--source include/have_partition.inc
 
 --disable_warnings
 DROP TABLE IF EXISTS t1;

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2011-02-02 22:02:29 +0000
+++ b/sql/partition_info.cc	2011-02-09 22:35:46 +0000
@@ -502,7 +502,7 @@ bool partition_info::set_up_defaults_for
   Support routine for check_partition_info
 
   SYNOPSIS
-    has_unique_fields
+    find_duplicate_field
     no parameters
 
   RETURN VALUE
@@ -513,13 +513,13 @@ bool partition_info::set_up_defaults_for
     Check that the user haven't defined the same field twice in
     key or column list partitioning.
 */
-char* partition_info::has_unique_fields()
+char* partition_info::find_duplicate_field()
 {
   char *field_name_outer, *field_name_inner;
   List_iterator<char> it_outer(part_field_list);
   uint num_fields= part_field_list.elements;
   uint i,j;
-  DBUG_ENTER("partition_info::has_unique_fields");
+  DBUG_ENTER("partition_info::find_duplicate_field");
 
   for (i= 0; i < num_fields; i++)
   {
@@ -609,7 +609,7 @@ partition_element *partition_info::get_p
 
 
 /**
-  Helper function to has_unique_names.
+  Helper function to find_duplicate_name.
 */
 
 static const char *get_part_name_from_elem(const char *name, size_t *length,
@@ -624,7 +624,7 @@ static const char *get_part_name_from_el
   partitioned table
 
   SYNOPSIS
-    has_unique_names()
+    find_duplicate_name()
 
   RETURN VALUES
     NULL               Has unique part and subpart names
@@ -635,7 +635,7 @@ static const char *get_part_name_from_el
     duplicated names.
 */
 
-char *partition_info::has_unique_names()
+char *partition_info::find_duplicate_name()
 {
   HASH partition_names;
   uint max_names;
@@ -644,7 +644,7 @@ char *partition_info::has_unique_names()
   List_iterator<partition_element> parts_it(partitions);
   partition_element *p_elem;  
 
-  DBUG_ENTER("partition_info::has_unique_names");
+  DBUG_ENTER("partition_info::find_duplicate_name");
   
   /*
     TODO: If table->s->ha_part_data->partition_name_hash.elements is > 0,
@@ -1373,12 +1373,12 @@ bool partition_info::check_partition_inf
   }
 
   if (part_field_list.elements > 0 &&
-      (same_name= has_unique_fields()))
+      (same_name= find_duplicate_field()))
   {
     my_error(ER_SAME_NAME_PARTITION_FIELD, MYF(0), same_name);
     goto end;
   }
-  if ((same_name= has_unique_names()))
+  if ((same_name= find_duplicate_name()))
   {
     my_error(ER_SAME_NAME_PARTITION, MYF(0), same_name);
     goto end;

=== modified file 'sql/partition_info.h'
--- a/sql/partition_info.h	2011-02-02 22:02:29 +0000
+++ b/sql/partition_info.h	2011-02-09 22:35:46 +0000
@@ -282,8 +282,8 @@ public:
 
   bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info,
                                         uint start_no);
-  char *has_unique_fields();
-  char *has_unique_names();
+  char *find_duplicate_field();
+  char *find_duplicate_name();
   bool check_engine_mix(handlerton *engine_type, bool default_engine);
   bool check_range_constants(THD *thd);
   bool check_list_constants(THD *thd);

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-02-02 22:02:29 +0000
+++ b/sql/sql_base.cc	2011-02-09 22:35:46 +0000
@@ -4672,6 +4672,11 @@ open_tables_check_upgradable_mdl(THD *th
 
 #ifdef WITH_PARTITION_STORAGE_ENGINE
 /*
+  TODO: Move all this to prune_partitions() when implementing WL#4443.
+  Needs all items and conds fixed (as in first part in JOIN::optimize,
+  mysql_prepare_delete). Ensure that prune_partitions() is called for all
+  statements supported by WL#5217.
+
   TODO: When adding support for FK in partitioned tables, update this function
   so the referenced table get correct locking.
 */
@@ -4692,11 +4697,6 @@ static bool prune_partition_locks(TABLE_
         */
         if (table->table->part_info->set_partition_bitmaps(table))
           DBUG_RETURN(TRUE);
-        /*
-          TODO: Add prune_partitions() here as WL#4443.
-          Needs all items and conds fixed (as in first part in JOIN::optimize,
-          mysql_prepare_delete).
-        */
       }
       else if (table->partition_names && table->partition_names->elements)
       {
@@ -4973,6 +4973,7 @@ restart:
   }
 
 #ifdef WITH_PARTITION_STORAGE_ENGINE
+  /* TODO: move this to prune_partitions() when implementing WL#4443. */
   /* Prune partitions to avoid unneccesary locks */
   if (prune_partition_locks(*start))
   {

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2011-02-02 22:02:29 +0000
+++ b/sql/table.cc	2011-02-09 22:35:46 +0000
@@ -204,6 +204,7 @@ static uchar *get_field_name(Field **buf
 }
 
 
+#ifdef WITH_PARTITION_STORAGE_ENGINE
 /**
   A function to return the partition name from a partition element
 */
@@ -213,6 +214,7 @@ uchar *get_part_name(PART_NAME_DEF *part
   *length= part->length;
   return part->partition_name;
 }
+#endif
 
 
 /*

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (mattias.jonsson:3598 to 3599) WL#5217Mattias Jonsson10 Feb