From: Ole John Aske Date: November 15 2010 9:10am Subject: bzr commit into mysql-5.1-telco-7.1 branch (ole.john.aske:3982) Bug#58163 List-Archive: http://lists.mysql.com/commits/123842 X-Bug: 58163 Message-Id: <20101115091043.DD5A2222@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2351119892949896734==" --===============2351119892949896734== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///net/fimafeng09/export/home/tmp/oleja/mysql/mysql-5.1-telco-7.1/ based on revid:magnus.blaudd@stripped 3982 Ole John Aske 2010-11-15 Fix for bug#58163 - for review. All 'first', 'last', 'next' 'prev' navigators should set 'table->status = STATUS_NOT_FOUND' if there is returned an errorcode. This pattern is more or less a verbatime copy of how the same situation is handled in most (all?) of the other storage engines (Checked MyISAM, heap and memory...) I think the same fix should be applied for 6.3 -> ... modified: mysql-test/suite/ndb/r/ndb_subquery.result mysql-test/suite/ndb/t/ndb_subquery.test sql/ha_ndbcluster.cc === modified file 'mysql-test/suite/ndb/r/ndb_subquery.result' --- a/mysql-test/suite/ndb/r/ndb_subquery.result 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/ndb/r/ndb_subquery.result 2010-11-15 09:10:38 +0000 @@ -89,4 +89,10 @@ a b 3 30 4 30 drop table if exists t1, t2, t3, t4; +create table t (k int, uq int, unique key ix1 (uq)) engine = ndb; +insert into t values (1,3), (3,6), (6,9), (9,1); +select * from t where +k in (select uq from t as subq where subq.k>10); +k uq +drop table if exists t; End of 5.1 tests === modified file 'mysql-test/suite/ndb/t/ndb_subquery.test' --- a/mysql-test/suite/ndb/t/ndb_subquery.test 2007-11-29 10:29:35 +0000 +++ b/mysql-test/suite/ndb/t/ndb_subquery.test 2010-11-15 09:10:38 +0000 @@ -75,4 +75,15 @@ select * from t3 where exists (select * drop table if exists t1, t2, t3, t4; +########## +# bug#58163 + +create table t (k int, uq int, unique key ix1 (uq)) engine = ndb; +insert into t values (1,3), (3,6), (6,9), (9,1); + +select * from t where + k in (select uq from t as subq where subq.k>10); + +drop table if exists t; + --echo End of 5.1 tests === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2010-11-10 15:37:21 +0000 +++ b/sql/ha_ndbcluster.cc 2010-11-15 09:10:38 +0000 @@ -5289,8 +5289,10 @@ int ha_ndbcluster::index_read(uchar *buf default: break; } - DBUG_RETURN(read_range_first_to_buf(&start_key, 0, descending, - m_sorted, buf)); + const int error= read_range_first_to_buf(&start_key, 0, descending, + m_sorted, buf); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -5298,7 +5300,9 @@ int ha_ndbcluster::index_next(uchar *buf { DBUG_ENTER("ha_ndbcluster::index_next"); ha_statistic_increment(&SSV::ha_read_next_count); - DBUG_RETURN(next_result(buf)); + const int error= next_result(buf); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -5306,7 +5310,9 @@ int ha_ndbcluster::index_prev(uchar *buf { DBUG_ENTER("ha_ndbcluster::index_prev"); ha_statistic_increment(&SSV::ha_read_prev_count); - DBUG_RETURN(next_result(buf)); + const int error= next_result(buf); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -5317,7 +5323,9 @@ int ha_ndbcluster::index_first(uchar *bu // Start the ordered index scan and fetch the first row // Only HA_READ_ORDER indexes get called by index_first - DBUG_RETURN(ordered_index_scan(0, 0, TRUE, FALSE, buf, NULL)); + const int error= ordered_index_scan(0, 0, TRUE, FALSE, buf, NULL); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -5325,7 +5333,9 @@ int ha_ndbcluster::index_last(uchar *buf { DBUG_ENTER("ha_ndbcluster::index_last"); ha_statistic_increment(&SSV::ha_read_last_count); - DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL)); + const int error= ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } int ha_ndbcluster::index_read_last(uchar * buf, const uchar * key, uint key_len) @@ -5520,9 +5530,14 @@ int ha_ndbcluster::rnd_next(uchar *buf) DBUG_ENTER("rnd_next"); ha_statistic_increment(&SSV::ha_read_rnd_next_count); - if (!m_active_cursor) - DBUG_RETURN(full_table_scan(NULL, NULL, 0, buf)); - DBUG_RETURN(next_result(buf)); + int error; + if (m_active_cursor) + error= next_result(buf); + else + error= full_table_scan(NULL, NULL, 0, buf); + + table->status= error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -5587,6 +5602,7 @@ int ha_ndbcluster::rnd_pos(uchar *buf, u */ res= HA_ERR_RECORD_DELETED; } + table->status= res ? STATUS_NOT_FOUND: 0; DBUG_RETURN(res); } } --===============2351119892949896734== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/ole.john.aske@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: ole.john.aske@stripped\ # 9hqcy37s8oc8l5ja # target_branch: file:///net/fimafeng09/export/home/tmp/oleja/mysql\ # /mysql-5.1-telco-7.1/ # testament_sha1: 55785ef0101efbaf4d421fdea6abc7770022aac0 # timestamp: 2010-11-15 10:10:43 +0100 # base_revision_id: magnus.blaudd@stripped\ # byovvlho6b5lxual # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWU+tK50ABADfgGEwWff///+3 ngC////wYAjOG5193jNFAy6etB3sADSlAwyKp6Yoepsp6NNTTNJk0wGQJowaTR6CNDBKUMhPEaCM hG1MjQAaAAAAACUk9Cm1T0npNqafqTQ08oGhtIABpoADR6gSKaTJJ6nkmaCA1BoMRhAAAaGgBzTI yGTBDRhMEaaNGIGmTIwABBJITRoJiYhoCmyDQSekYp4obUxANN6pOL5b+Ig+6njB4VyySjq05t9T OJWaziyuvxUZwP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