#At file:///home/jonas/src/telco-7.0/ based on revid:frazer.clement@stripped
4467 Jonas Oreland 2011-06-20
ndb - fix bug where row-count could be reported incorrectly
if in transaction performing delete of non-existing record using a primary/unique key
and then selecting count(*)
added:
mysql-test/suite/ndb/r/ndb_select_count.result
mysql-test/suite/ndb/t/ndb_select_count.test
modified:
sql/ha_ndbcluster.cc
=== added file 'mysql-test/suite/ndb/r/ndb_select_count.result'
--- a/mysql-test/suite/ndb/r/ndb_select_count.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_select_count.result 2011-06-20 12:34:27 +0000
@@ -0,0 +1,19 @@
+create table t1(
+k int not null auto_increment primary key,
+i int,
+j int
+) engine=ndbcluster;
+insert into t1(i,j) values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+select count(*) from t1;
+count(*)
+7
+begin;
+delete from t1 where k = 10000;
+select count(*) from t1;
+count(*)
+7
+commit;
+select count(*) from t1;
+count(*)
+7
+drop table t1;
=== added file 'mysql-test/suite/ndb/t/ndb_select_count.test'
--- a/mysql-test/suite/ndb/t/ndb_select_count.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_select_count.test 2011-06-20 12:34:27 +0000
@@ -0,0 +1,18 @@
+-- source include/have_ndb.inc
+
+create table t1(
+ k int not null auto_increment primary key,
+ i int,
+ j int
+) engine=ndbcluster;
+
+insert into t1(i,j) values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+
+select count(*) from t1;
+begin;
+delete from t1 where k = 10000; # none existant, rbwr
+select count(*) from t1;
+commit;
+select count(*) from t1;
+
+drop table t1;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-06-17 17:20:22 +0000
+++ b/sql/ha_ndbcluster.cc 2011-06-20 12:34:27 +0000
@@ -5057,6 +5057,7 @@ int ha_ndbcluster::end_bulk_delete()
assert(m_rows_deleted >= ignore_count);
m_rows_deleted-= ignore_count;
+ no_uncommitted_rows_update(ignore_count);
DBUG_RETURN(0);
}
@@ -5249,6 +5250,7 @@ int ha_ndbcluster::ndb_delete_row(const
{
assert(m_rows_deleted >= ignore_count);
m_rows_deleted-= ignore_count;
+ no_uncommitted_rows_update(ignore_count);
}
DBUG_RETURN(0);
}
Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20110620123427-fbwx4eqwb5t0uzk3.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (jonas:4467) | Jonas Oreland | 20 Jun |