List:Internals« Previous MessageNext Message »
From:Petr Chardin Date:November 5 2005 1:08pm
Subject:bk commit into 4.1 tree (petr:1.2464) BUG#13894
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of cps. When cps 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
  1.2464 05/11/05 15:08:15 petr@stripped +3 -0
  Fix Bug#13894 Server crashes on update of CSV table

  sql/examples/ha_tina.cc
    1.9 05/11/05 15:07:59 petr@stripped +9 -10
    sort function should return reverted values for chains to be sorted in
    the right orded. don't do a strange memmove

  mysql-test/t/csv.test
    1.3 05/11/05 15:07:59 petr@stripped +18 -0
    Add test for a bug

  mysql-test/r/csv.result
    1.2 05/11/05 15:07:59 petr@stripped +20 -0
    update result file

# 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:	petr
# Host:	owlet.
# Root:	/home/cps/mysql/trees/mysql-4.1

--- 1.1/mysql-test/r/csv.result	2004-08-13 07:54:29 +04:00
+++ 1.2/mysql-test/r/csv.result	2005-11-05 15:07:59 +03:00
@@ -4929,3 +4929,23 @@
 Note	1051	Unknown table 't2'
 Note	1051	Unknown table 't3'
 Note	1051	Unknown table 't4'
+DROP TABLE IF EXISTS bug13894;
+CREATE TABLE bug13894 ( val integer ) ENGINE = CSV;
+INSERT INTO bug13894 VALUES (5);
+INSERT INTO bug13894 VALUES (10);
+INSERT INTO bug13894 VALUES (11);
+INSERT INTO bug13894 VALUES (10);
+SELECT * FROM bug13894;
+val
+5
+10
+11
+10
+UPDATE  bug13894 SET val=6 WHERE val=10;
+SELECT * FROM bug13894;
+val
+5
+11
+6
+6
+DROP TABLE bug13894;

--- 1.2/mysql-test/t/csv.test	2005-07-28 04:21:40 +04:00
+++ 1.3/mysql-test/t/csv.test	2005-11-05 15:07:59 +03:00
@@ -1314,4 +1314,22 @@
 
 drop table if exists t1,t2,t3,t4;
 
+#
+# Bug #13894    Server crashes on update of CSV table
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS bug13894;
+--enable_warnings
+
+CREATE TABLE bug13894 ( val integer ) ENGINE = CSV;
+INSERT INTO bug13894 VALUES (5);
+INSERT INTO bug13894 VALUES (10);
+INSERT INTO bug13894 VALUES (11);
+INSERT INTO bug13894 VALUES (10);
+SELECT * FROM bug13894;
+UPDATE  bug13894 SET val=6 WHERE val=10;
+SELECT * FROM bug13894;
+DROP TABLE bug13894;
+
 # End of 4.1 tests

--- 1.8/sql/examples/ha_tina.cc	2005-09-07 21:30:02 +04:00
+++ 1.9/sql/examples/ha_tina.cc	2005-11-05 15:07:59 +03:00
@@ -58,12 +58,16 @@
  ** TINA tables
  *****************************************************************************/
 
-/* 
-  Used for sorting  chains.
+/*
+  Used for sorting chains with qsort().
 */
 int sort_set (tina_set *a, tina_set *b)
 {
-  return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 )
);
+  /*
+    We assume that intervals do not intersect. So, it is enought to compare
+    any two points. Here we take start of intervals for comparison.
+  */
+  return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 )
);
 }
 
 static byte* tina_get_key(TINA_SHARE *share,uint *length,
@@ -739,13 +743,8 @@
     qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set);
     for (ptr= chain; ptr < chain_ptr; ptr++)
     {
-      /* We peek a head to see if this is the last chain */
-      if (ptr+1 == chain_ptr)
-        memmove(share->mapped_file + ptr->begin, share->mapped_file +
ptr->end,
-                length - (size_t)ptr->end);
-      else
-        memmove((caddr_t)share->mapped_file + ptr->begin,
(caddr_t)share->mapped_file + ptr->end,
-                (size_t)((ptr++)->begin - ptr->end));
+      memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
+              length - (size_t)ptr->end);
       length= length - (size_t)(ptr->end - ptr->begin);
     }
 
Thread
bk commit into 4.1 tree (petr:1.2464) BUG#13894Petr Chardin5 Nov