From: Martin Skold Date: July 9 2004 11:19am Subject: bk commit into 4.1 tree (mskold:1.1910) List-Archive: http://lists.mysql.com/internals/15184 Message-Id: <200407091119.i69BJ4dE004217@localhost.localdomain> Below is the list of changes that have just been committed into a local 4.1 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://www.mysql.com/doc/I/n/Installing_source_tree.html ChangeSet 1.1910 04/07/09 13:18:56 mskold@stripped +3 -0 Fixed bug #4106 and removed buggy pk update sql/ha_ndbcluster.cc 1.28 04/07/09 13:18:36 mskold@stripped +6 -26 Fixed bug #4106 and removed buggy pk update mysql-test/t/ndb_basic.test 1.7 04/07/09 13:18:36 mskold@stripped +3 -8 Fixed bug #4106 and removed buggy pk update mysql-test/r/ndb_basic.result 1.7 04/07/09 13:18:36 mskold@stripped +3 -13 Fixed bug #4106 and removed buggy pk 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: mskold # Host: localhost.localdomain.(none) # Root: /usr/local/home/marty/MySQL/mysql-4.1-ndb --- 1.6/mysql-test/r/ndb_basic.result Fri Jul 2 11:50:04 2004 +++ 1.7/mysql-test/r/ndb_basic.result Fri Jul 9 13:18:36 2004 @@ -3,35 +3,25 @@ pk1 INT NOT NULL PRIMARY KEY, attr1 INT NOT NULL ) ENGINE=ndbcluster; -INSERT INTO t1 VALUES (9410,9412),(9411,9413); +INSERT INTO t1 VALUES (9410,9412); SELECT pk1 FROM t1; pk1 9410 -9411 SELECT * FROM t1; pk1 attr1 9410 9412 -9411 9413 SELECT t1.* FROM t1; pk1 attr1 9410 9412 -9411 9413 UPDATE t1 SET attr1=1 WHERE pk1=9410; SELECT * FROM t1; pk1 attr1 9410 1 -9411 9413 UPDATE t1 SET pk1=2 WHERE attr1=1; +ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version SELECT * FROM t1; pk1 attr1 -2 1 -9411 9413 -UPDATE t1 SET pk1=2 WHERE attr1=9413; -ERROR 23000: Can't write; duplicate key in table 't1' -SELECT * FROM t1; -pk1 attr1 -2 1 -9411 9413 +9410 1 DELETE FROM t1; SELECT * FROM t1; pk1 attr1 --- 1.6/mysql-test/t/ndb_basic.test Fri Jul 2 11:50:04 2004 +++ 1.7/mysql-test/t/ndb_basic.test Fri Jul 9 13:18:36 2004 @@ -17,7 +17,7 @@ attr1 INT NOT NULL ) ENGINE=ndbcluster; -INSERT INTO t1 VALUES (9410,9412),(9411,9413); +INSERT INTO t1 VALUES (9410,9412); SELECT pk1 FROM t1; SELECT * FROM t1; @@ -27,14 +27,9 @@ UPDATE t1 SET attr1=1 WHERE pk1=9410; SELECT * FROM t1; -# Update pk +# Can't UPDATE PK! Test that correct error is returned +-- error 1112 UPDATE t1 SET pk1=2 WHERE attr1=1; -SELECT * FROM t1; - -# Try to set same pk -# 1022: Can't write; duplicate key in table 't1' --- error 1022 -UPDATE t1 SET pk1=2 WHERE attr1=9413; SELECT * FROM t1; # Delete the record --- 1.27/sql/ha_ndbcluster.cc Tue Jul 6 08:56:03 2004 +++ 1.28/sql/ha_ndbcluster.cc Fri Jul 9 13:18:36 2004 @@ -1174,30 +1174,8 @@ /* Check for update of primary key and return error */ if ((table->primary_key != MAX_KEY) && (key_cmp(table->primary_key, old_data, new_data))) - { - DBUG_PRINT("info", ("primary key update, doing insert + delete")); - int insert_res = write_row(new_data); - if (!insert_res) - { - DBUG_PRINT("info", ("insert succeded")); - int delete_res = delete_row(old_data); - if (!delete_res) - { - DBUG_PRINT("info", ("insert + delete succeeded")); - DBUG_RETURN(0); - } - else - { - DBUG_PRINT("info", ("delete failed")); - DBUG_RETURN(delete_row(new_data)); - } - } - else - { - DBUG_PRINT("info", ("insert failed")); - DBUG_RETURN(insert_res); - } - } + DBUG_RETURN(HA_ERR_UNSUPPORTED); + if (cursor) { /* @@ -1650,8 +1628,10 @@ NdbResultSet *cursor= m_active_cursor; DBUG_ENTER("rnd_init"); DBUG_PRINT("enter", ("scan: %d", scan)); - // Check that cursor is not defined - if (cursor) + // Check if scan is to be restarted + if (cursor && scan) + cursor->restart(); + else DBUG_RETURN(1); index_init(table->primary_key); DBUG_RETURN(0);