List:Commits« Previous MessageNext Message »
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
View as plain text  
#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);
   }
 }


Attachment: [text/bzr-bundle] bzr/ole.john.aske@oracle.com-20101115092134-n7qwsernxj1jwf28.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3363) Bug#58163Ole John Aske15 Nov