MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:May 28 2007 11:23am
Subject:bk commit into 5.0 tree (tomas:1.2502) BUG#28719
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@stripped, 2007-05-28 13:23:11+02:00, tomas@stripped +3 -0
  Bug #28719: multi pk update ignore corrupts data
  - check multi update as well as update
  - this bug is not present in 5.0, but execution patch is wrong, so there are probably other bugs

  mysql-test/r/ndb_basic.result@stripped, 2007-05-28 13:23:09+02:00, tomas@stripped +71 -0
    Bug #28719: multi pk update ignore corrupts data
    - add test + backport some tests from 5.1

  mysql-test/t/ndb_basic.test@stripped, 2007-05-28 13:23:09+02:00, tomas@stripped +40 -0
    Bug #28719: multi pk update ignore corrupts data
    - add test + backport some tests from 5.1

  sql/ha_ndbcluster.cc@stripped, 2007-05-28 13:23:09+02:00, tomas@stripped +2 -1
    Bug #28719: multi pk update ignore corrupts data
    - check multi update as well as update
    - this bug is not present in 5.0, but execution patch is wrong, so there are probably other bugs

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

--- 1.37/mysql-test/r/ndb_basic.result	2007-05-08 08:24:18 +02:00
+++ 1.38/mysql-test/r/ndb_basic.result	2007-05-28 13:23:09 +02:00
@@ -770,4 +770,75 @@
 d	ab	ab
 e	abc	abc
 DROP TABLE t1;
+create table t1 (a int not null primary key, b int not null) engine=ndb;
+create table t2 (a int not null primary key, b int not null) engine=ndb;
+insert into t1 values (1,10), (2,20), (3,30);
+insert into t2 values (1,10), (2,20), (3,30);
+select * from t1 order by a;
+a	b
+1	10
+2	20
+3	30
+delete from t1 where a > 0 order by a desc limit 1;
+select * from t1 order by a;
+a	b
+1	10
+2	20
+delete from t1,t2 using t1,t2 where t1.a = t2.a;
+select * from t2 order by a;
+a	b
+3	30
+drop table t1,t2;
+create table t1 (a int not null primary key, b int not null) engine=ndb;
+insert into t1 values (1,10), (2,20), (3,30);
+insert into t1 set a=1, b=100;
+ERROR 23000: Duplicate entry '1' for key 1
+insert ignore into t1 set a=1, b=100;
+select * from t1 order by a;
+a	b
+1	10
+2	20
+3	30
+insert into t1 set a=1, b=1000 on duplicate key update b=b+1;
+select * from t1 order by a;
+a	b
+1	11
+2	20
+3	30
+drop table t1;
+create table t1 (a int not null primary key, b int not null) engine=ndb;
+create table t2 (c int not null primary key, d int not null) engine=ndb;
+insert into t1 values (1,10), (2,10), (3,30), (4, 30);
+insert into t2 values (1,10), (2,10), (3,30), (4, 30);
+update t1 set a = 1 where a = 3;
+ERROR 23000: Duplicate entry '1' for key 1
+select * from t1 order by a;
+a	b
+1	10
+2	10
+3	30
+4	30
+update t1 set b = 1 where a > 1 order by a desc limit 1;
+select * from t1 order by a;
+a	b
+1	10
+2	10
+3	30
+4	1
+update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
+ERROR 23000: Duplicate entry '1' for key 1
+select * from t1 order by a;
+a	b
+1	10
+2	10
+3	30
+4	1
+update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
+select * from t1 order by a;
+a	b
+1	10
+2	10
+3	30
+4	1
+drop table t1,t2;
 End of 5.0 tests

--- 1.39/mysql-test/t/ndb_basic.test	2007-05-08 08:24:18 +02:00
+++ 1.40/mysql-test/t/ndb_basic.test	2007-05-28 13:23:09 +02:00
@@ -740,6 +740,46 @@
 SELECT * FROM t1 ORDER BY a;
 DROP TABLE t1;
 
+# delete
+create table t1 (a int not null primary key, b int not null) engine=ndb;
+create table t2 (a int not null primary key, b int not null) engine=ndb;
+insert into t1 values (1,10), (2,20), (3,30);
+insert into t2 values (1,10), (2,20), (3,30);
+select * from t1 order by a;
+delete from t1 where a > 0 order by a desc limit 1;
+select * from t1 order by a;
+delete from t1,t2 using t1,t2 where t1.a = t2.a;
+select * from t2 order by a;
+drop table t1,t2;
+
+# insert ignore
+create table t1 (a int not null primary key, b int not null) engine=ndb;
+insert into t1 values (1,10), (2,20), (3,30);
+--error ER_DUP_ENTRY
+insert into t1 set a=1, b=100;
+insert ignore into t1 set a=1, b=100;
+select * from t1 order by a;
+insert into t1 set a=1, b=1000 on duplicate key update b=b+1;
+select * from t1 order by a;
+drop table t1;
+
+# update
+create table t1 (a int not null primary key, b int not null) engine=ndb;
+create table t2 (c int not null primary key, d int not null) engine=ndb;
+insert into t1 values (1,10), (2,10), (3,30), (4, 30);
+insert into t2 values (1,10), (2,10), (3,30), (4, 30);
+--error ER_DUP_ENTRY
+update t1 set a = 1 where a = 3;
+select * from t1 order by a;
+update t1 set b = 1 where a > 1 order by a desc limit 1;
+select * from t1 order by a;
+--error ER_DUP_ENTRY
+update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
+select * from t1 order by a;
+update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
+select * from t1 order by a;
+drop table t1,t2;
+
 # End of 5.0 tests
 --echo End of 5.0 tests
 

--- 1.314/sql/ha_ndbcluster.cc	2007-05-23 07:53:14 +02:00
+++ 1.315/sql/ha_ndbcluster.cc	2007-05-28 13:23:09 +02:00
@@ -2449,7 +2449,8 @@
    * If IGNORE the ignore constraint violations on primary and unique keys,
    * but check that it is not part of INSERT ... ON DUPLICATE KEY UPDATE
    */
-  if (m_ignore_dup_key && thd->lex->sql_command == SQLCOM_UPDATE)
+  if (m_ignore_dup_key && (thd->lex->sql_command == SQLCOM_UPDATE ||
+                           thd->lex->sql_command == SQLCOM_UPDATE_MULTI))
   {
     int peek_res= peek_indexed_rows(new_data, pk_update);
     
Thread
bk commit into 5.0 tree (tomas:1.2502) BUG#28719tomas28 May