Below is the list of changes that have just been committed into a local
4.1 repository of svoj. When svoj 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, 2006-09-20 19:34:27+05:00, svoj@stripped +3 -0
BUG#21381 - Engine not notified about multi-table UPDATE IGNORE
Though this is not storage engine specific problem, I was able to
repeat this problem with BDB and NDB engines only. That was the
reason to add a test case into ndb_update.test. As a result
different bad things could happen.
BDB has removed duplicate rows which is not expected.
NDB returns an error.
For multi table update notify storage engine about UPDATE IGNORE
as it is done in single table UPDATE.
mysql-test/r/ndb_update.result@stripped, 2006-09-20 19:34:26+05:00, svoj@stripped +8 -0
A test case for bug#21381.
mysql-test/t/ndb_update.test@stripped, 2006-09-20 19:34:26+05:00, svoj@stripped +9 -0
A test case for bug#21381.
sql/sql_update.cc@stripped, 2006-09-20 19:34:26+05:00, svoj@stripped +10 -1
For multi table update notify storage engine about UPDATE IGNORE
as it is done in single table UPDATE.
# 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: svoj
# Host: april.(none)
# Root: /home/svoj/devel/mysql/BUG21381/mysql-4.1-engines
--- 1.156/sql/sql_update.cc 2006-09-20 19:34:31 +05:00
+++ 1.157/sql/sql_update.cc 2006-09-20 19:34:31 +05:00
@@ -720,11 +720,16 @@ int mysql_multi_update(THD *thd,
/* We only need SELECT privilege for columns in the values list */
table->grant.want_privilege= (SELECT_ACL & ~table->grant.privilege);
+ if (ignore)
+ table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
}
if (!(result=new multi_update(thd, update_list, fields, values,
handle_duplicates, ignore)))
- DBUG_RETURN(-1);
+ {
+ res= -1;
+ goto ret;
+ }
res= mysql_select(thd, &select_lex->ref_pointer_array,
select_lex->get_table_list(), select_lex->with_wild,
@@ -734,6 +739,10 @@ int mysql_multi_update(THD *thd,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
result, unit, select_lex);
delete result;
+ret:
+ if (ignore)
+ for (tl= update_list; tl; tl= tl->next)
+ tl->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
DBUG_RETURN(res);
}
--- 1.4/mysql-test/r/ndb_update.result 2006-09-20 19:34:31 +05:00
+++ 1.5/mysql-test/r/ndb_update.result 2006-09-20 19:34:31 +05:00
@@ -31,3 +31,11 @@ pk1 b c
12 2 2
14 1 1
DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT NOT NULL, UNIQUE(a)) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES(1),(2);
+UPDATE IGNORE t1, t1 AS t1a SET t1.a=3;
+SELECT a FROM t1 ORDER BY a;
+a
+1
+3
+DROP TABLE t1;
--- 1.5/mysql-test/t/ndb_update.test 2006-09-20 19:34:31 +05:00
+++ 1.6/mysql-test/t/ndb_update.test 2006-09-20 19:34:31 +05:00
@@ -33,4 +33,13 @@ select * from t1 order by pk1;
DROP TABLE IF EXISTS t1;
--enable_warnings
+#
+# BUG#21381 - Engine not notified about multi-table UPDATE IGNORE
+#
+CREATE TABLE t1(a INT NOT NULL, UNIQUE(a)) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES(1),(2);
+UPDATE IGNORE t1, t1 AS t1a SET t1.a=3;
+SELECT a FROM t1 ORDER BY a;
+DROP TABLE t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (svoj:1.2548) BUG#21381 | Sergey Vojtovich | 20 Sep |