List:Commits« Previous MessageNext Message »
From:gluh Date:November 14 2007 12:19pm
Subject:bk commit into 5.1 tree (gluh:1.2610) BUG#32178
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-14 16:19:38+04:00, gluh@stripped +2 -0
  Bug#32178 server crash when select from i_s and concurrent partition management
  The crash happens because of the following problem:
  prep_alter_part_table() func uses table name lock
  but I_S table opening does not use it.
  In I_S during table processing we can get discrepancy
  between share->partition_info and total number of partitions
  which obtained from par file.
  
  The fix:
  check if partition info is synchronized
  with the information in par file.
  Total number of partitons in part_info should be
  equal to(or less than) ha_partition::m_tot_parts value.
  If information is inconsistent then write a message to
  PARTITION_COMMENT field.

  sql/sql_show.cc@stripped, 2007-11-14 16:19:36+04:00, gluh@stripped +31 -0
    check if partition info is synchronized
    with the information in par file.
    Total number of partitons in part_info should be
    equal to(or less than) ha_partition::m_tot_parts value.

  sql/table.cc@stripped, 2007-11-14 16:19:36+04:00, gluh@stripped +8 -1
    added check for the result of mysql_unpack_partition()

diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc	2007-10-23 13:20:49 +05:00
+++ b/sql/sql_show.cc	2007-11-14 16:19:36 +04:00
@@ -4715,12 +4715,43 @@ static int get_schema_partitions_record(
     partition_element *part_elem;
     List_iterator<partition_element> part_it(part_info->partitions);
     uint part_pos= 0, part_id= 0;
+    uint no_parts= 0;
 
+    /*
+      check if partition info is synchronized
+      with the information in par file.
+      Total number of partitons in part_info should be
+      equal(or less) to ha_partition::m_tot_parts value.
+    */
+    file->get_no_parts(show_table->s->normalized_path.str, &no_parts);
+    while ((part_elem= part_it++))
+    {
+      if (part_elem->subpartitions.elements)
+      {
+        List_iterator<partition_element> sub_it(part_elem->subpartitions);
+        while ((part_elem= sub_it++))
+          part_id++;
+      }
+      else
+        part_id++;
+    }
     restore_record(table, s->default_values);
     table->field[1]->store(db_name->str, db_name->length, cs);
     table->field[2]->store(table_name->str, table_name->length, cs);
 
+    if (no_parts < part_id)
+    {
+      /* write error message into PARTITION_COMMENT field */
+      table->field[22]->store(STRING_WITH_LEN
+                              ("The partition info in the frm file is not consistent with the info in par file"),
+                              cs);
+      if(schema_table_store_record(thd, table))
+        DBUG_RETURN(1);
+      DBUG_RETURN(0);
+    }
 
+    part_id= 0;
+    part_it.rewind();
     /* Partition method*/
     switch (part_info->part_type) {
     case RANGE_PARTITION:
diff -Nrup a/sql/table.cc b/sql/table.cc
--- a/sql/table.cc	2007-10-23 19:02:26 +05:00
+++ b/sql/table.cc	2007-11-14 16:19:36 +04:00
@@ -1784,12 +1784,18 @@ int open_table_from_share(THD *thd, TABL
                                 outparam, is_create_table,
                                 share->default_part_db_type,
                                 &work_part_info_used);
+    if (tmp)
+    {
+      thd->stmt_arena= backup_stmt_arena_ptr;
+      thd->restore_active_arena(&part_func_arena, &backup_arena);
+      goto part_error;
+    }
     outparam->part_info->is_auto_partitioned= share->auto_partitioned;
     DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned));
     /* we should perform the fix_partition_func in either local or
        caller's arena depending on work_part_info_used value
     */
-    if (!tmp && !work_part_info_used)
+    if (!work_part_info_used)
       tmp= fix_partition_func(thd, outparam, is_create_table);
     thd->stmt_arena= backup_stmt_arena_ptr;
     thd->restore_active_arena(&part_func_arena, &backup_arena);
@@ -1799,6 +1805,7 @@ int open_table_from_share(THD *thd, TABL
         tmp= fix_partition_func(thd, outparam, is_create_table);
       outparam->part_info->item_free_list= part_func_arena.free_list;
     }
+part_error:
     if (tmp)
     {
       if (is_create_table)
Thread
bk commit into 5.1 tree (gluh:1.2610) BUG#32178gluh14 Nov