List:Commits« Previous MessageNext Message »
From:ingo Date:June 27 2007 8:27pm
Subject:bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827
View as plain text  
Below is the list of changes that have just been committed into a local
6.0-falcon repository of istruewing. When istruewing 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-06-27 20:26:52+02:00, istruewing@stripped +4 -0
  Bug#26827 - table->read_set is set incorrectly,
              causing update of a different column
  
  For efficiency some storage engines do not read a complete record
  for update, but only the columns required for selecting the rows.
  
  When updating a row of a partitioned table, modifying a column
  that is part of the partition or subpartition expression, then
  the row may need to move from one [sub]partition to another one.
  This is done by inserting the new row into the target
  [sub]partition and deleting the old row from the originating one.
  For the insert we need a complete record.
  
  If an above mentioned engine was used for a partitioned table, we
  did not have a complete record in update_row(). The implicitly
  executed write_row() got an incomplete record.
  
  This is solved by instructing the engine to read a complete record
  if one of the columns of the partition or subpartiton is to be
  updated.

  mysql-test/t/disabled.def@stripped, 2007-06-27 20:26:46+02:00, istruewing@stripped +0 -1
    Bug#26827 - table->read_set is set incorrectly,
                causing update of a different column
    Enabled test case.

  sql/ha_partition.cc@stripped, 2007-06-27 20:26:46+02:00, istruewing@stripped +12 -1
    Bug#26827 - table->read_set is set incorrectly,
                causing update of a different column
    Setting all bits in read_set if write_set contains a column
    used in a partition or subpartition expression.

  sql/partition_info.h@stripped, 2007-06-27 20:26:46+02:00, istruewing@stripped +7 -0
    Bug#26827 - table->read_set is set incorrectly,
                causing update of a different column
    Added a bitmap to partition_info for a quick check of
    columns used in a partition or subpartition expression.

  sql/sql_partition.cc@stripped, 2007-06-27 20:26:46+02:00, istruewing@stripped +22 -0
    Bug#26827 - table->read_set is set incorrectly,
                causing update of a different column
    Initializing the new bitmap with all columns used in a
    partition or subpartition expression.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	istruewing
# Host:	chilla.local
# Root:	/home/mydev/mysql-5.1-falcon-bug26827

--- 1.335/mysql-test/t/disabled.def	2007-06-27 20:27:05 +02:00
+++ 1.336/mysql-test/t/disabled.def	2007-06-27 20:27:05 +02:00
@@ -68,7 +68,6 @@ falcon_bug_24024    : Bug#24024 2006-12-
 falcon_bug_26058    : Bug#26058 2007-05-03 hakank Currently failing
 #falcon_bug_26433    : Bug#26433 2007-02-16 hakank Currently failing
 #falcon_bug_26607    : Bug#26607 2007-02-23 hakank Currently failing
-falcon_bug_26827    : Bug#26827 2007-03-04 hakank Currently failing
 falcon_bug_27426    : Bug#27426 2007-03-27 hakank Currently failing
 falcon_bug_27997    : Bug#27997 2007-04-21 hakank Currently failing
 falcon_bug_28026    : Bug#28026 2007-04-25 hakank Currently failing

--- 1.88/sql/ha_partition.cc	2007-06-27 20:27:05 +02:00
+++ 1.89/sql/ha_partition.cc	2007-06-27 20:27:05 +02:00
@@ -2961,7 +2961,18 @@ int ha_partition::rnd_init(bool scan)
   DBUG_ENTER("ha_partition::rnd_init");
 
   include_partition_fields_in_used_fields();
-  
+
+  /*
+    If write_set contains any of the fields used in partition and
+    subpartition expression, we need to set all bits in read_set because
+    the row may need to be inserted in a different [sub]partition. In
+    other words update_row() can be converted into write_row(), which
+    requires a complete record.
+  */
+  if (bitmap_is_overlapping(&m_part_info->full_part_field_set,
+                            table->write_set))
+    bitmap_set_all(table->read_set);
+
   /* Now we see what the index of our first important partition is */
   DBUG_PRINT("info", ("m_part_info->used_partitions: 0x%lx",
                       (long) m_part_info->used_partitions.bitmap));

--- 1.106/sql/sql_partition.cc	2007-06-27 20:27:05 +02:00
+++ 1.107/sql/sql_partition.cc	2007-06-27 20:27:05 +02:00
@@ -578,6 +578,28 @@ static bool create_full_part_field_array
     part_info->full_part_field_array= field_array;
     part_info->no_full_part_fields= no_part_fields;
   }
+
+  /*
+    Initialize the set of all fields used in partition and subpartition
+    expression. Required for testing of partition fields in write_set
+    when updating. We need to set all bits in read_set because the row
+    may need to be inserted in a different [sub]partition.
+  */
+  if (bitmap_init(&part_info->full_part_field_set, NULL,
+                  table->s->fields, FALSE))
+  {
+    mem_alloc_error(table->s->fields);
+    result= TRUE;
+    goto end;
+  }
+  /*
+    full_part_field_array may be NULL if storage engine supports native
+    partitioning.
+  */
+  if ((ptr= part_info->full_part_field_array))
+    while (*ptr)
+      bitmap_set_bit(&part_info->full_part_field_set, (*ptr++)->field_index);
+
 end:
   DBUG_RETURN(result);
 }

--- 1.23/sql/partition_info.h	2007-06-27 20:27:05 +02:00
+++ 1.24/sql/partition_info.h	2007-06-27 20:27:05 +02:00
@@ -81,6 +81,13 @@ public:
   */
   Field **full_part_field_array;
   Field **full_part_charset_field_array;
+  /*
+    Set of all fields used in partition and subpartition expression.
+    Required for testing of partition fields in write_set when
+    updating. We need to set all bits in read_set because the row may
+    need to be inserted in a different [sub]partition.
+  */
+  MY_BITMAP full_part_field_set;
 
   /*
     When we have a field that requires transformation before calling the
Thread
bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827ingo27 Jun
  • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Sergei Golubchik3 Jul
    • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Ingo Strüwing3 Jul
      • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Sergei Golubchik3 Jul
        • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Ingo Strüwing3 Jul
          • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Ingo Strüwing3 Jul
            • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Sergei Golubchik3 Jul
        • Re: bk commit into 6.0-falcon tree (istruewing:1.2567) BUG#26827Konstantin Osipov4 Jul