List:Commits« Previous MessageNext Message »
From:ramil Date:July 10 2007 8:09am
Subject:bk commit into 5.1 tree (ramil:1.2544) BUG#29652
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of ram. When ram 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-07-10 13:09:07+05:00, ramil@stripped +3 -0
  Fix for bug #29652: csv.test failure: two changes conflict after merge
  
  Problem: we don't take into account the length of the data written
  to the temporary data file during update on a CSV table.
  
  Fix: properly calculate the data file length during update.

  mysql-test/r/csv.result@stripped, 2007-07-10 13:09:05+05:00, ramil@stripped +2 -0
    Fix for bug #29652: csv.test failure: two changes conflict after merge
      - test result adjusted.

  storage/csv/ha_tina.cc@stripped, 2007-07-10 13:09:06+05:00, ramil@stripped +13 -2
    Fix for bug #29652: csv.test failure: two changes conflict after merge
      - adjust local_saved_data_file_length in case of update as well.

  storage/csv/ha_tina.h@stripped, 2007-07-10 13:09:06+05:00, ramil@stripped +1 -0
    Fix for bug #29652: csv.test failure: two changes conflict after merge
      - adjust local_saved_data_file_length in case of update as well.

diff -Nrup a/mysql-test/r/csv.result b/mysql-test/r/csv.result
--- a/mysql-test/r/csv.result	2007-07-09 14:26:59 +05:00
+++ b/mysql-test/r/csv.result	2007-07-10 13:09:05 +05:00
@@ -4945,6 +4945,8 @@ SELECT * FROM bug13894;
 val
 6
 6
+5
+11
 DROP TABLE bug13894;
 DROP TABLE IF EXISTS bug14672;
 CREATE TABLE bug14672 (c1 integer) engine = CSV;
diff -Nrup a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
--- a/storage/csv/ha_tina.cc	2007-07-09 13:54:22 +05:00
+++ b/storage/csv/ha_tina.cc	2007-07-10 13:09:06 +05:00
@@ -904,6 +904,7 @@ int ha_tina::open_update_temp_file_if_ne
                      0, O_RDWR | O_TRUNC, MYF(MY_WME))) < 0)
       return 1;
     share->update_file_opened= TRUE;
+    temp_file_length= 0;
   }
   return 0;
 }
@@ -928,6 +929,13 @@ int ha_tina::update_row(const uchar * ol
 
   size= encode_quote(new_data);
 
+  /*
+    During update we mark each updating record as deleted 
+    (see the chain_append()) then write new one to the temporary data file. 
+    At the end of the sequence in the rnd_end() we append all non-marked
+    records from the data file to the temporary data file then rename it.
+    The temp_file_length is used to calculate new data file length.
+  */
   if (chain_append())
     DBUG_RETURN(-1);
 
@@ -937,6 +945,7 @@ int ha_tina::update_row(const uchar * ol
   if (my_write(update_temp_file, (uchar*)buffer.ptr(), size,
                MYF(MY_WME | MY_NABP)))
     DBUG_RETURN(-1);
+  temp_file_length+= size;
 
   /* UPDATE should never happen on the log tables */
   DBUG_ASSERT(!share->is_log_table);
@@ -1154,7 +1163,6 @@ int ha_tina::rnd_end()
 
   if ((chain_ptr - chain)  > 0)
   {
-    off_t temp_file_length= 0;
     tina_set *ptr= chain;
 
     /*
@@ -1244,7 +1252,10 @@ int ha_tina::rnd_end()
       Here we record this fact to the meta-file.
     */
     (void)write_meta_file(share->meta_file, share->rows_recorded, FALSE);
-    
+    /* 
+      Update local_saved_data_file_length with the real length of the 
+      data file.
+    */
     local_saved_data_file_length= temp_file_length;
   }
 
diff -Nrup a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
--- a/storage/csv/ha_tina.h	2007-06-13 01:12:35 +05:00
+++ b/storage/csv/ha_tina.h	2007-07-10 13:09:06 +05:00
@@ -63,6 +63,7 @@ class ha_tina: public handler
   off_t current_position;  /* Current position in the file during a file scan */
   off_t next_position;     /* Next position in the file scan */
   off_t local_saved_data_file_length; /* save position for reads */
+  off_t temp_file_length;
   uchar byte_buffer[IO_SIZE];
   Transparent_file *file_buff;
   File data_file;                   /* File handler for readers */
Thread
bk commit into 5.1 tree (ramil:1.2544) BUG#29652ramil10 Jul