List:Commits« Previous MessageNext Message »
From:tomas Date:February 10 2006 4:50pm
Subject:bk commit into 5.0 tree (tomas:1.2031)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tomas. When tomas 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.2031 06/02/10 17:50:17 tomas@stripped +4 -0
  Merge poseidon.ndb.mysql.com:/home/tomas/mysql-4.1
  into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

  sql/ha_ndbcluster.cc
    1.231 06/02/10 17:50:12 tomas@stripped +2 -5
    manual merge

  mysql-test/t/ndb_basic.test
    1.35 06/02/10 17:50:12 tomas@stripped +20 -20
    manual merge

  mysql-test/r/ndb_basic.result
    1.34 06/02/10 17:50:12 tomas@stripped +22 -22
    manual merge

  sql/ha_ndbcluster.h
    1.95 06/02/10 17:44:42 tomas@stripped +0 -0
    Auto merged

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.0/RESYNC

--- 1.33/mysql-test/r/ndb_basic.result	2005-12-18 15:24:11 +01:00
+++ 1.34/mysql-test/r/ndb_basic.result	2006-02-10 17:50:12 +01:00
@@ -671,6 +671,61 @@
 select * from t1;
 b
 drop table t1;
+create table t1 (a int) engine=ndb;
+create table t2 (a int) engine=ndb;
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+a
+select * from t2;
+a
+1
+drop table t1;
+drop table t2;
+CREATE TABLE t1 (
+i   INT,
+j   INT,
+x   INT,
+y   INT,
+z   INT
+) engine=ndb;
+CREATE TABLE t2 (
+i   INT,
+k   INT,
+x   INT,
+y   INT,
+z   INT
+) engine=ndb;
+CREATE TABLE t3 (
+j   INT,
+k   INT,
+x   INT,
+y   INT,
+z   INT
+) engine=ndb;
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+UPDATE      t1 AS a
+INNER JOIN  t2 AS b
+ON a.i = b.i
+INNER JOIN  t3 AS c
+ON a.j = c.j  AND  b.k = c.k
+SET         a.x = b.x,
+a.y = b.y,
+a.z = (
+SELECT  sum(z)
+FROM    t3
+WHERE   y = 34
+)
+WHERE       b.x = 23;
+select * from t1;
+i	j	x	y	z
+1	2	23	24	71
+drop table t1;
+drop table t2;
+drop table t3;
 create table atablewithareallylongandirritatingname (a int);
 insert into atablewithareallylongandirritatingname values (2);
 select * from atablewithareallylongandirritatingname;

--- 1.34/mysql-test/t/ndb_basic.test	2005-12-18 15:24:12 +01:00
+++ 1.35/mysql-test/t/ndb_basic.test	2006-02-10 17:50:12 +01:00
@@ -614,6 +614,72 @@
 select * from t1;
 drop table t1;
 
+#
+# Bug #17249 delete statement with join where clause fails 
+# when table do not have pk
+#
+
+create table t1 (a int) engine=ndb;
+create table t2 (a int) engine=ndb;
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+select * from t2;
+drop table t1;
+drop table t2;
+
+#
+# Bug #17257 update fails for inner joins if tables 
+# do not have Primary Key
+#
+
+CREATE TABLE t1 (
+  i   INT,
+  j   INT,
+  x   INT,
+  y   INT,
+  z   INT
+) engine=ndb;
+
+CREATE TABLE t2 (
+  i   INT,
+  k   INT,
+  x   INT,
+  y   INT,
+  z   INT
+) engine=ndb;
+
+CREATE TABLE t3 (
+  j   INT,
+  k   INT,
+  x   INT,
+  y   INT,
+  z   INT
+) engine=ndb;
+
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+
+UPDATE      t1 AS a
+INNER JOIN  t2 AS b
+              ON a.i = b.i
+INNER JOIN  t3 AS c
+              ON a.j = c.j  AND  b.k = c.k
+SET         a.x = b.x,
+            a.y = b.y,
+            a.z = (
+              SELECT  sum(z)
+              FROM    t3
+              WHERE   y = 34
+            )
+WHERE       b.x = 23;
+select * from t1;
+drop table t1;
+drop table t2;
+drop table t3;
+
 # End of 4.1 tests
 
 #

