From: Ole John Aske Date: November 15 2010 9:21am Subject: bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (ole.john.aske:3363) Bug#58163 List-Archive: http://lists.mysql.com/commits/123845 X-Bug: 58163 Message-Id: <20101115092140.0176C222@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7033792437951550866==" --===============7033792437951550866== 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.0-spj-scan-scan/ based on revid:ole.john.aske@stripped 3363 Ole John Aske 2010-11-15 spj-scan-scan: cherry picked proposed fix for bug#58163 into SPJ branch. Required as this was a showstopper for further RQG subquery testing 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:21:34 +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:21:34 +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-11 13:07:41 +0000 +++ b/sql/ha_ndbcluster.cc 2010-11-15 09:21:34 +0000 @@ -7482,8 +7482,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); } @@ -7491,7 +7493,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); } @@ -7499,7 +7503,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); } @@ -7510,7 +7516,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, m_sorted, FALSE, buf, NULL)); + const int error= ordered_index_scan(0, 0, m_sorted, FALSE, buf, NULL); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -7518,7 +7526,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, m_sorted, TRUE, buf, NULL)); + const int error= ordered_index_scan(0, 0, m_sorted, TRUE, buf, NULL); + table->status=error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -7762,12 +7772,16 @@ int ha_ndbcluster::rnd_next(uchar *buf) DBUG_ENTER("rnd_next"); ha_statistic_increment(&SSV::ha_read_rnd_next_count); + int error; if (m_active_cursor) - DBUG_RETURN(next_result(buf)); + error= next_result(buf); else if (m_active_query) - DBUG_RETURN(next_result(buf)); + error= next_result(buf); else - DBUG_RETURN(full_table_scan(NULL, NULL, 0, buf)); + error= full_table_scan(NULL, NULL, 0, buf); + + table->status= error ? STATUS_NOT_FOUND: 0; + DBUG_RETURN(error); } @@ -7832,6 +7846,7 @@ int ha_ndbcluster::rnd_pos(uchar *buf, u */ res= HA_ERR_RECORD_DELETED; } + table->status= res ? STATUS_NOT_FOUND: 0; DBUG_RETURN(res); } } --===============7033792437951550866== 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\ # n7qwsernxj1jwf28 # target_branch: file:///net/fimafeng09/export/home/tmp/oleja/mysql\ # /mysql-5.1-telco-7.0-spj-scan-scan/ # testament_sha1: f66f7f8922f0e439d6e4e006d904a0f408293799 # timestamp: 2010-11-15 10:21:39 +0100 # source_branch: bzr+ssh://oaske@stripped/bzrroot/server\ # /mysql-5.1-telco-7.0-spj/ # base_revision_id: ole.john.aske@stripped\ # 5ppx53wnkgglxz9c # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWfdRTF0AA/1fgGEwWff///eV /gC////wYAgu9PPfHp0B0Z7w+eH10OtJBVHCSonppTTZA9U9R6R5TygeoGhhD1D0Q0AAJRKepqP1 HqPVPKemJGTNQ/UQAaDEAAACUlPNCZCRppp5R6g00AAAAAAAMU0agmSG00QeoAAAAAAAAIpE1NMR qaRmQ0jym1GJiBppoNA0YhmoJJAQATQ1MTTJiEw0VDTT1DNR6gD1PKStB1vTOObJLSECLrwsWr1s moG7tD9zAp3MFEEEEbEMTEZKFzuQ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