MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Martin Skold Date:June 21 2006 7:37am
Subject:bk commit into 5.0 tree (mskold:1.2173) BUG#19906
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marty. When marty 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.2173 06/06/21 09:36:50 mskold@stripped +4 -0
  Fix for Bug #19906  REPLACE doesn't update TEXT fields correctly

  mysql-test/t/ndb_replace.test
    1.6 06/06/21 09:36:01 mskold@stripped +28 -2
    Fix for Bug #19906  REPLACE doesn't update TEXT fields correctly

  mysql-test/r/ndb_replace.result
    1.5 06/06/21 09:36:01 mskold@stripped +22 -1
    Fix for Bug #19906  REPLACE doesn't update TEXT fields correctly

  sql/ha_ndbcluster.h
    1.98 06/06/21 09:36:00 mskold@stripped +2 -1
    Fix for Bug #19906  REPLACE doesn't update TEXT fields correctly

  sql/ha_ndbcluster.cc
    1.257 06/06/21 09:36:00 mskold@stripped +8 -2
    Fix for Bug #19906  REPLACE doesn't update TEXT fields correctly

# 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:	mskold
# Host:	linux.site
# Root:	/home/marty/MySQL/mysql-5.0-backed

--- 1.4/mysql-test/r/ndb_replace.result	2006-03-23 09:48:24 +01:00
+++ 1.5/mysql-test/r/ndb_replace.result	2006-06-21 09:36:01 +02:00
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
 CREATE TABLE t1 (
 gesuchnr int(11) DEFAULT '0' NOT NULL,
 benutzer_id int(11) DEFAULT '0' NOT NULL,
@@ -31,3 +31,24 @@ SELECT * from t1 ORDER BY i;
 i	j	k
 3	1	42
 17	2	24
+CREATE TABLE t2 (a INT(11) NOT NULL,
+b INT(11) NOT NULL,
+c INT(11) NOT NULL,
+x TEXT,
+y TEXT,
+z TEXT,
+id INT(10) unsigned NOT NULL AUTO_INCREMENT,
+i INT(11) DEFAULT NULL,
+PRIMARY KEY (id),
+UNIQUE KEY a (a,b,c)
+) ENGINE=ndbcluster;
+REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3);
+SELECT * FROM t2 ORDER BY id;
+a	b	c	x	y	z	id	i
+1	1	1	c	c	c	3	3
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1);
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2);
+SELECT * FROM t2 ORDER BY id;
+a	b	c	x	y	z	id	i
+1	1	1	b	b	b	5	2
+DROP TABLE t2;

--- 1.5/mysql-test/t/ndb_replace.test	2006-03-23 09:48:24 +01:00
+++ 1.6/mysql-test/t/ndb_replace.test	2006-06-21 09:36:01 +02:00
@@ -6,7 +6,7 @@
 #
 
 --disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
 --enable_warnings
 
 CREATE TABLE t1 (
@@ -27,6 +27,8 @@ replace into t1 (gesuchnr,benutzer_id) v
 select * from t1 order by gesuchnr;
 drop table t1;
 
+# End of 4.1 tests
+
 # bug#17431
 CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT, 
                 j INT, 
@@ -38,4 +40,28 @@ REPLACE INTO t1 (j,k) VALUES (1,42);
 REPLACE INTO t1 (i,j) VALUES (17,2);
 SELECT * from t1 ORDER BY i;
 
-# End of 4.1 tests
+# bug#19906
+CREATE TABLE t2 (a INT(11) NOT NULL,
+	         b INT(11) NOT NULL,
+                 c INT(11) NOT NULL,
+                 x TEXT,
+                 y TEXT,
+                 z TEXT,
+                 id INT(10) unsigned NOT NULL AUTO_INCREMENT,
+                 i INT(11) DEFAULT NULL,
+                 PRIMARY KEY (id),
+                 UNIQUE KEY a (a,b,c)
+) ENGINE=ndbcluster;
+
+REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3);
+
+SELECT * FROM t2 ORDER BY id;
+
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1);
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2);
+
+SELECT * FROM t2 ORDER BY id;
+
+DROP TABLE t2;
+
+

--- 1.256/sql/ha_ndbcluster.cc	2006-06-12 14:26:03 +02:00
+++ 1.257/sql/ha_ndbcluster.cc	2006-06-21 09:36:00 +02:00
@@ -771,10 +771,11 @@ int g_get_ndb_blobs_value(NdbBlob *ndb_b
   if (ndb_blob->blobsNextBlob() != NULL)
     DBUG_RETURN(0);
   ha_ndbcluster *ha= (ha_ndbcluster *)arg;
-  DBUG_RETURN(ha->get_ndb_blobs_value(ndb_blob));
+  DBUG_RETURN(ha->get_ndb_blobs_value(ndb_blob, ha->m_blobs_offset));
 }
 
-int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
+int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob,
+				       my_ptrdiff_t ptrdiff)
 {
   DBUG_ENTER("get_ndb_blobs_value");
 
@@ -807,7 +808,10 @@ int ha_ndbcluster::get_ndb_blobs_value(N
           if (ndb_blob->readData(buf, len) != 0)
             DBUG_RETURN(-1);
           DBUG_ASSERT(len == blob_len);
+          // Ugly hack assumes only ptr needs to be changed
+          field_blob->ptr+= ptrdiff;
           field_blob->set_ptr(len, buf);
+          field_blob->ptr-= ptrdiff;
         }
         offset+= blob_size;
       }
@@ -870,6 +874,7 @@ int ha_ndbcluster::get_ndb_value(NdbOper
       if (ndb_blob != NULL)
       {
         // Set callback
+	m_blobs_offset= buf - (byte*) table->record[0];
         void *arg= (void *)this;
         DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0);
       }
@@ -4552,6 +4557,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *tabl
   m_ops_pending(0),
   m_skip_auto_increment(TRUE),
   m_blobs_pending(0),
+  m_blobs_offset(0),
   m_blobs_buffer(0),
   m_blobs_buffer_size(0),
   m_dupkey((uint) -1),

--- 1.97/sql/ha_ndbcluster.h	2006-06-09 12:06:59 +02:00
+++ 1.98/sql/ha_ndbcluster.h	2006-06-21 09:36:00 +02:00
@@ -629,7 +629,7 @@ private:
   int set_ndb_value(NdbOperation*, Field *field, uint fieldnr, bool *set_blob_value= 0);
   int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*);
   friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
-  int get_ndb_blobs_value(NdbBlob *last_ndb_blob);
+  int get_ndb_blobs_value(NdbBlob *last_ndb_blob, my_ptrdiff_t ptrdiff);
   int set_primary_key(NdbOperation *op, const byte *key);
   int set_primary_key_from_record(NdbOperation *op, const byte *record);
   int set_index_key_from_record(NdbOperation *op, const byte *record,
@@ -706,6 +706,7 @@ private:
   ha_rows m_ops_pending;
   bool m_skip_auto_increment;
   bool m_blobs_pending;
+  my_ptrdiff_t m_blobs_offset;
   // memory for blobs in one tuple
   char *m_blobs_buffer;
   uint32 m_blobs_buffer_size;
Thread
bk commit into 5.0 tree (mskold:1.2173) BUG#19906Martin Skold21 Jun