--- 1.230/sql/ha_ndbcluster.cc	2006-02-07 20:04:38 +01:00
+++ 1.231/sql/ha_ndbcluster.cc	2006-02-10 17:50:12 +01:00
@@ -73,8 +73,6 @@
   HTON_NO_FLAGS
 };
 
-#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
-
 #define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
 #define NDB_AUTO_INCREMENT_RETRIES 10
 
@@ -871,7 +869,7 @@
   }
 
   // Used for hidden key only
-  m_value[fieldnr].rec= ndb_op->getValue(fieldnr, NULL);
+  m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref);
   DBUG_RETURN(m_value[fieldnr].rec == NULL);
 }
 
@@ -2201,13 +2199,10 @@
       DBUG_PRINT("info", ("Using hidden key"));
       
       // Require that the PK for this record has previously been 
-      // read into m_value
-      uint no_fields= table->s->fields;
-      const NdbRecAttr* rec= m_value[no_fields].rec;
-      DBUG_ASSERT(rec);
-      DBUG_DUMP("key", (char*)rec->aRef(), NDB_HIDDEN_PRIMARY_KEY_LENGTH);
+      // read into m_ref
+      DBUG_DUMP("key", m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH);
       
-      if (set_hidden_key(op, no_fields, rec->aRef()))
+      if (set_hidden_key(op, table->fields, m_ref))
         ERR_RETURN(op->getNdbError());
     } 
     else 
@@ -2288,11 +2283,8 @@
     {
       // This table has no primary key, use "hidden" primary key
       DBUG_PRINT("info", ("Using hidden key"));
-      uint no_fields= table->s->fields;
-      const NdbRecAttr* rec= m_value[no_fields].rec;
-      DBUG_ASSERT(rec != NULL);
       
-      if (set_hidden_key(op, no_fields, rec->aRef()))
+      if (set_hidden_key(op, table->fields, m_ref))
         ERR_RETURN(op->getNdbError());
     } 
     else 
@@ -2839,17 +2831,15 @@
   {
     // No primary key, get hidden key
     DBUG_PRINT("info", ("Getting hidden key"));
-    int hidden_no= table->s->fields;
-    const NdbRecAttr* rec= m_value[hidden_no].rec;
-    memcpy(ref, (const void*)rec->aRef(), ref_length);
 #ifndef DBUG_OFF
+    int hidden_no= table->s->fields;
     const NDBTAB *tab= (const NDBTAB *) m_table;  
     const NDBCOL *hidden_col= tab->getColumn(hidden_no);
     DBUG_ASSERT(hidden_col->getPrimaryKey() && 
                 hidden_col->getAutoIncrement() &&
-                rec != NULL && 
                 ref_length == NDB_HIDDEN_PRIMARY_KEY_LENGTH);
 #endif
+    memcpy(ref, m_ref, ref_length);
   }
   
   DBUG_DUMP("ref", (char*)ref, ref_length);

--- 1.94/sql/ha_ndbcluster.h	2006-02-07 19:56:49 +01:00
+++ 1.95/sql/ha_ndbcluster.h	2006-02-10 17:44:42 +01:00
@@ -27,6 +27,8 @@
 
 #include <ndbapi_limits.h>
 
+#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
+
 class Ndb;             // Forward declaration
 class NdbOperation;    // Forward declaration
 class NdbTransaction;  // Forward declaration
@@ -681,6 +683,7 @@
   // NdbRecAttr has no reference to blob
   typedef union { const NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue;
   NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
+  byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
   bool m_use_write;
   bool m_ignore_dup_key;
   bool m_primary_key_update;
Thread
bk commit into 5.0 tree (tomas:1.2031)tomas10 Feb