List:Commits« Previous MessageNext Message »
From:Charles Bell Date:November 12 2009 8:40pm
Subject:Re: bzr commit into mysql-6.0-backup branch (charles.bell:2888)
Bug#47879
View as plain text  
Ingo,

 > 2) A different question is: How do we come back to the main partition
 > list? If I understand the function correctly, it checks, if all
 > partitions have the same engine type. With the new code, won't we just
 > check the subpartitions of the first partition? If that subpartition
 > list is at its end, won't the 'while' loop just end?

Can I ask a huge favor? Can you check my logic for my solution to this 
problem? If you'd rather see a working committed patch I'll understand 
and get that to your right away. Bug given that I underestimated the 
complexity in my first attempt another pair of eyes is warranted.

>> +        List_iterator<partition_element>
> p_sub_it(p_el->subpartitions);
>> +        if (!p_el->engine_type)
>> +        {
>> +          p_el= p_sub_it++;
>> +          p_it= p_sub_it;
>> +        }
> 
> 
> 1) Can we rely on a non-Null engine type in all subpartitions? Probably
> yes. But then I'd still add an assert, just to be safe.

Do you mean we should assert on p_el->subpartitions? Does the new code 
cover your concern?

Thanks,

Chuck

DIFF for new code:

=== modified file 'sql/backup/backup_info.cc'
--- sql/backup/backup_info.cc	2009-10-23 15:41:56 +0000
+++ sql/backup/backup_info.cc	2009-11-12 20:32:46 +0000
@@ -31,6 +31,50 @@
  #include "be_snapshot.h"
  #include "be_nodata.h"

+/// Check partitions for common storage engine.
+
+bool partitions_have_same_engine(List_iterator<partition_element> p_it,
+                                 storage_engine_ref *se_tmp)
+{
+  partition_element *p_el;
+  while (p_el= p_it++)
+  {
+    /*
+      If this partition has subpartitions, we must traverse the 
subpartitions
+      list instead of the partitions list.
+    */
+    if (!p_el->engine_type)
+    {
+      List_iterator<partition_element> p_sub_it(p_el->subpartitions);
+      if (!partitions_have_same_engine(p_sub_it, se_tmp))
+        return FALSE;
+    }
+    else
+    {
+      if (!*se_tmp)
+      {
+        *se_tmp= hton2plugin[p_el->engine_type->slot];
+        ::handlerton *h= se_hton(*se_tmp);
+
+        /*
+           Native drivers don't support partitioning. Let Falcon and
+           InnoDB use Snapshot driver; all other storage engines use
+           Default.
+        */
+        if (h->start_consistent_snapshot == NULL)
+          return FALSE; // This is not a Falcon or InnoDB storage engine.
+
+        continue;
+      }
+
+      // Use Default driver if partitions have different storage engines.
+      if (*se_tmp != hton2plugin[p_el->engine_type->slot])
+        return FALSE;
+    }
+  }
+  return TRUE;
+}
+

  /// Return storage engine of a given table.

@@ -65,30 +109,8 @@ storage_engine_ref get_storage_engine(TH
        partition_info *p_info=  table->part_info;
        List_iterator<partition_element> p_it(p_info->partitions);
        partition_element *p_el;
-
-      while ((p_el= p_it++))
-      {
-        if (!se_tmp)
-        {
-          se_tmp= hton2plugin[p_el->engine_type->slot];
-          ::handlerton *h= se_hton(se_tmp);
-
-          /*
-             Native drivers don't support partitioning. Let Falcon and
-             InnoDB use Snapshot driver; all other storage engines use
-             Default.
-          */
-          if (h->start_consistent_snapshot == NULL)
-            goto close; // This is not a Falcon or InnoDB storage engine.
-
-          continue;
-        }
-
-        // Use Default driver if partitions have different storage engines.
-        if (se_tmp != hton2plugin[p_el->engine_type->slot])
-          goto close;
-      };
-
+      if (!partitions_have_same_engine(p_it, &se_tmp))
+        goto close;
        se= se_tmp;
      }


Thread
bzr commit into mysql-6.0-backup branch (charles.bell:2888) Bug#47879Chuck Bell6 Nov
  • Re: bzr commit into mysql-6.0-backup branch (charles.bell:2888)Bug#47879Ingo Strüwing12 Nov
    • Re: bzr commit into mysql-6.0-backup branch (charles.bell:2888)Bug#47879Charles Bell12 Nov
      • Re: bzr commit into mysql-6.0-backup branch (charles.bell:2888)Bug#47879Ingo Strüwing13 Nov