List:Commits« Previous MessageNext Message »
From:jonas oreland Date:September 2 2011 8:41am
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4497 to 4498)
View as plain text  
 4498 jonas oreland	2011-09-02 [merge]
      ndb - merge latest index-stat fixes\!

    modified:
      mysql-test/suite/ndb/r/ndb_index_stat.result
      mysql-test/suite/ndb/r/ndb_statistics1.result
      mysql-test/suite/ndb/t/ndb_index_stat.test
      sql/ha_ndb_index_stat.cc
      sql/ha_ndb_index_stat.h
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
      storage/ndb/src/ndbapi/NdbIndexStat.cpp
      storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp
      storage/ndb/src/ndbapi/ndberror.c
 4497 jonas oreland	2011-09-02
      ndb - add testcase for failed alter tables...(hint currently fails in 5.5)

    added:
      mysql-test/suite/ndb/r/ndb_alter_table_error.result
      mysql-test/suite/ndb/t/ndb_alter_table_error.test
=== modified file 'mysql-test/suite/ndb/r/ndb_index_stat.result'
--- a/mysql-test/suite/ndb/r/ndb_index_stat.result	2011-08-28 13:29:22 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index_stat.result	2011-09-02 06:43:38 +0000
@@ -487,6 +487,67 @@ id	select_type	table	type	possible_keys
 1	SIMPLE	t1	ref	PRIMARY,a1	a1	5	const	2	#
 1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.b1	50	#
 drop table t1, t2;
+CREATE TABLE t1(
+K INT NOT NULL AUTO_INCREMENT,
+I INT,
+J INT,
+L INT,
+PRIMARY KEY(K),
+KEY(I,J),
+KEY(L)
+) ENGINE=ndbcluster
+partition by key (K) partitions 1;
+INSERT INTO t1(I,J,L) VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(0,0,0);
+INSERT INTO t1(I,J,L) SELECT I,1,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,2,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,3,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,4,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,5,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,6,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,7,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,8,I FROM t1;
+select i, count(*) from t1 group by 1 order by 1;
+i	count(*)
+0	256
+1	256
+2	256
+3	256
+4	256
+5	256
+6	256
+7	256
+8	256
+9	256
+select l, count(*) from t1 group by 1 order by 1;
+l	count(*)
+0	256
+1	256
+2	256
+3	256
+4	256
+5	256
+6	256
+7	256
+8	256
+9	256
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+explain SELECT count(*) as Count FROM t1 WHERE I = 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	I	I	5	const	256	Using where with pushed condition
+SELECT count(*) as Count FROM t1 WHERE I = 5;
+Count
+256
+explain SELECT count(*) as Count FROM t1 WHERE L = 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	L	L	5	const	256	Using where with pushed condition
+SELECT count(*) as Count FROM t1 WHERE L = 5;
+Count
+256
+drop table t1;
 set @is_enable = @is_enable_default;
 set @is_enable = NULL;
 # is_enable_on=0 is_enable_off=1

=== modified file 'mysql-test/suite/ndb/r/ndb_statistics1.result'
--- a/mysql-test/suite/ndb/r/ndb_statistics1.result	2011-08-28 18:21:59 +0000
+++ b/mysql-test/suite/ndb/r/ndb_statistics1.result	2011-09-02 06:43:38 +0000
@@ -59,15 +59,15 @@ id	select_type	table	type	possible_keys
 EXPLAIN
 SELECT * FROM t10000 WHERE k >= 42 and k < 10000;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	2	Using where with pushed condition
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	9958	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE k BETWEEN 42 AND 10000;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	2	Using where with pushed condition
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	9959	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE k < 42;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	42	Using where with pushed condition
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	41	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE k > 42;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -81,7 +81,7 @@ id	select_type	table	type	possible_keys
 EXPLAIN
 SELECT * FROM t100 WHERE k < 42;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t100	range	PRIMARY	PRIMARY	4	NULL	42	Using where with pushed condition
+1	SIMPLE	t100	range	PRIMARY	PRIMARY	4	NULL	41	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t100 WHERE k > 42;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -89,7 +89,7 @@ id	select_type	table	type	possible_keys
 EXPLAIN
 SELECT * FROM t10000 WHERE k < 42;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	42	Using where with pushed condition
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	41	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE k > 42;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -97,11 +97,11 @@ id	select_type	table	type	possible_keys
 EXPLAIN
 SELECT * FROM t100 WHERE k BETWEEN 42 AND 10000;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t100	range	PRIMARY	PRIMARY	4	NULL	2	Using where with pushed condition
+1	SIMPLE	t100	range	PRIMARY	PRIMARY	4	NULL	59	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE k BETWEEN 42 AND 10000;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	2	Using where with pushed condition
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	9959	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE I = 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -129,7 +129,7 @@ id	select_type	table	type	possible_keys
 EXPLAIN
 SELECT * FROM t10000 WHERE I = 0 AND J BETWEEN 1 AND 10;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	range	J,I	J	5	NULL	2	Using where with pushed condition
+1	SIMPLE	t10000	range	J,I	I	10	NULL	2	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE I = 0 AND J = 1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -149,7 +149,7 @@ id	select_type	table	type	possible_keys
 EXPLAIN
 SELECT * FROM t10000 WHERE J = 0 AND K BETWEEN 1 AND 10;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t10000	ref	PRIMARY,J	J	5	const	2	Using where with pushed condition
+1	SIMPLE	t10000	range	PRIMARY,J	J	9	NULL	2	Using where with pushed condition
 EXPLAIN
 SELECT * FROM t10000 WHERE J = 0 AND K = 1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra

=== modified file 'mysql-test/suite/ndb/t/ndb_index_stat.test'
--- a/mysql-test/suite/ndb/t/ndb_index_stat.test	2011-08-28 13:29:22 +0000
+++ b/mysql-test/suite/ndb/t/ndb_index_stat.test	2011-09-02 06:43:38 +0000
@@ -334,5 +334,45 @@ explain select * from t1, t2 where b2 =
 
 drop table t1, t2;
 
+# bugXXXXX rule b3.3 fix
+
+CREATE TABLE t1(
+  K INT NOT NULL AUTO_INCREMENT,
+  I INT,
+  J INT,
+  L INT,
+  PRIMARY KEY(K),
+  KEY(I,J),
+  KEY(L)
+) ENGINE=ndbcluster
+  partition by key (K) partitions 1;
+
+INSERT INTO t1(I,J,L) VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(0,0,0);
+
+INSERT INTO t1(I,J,L) SELECT I,1,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,2,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,3,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,4,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,5,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,6,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,7,I FROM t1;
+INSERT INTO t1(I,J,L) SELECT I,8,I FROM t1;
+
+select i, count(*) from t1 group by 1 order by 1;
+select l, count(*) from t1 group by 1 order by 1;
+
+ANALYZE TABLE t1;
+
+explain SELECT count(*) as Count FROM t1 WHERE I = 5;
+SELECT count(*) as Count FROM t1 WHERE I = 5;
+
+# before fix rows was 128 instead of 256
+explain SELECT count(*) as Count FROM t1 WHERE L = 5;
+SELECT count(*) as Count FROM t1 WHERE L = 5;
+
+drop table t1;
+
 set @is_enable = @is_enable_default;
 source ndb_index_stat_enable.inc;

=== modified file 'sql/ha_ndb_index_stat.cc'
--- a/sql/ha_ndb_index_stat.cc	2011-08-16 11:53:13 +0000
+++ b/sql/ha_ndb_index_stat.cc	2011-09-02 06:43:38 +0000
@@ -2030,20 +2030,21 @@ int
 ha_ndbcluster::ndb_index_stat_query(uint inx,
                                     const key_range *min_key,
                                     const key_range *max_key,
-                                    NdbIndexStat::Stat& stat)
+                                    NdbIndexStat::Stat& stat,
+                                    int from)
 {
   DBUG_ENTER("ha_ndbcluster::ndb_index_stat_query");
 
   const KEY *key_info= table->key_info + inx;
   const NDB_INDEX_DATA &data= m_index[inx];
   const NDBINDEX *index= data.index;
-  DBUG_PRINT("index_stat", ("index: %s", index->getName()));
+  DBUG_PRINT("index_stat", ("index: %u name: %s", inx, index->getName()));
 
   int err= 0;
 
   /* Create an IndexBound struct for the keys */
   NdbIndexScanOperation::IndexBound ib;
-  compute_index_bounds(ib, key_info, min_key, max_key);
+  compute_index_bounds(ib, key_info, min_key, max_key, from);
   ib.range_no= 0;
 
   Ndb_index_stat *st=
@@ -2096,18 +2097,21 @@ ha_ndbcluster::ndb_index_stat_get_rir(ui
   DBUG_ENTER("ha_ndbcluster::ndb_index_stat_get_rir");
   uint8 stat_buffer[NdbIndexStat::StatBufferBytes];
   NdbIndexStat::Stat stat(stat_buffer);
-  int err= ndb_index_stat_query(inx, min_key, max_key, stat);
+  int err= ndb_index_stat_query(inx, min_key, max_key, stat, 1);
   if (err == 0)
   {
     double rir= -1.0;
     NdbIndexStat::get_rir(stat, &rir);
-    DBUG_PRINT("index_stat", ("stat rir: %.2f", rir));
     ha_rows rows= ndb_index_stat_round(rir);
     /* Estimate only so cannot return exact zero */
     if (rows == 0)
       rows= 1;
     *rows_out= rows;
-    DBUG_PRINT("index_stat", ("rir: %u", (uint)rows));
+#ifndef DBUG_OFF
+    char rule[NdbIndexStat::RuleBufferBytes];
+    NdbIndexStat::get_rule(stat, rule);
+#endif
+    DBUG_PRINT("index_stat", ("rir: %u rule: %s", (uint)rows, rule));
     DBUG_RETURN(0);
   }
   DBUG_RETURN(err);
@@ -2125,7 +2129,7 @@ ha_ndbcluster::ndb_index_stat_set_rpk(ui
   NdbIndexStat::Stat stat(stat_buffer);
   const key_range *min_key= 0;
   const key_range *max_key= 0;
-  err= ndb_index_stat_query(inx, min_key, max_key, stat);
+  err= ndb_index_stat_query(inx, min_key, max_key, stat, 2);
   if (err == 0)
   {
     uint k;
@@ -2135,7 +2139,11 @@ ha_ndbcluster::ndb_index_stat_set_rpk(ui
       NdbIndexStat::get_rpk(stat, k, &rpk);
       ulonglong recs= ndb_index_stat_round(rpk);
       key_info->rec_per_key[k]= (ulong)recs;
-      DBUG_PRINT("index_stat", ("rpk[%u]: %u", k, (uint)recs));
+#ifndef DBUG_OFF
+      char rule[NdbIndexStat::RuleBufferBytes];
+      NdbIndexStat::get_rule(stat, rule);
+#endif
+      DBUG_PRINT("index_stat", ("rpk[%u]: %u rule: %s", k, (uint)recs, rule));
     }
     DBUG_RETURN(0);
   }

=== modified file 'sql/ha_ndb_index_stat.h'
--- a/sql/ha_ndb_index_stat.h	2011-08-11 17:11:30 +0000
+++ b/sql/ha_ndb_index_stat.h	2011-08-31 10:53:27 +0000
@@ -40,7 +40,8 @@ extern long g_ndb_status_index_stat_cach
 void 
 compute_index_bounds(NdbIndexScanOperation::IndexBound & bound,
                      const KEY *key_info,
-                     const key_range *start_key, const key_range *end_key);
+                     const key_range *start_key, const key_range *end_key,
+                     int from);
 
 /* error codes local to ha_ndb */
 

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-08-28 13:29:22 +0000
+++ b/sql/ha_ndbcluster.cc	2011-08-31 10:53:27 +0000
@@ -3732,11 +3732,37 @@ count_key_columns(const KEY *key_info, c
 }
 
 /* Helper method to compute NDB index bounds. Note: does not set range_no. */
+/* Stats queries may differ so add "from" 0:normal 1:RIR 2:RPK. */
 void
 compute_index_bounds(NdbIndexScanOperation::IndexBound & bound,
                      const KEY *key_info,
-                     const key_range *start_key, const key_range *end_key)
+                     const key_range *start_key, const key_range *end_key,
+                     int from)
 {
+  DBUG_ENTER("ha_ndbcluster::compute_index_bounds");
+  DBUG_PRINT("info", ("from: %d", from));
+
+#ifndef DBUG_OFF
+  DBUG_PRINT("info", ("key parts: %u length: %u",
+                      key_info->key_parts, key_info->key_length));
+  {
+    for (uint j= 0; j <= 1; j++)
+    {
+      const key_range* kr= (j == 0 ? start_key : end_key);
+      if (kr)
+      {
+        DBUG_PRINT("info", ("key range %u: length: %u map: %lx flag: %d",
+                          j, kr->length, kr->keypart_map, kr->flag));
+        DBUG_DUMP("key", kr->key, kr->length);
+      }
+      else
+      {
+        DBUG_PRINT("info", ("key range %u: none", j));
+      }
+    }
+  }
+#endif
+
   if (start_key)
   {
     bound.low_key= (const char*)start_key->key;
@@ -3751,9 +3777,11 @@ compute_index_bounds(NdbIndexScanOperati
     bound.low_key_count= 0;
   }
 
+  /* RIR query for x >= 1 inexplicably passes HA_READ_KEY_EXACT. */
   if (start_key &&
       (start_key->flag == HA_READ_KEY_EXACT ||
-       start_key->flag == HA_READ_PREFIX_LAST))
+       start_key->flag == HA_READ_PREFIX_LAST) &&
+      from != 1)
   {
     bound.high_key= bound.low_key;
     bound.high_key_count= bound.low_key_count;
@@ -3783,11 +3811,14 @@ compute_index_bounds(NdbIndexScanOperati
     bound.high_key= NULL;
     bound.high_key_count= 0;
   }
-  DBUG_PRINT("info", ("start_flag=0x%x end_flag=0x%x"
+  DBUG_PRINT("info", ("start_flag=%d end_flag=%d"
                       " lo_keys=%d lo_incl=%d hi_keys=%d hi_incl=%d",
                       start_key?start_key->flag:0, end_key?end_key->flag:0,
-                      bound.low_key_count, bound.low_inclusive,
-                      bound.high_key_count, bound.high_inclusive));
+                      bound.low_key_count,
+                      bound.low_key_count?bound.low_inclusive:0,
+                      bound.high_key_count,
+                      bound.high_key_count?bound.high_inclusive:0));
+  DBUG_VOID_RETURN;
 }
 
 /**
@@ -3853,7 +3884,8 @@ int ha_ndbcluster::ordered_index_scan(co
                          (descending?
                           end_key : start_key),
                          (descending?
-                          start_key : end_key));
+                          start_key : end_key),
+                         0);
     bound.range_no = 0;
     pbound = &bound;
   }
@@ -11881,7 +11913,8 @@ ha_ndbcluster::records_in_range(uint inx
         compute_index_bounds(ib,
                              key_info,
                              min_key, 
-                             max_key);
+                             max_key,
+                             0);
 
         ib.range_no= 0;
 
@@ -13514,7 +13547,7 @@ ha_ndbcluster::read_multi_range_first(KE
 
       /* Include this range in the ordered index scan. */
       NdbIndexScanOperation::IndexBound bound;
-      compute_index_bounds(bound, key_info, &r->start_key, &r->end_key);
+      compute_index_bounds(bound, key_info, &r->start_key, &r->end_key, 0);
       bound.range_no= i;
 
       if (m_multi_cursor->setBound(m_index[active_index].ndb_record_key,

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2011-07-23 14:35:37 +0000
+++ b/sql/ha_ndbcluster.h	2011-08-31 10:53:27 +0000
@@ -861,7 +861,8 @@ private:
   int ndb_index_stat_query(uint inx,
                            const key_range *min_key,
                            const key_range *max_key,
-                           NdbIndexStat::Stat& stat);
+                           NdbIndexStat::Stat& stat,
+                           int from);
   int ndb_index_stat_get_rir(uint inx,
                              key_range *min_key,
                              key_range *max_key,

=== modified file 'storage/ndb/src/ndbapi/NdbIndexStat.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp	2011-08-11 17:11:30 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp	2011-08-31 10:53:27 +0000
@@ -548,7 +548,7 @@ NdbIndexStat::convert_range(Range& range
                             const NdbRecord* key_record,
                             const NdbIndexScanOperation::IndexBound* ib)
 {
-  DBUG_ENTER("NdbIndexStatImpl::convert_range");
+  DBUG_ENTER("NdbIndexStat::convert_range");
   Bound& bound1_f = range_f.m_bound1;
   Bound& bound2_f = range_f.m_bound2;
   NdbIndexStatImpl::Bound& bound1 =
@@ -625,7 +625,11 @@ NdbIndexStat::get_rir(const Stat& stat_f
     x = 1.0;
   require(rir != 0);
   *rir = x;
-  DBUG_PRINT("index_stat", ("rir:%.2f", *rir));
+#ifndef DBUG_OFF
+  char buf[100];
+  sprintf(buf, "%.2f", *rir);
+#endif
+  DBUG_PRINT("index_stat", ("rir:%s", buf));
   DBUG_VOID_RETURN;
 }
 
@@ -640,7 +644,11 @@ NdbIndexStat::get_rpk(const Stat& stat_f
     x = 1.0;
   require(rpk != 0);
   *rpk = x;
-  DBUG_PRINT("index_stat", ("rpk[%u]:%.2f", k, *rpk));
+#ifndef DBUG_OFF
+  char buf[100];
+  sprintf(buf, "%.2f", *rpk);
+#endif
+  DBUG_PRINT("index_stat", ("rpk[%u]:%s", k, buf));
   DBUG_VOID_RETURN;
 }
 

=== modified file 'storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp	2011-08-12 05:16:41 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp	2011-09-02 06:43:38 +0000
@@ -1506,16 +1506,32 @@ NdbIndexStatImpl::cache_insert(Con& con)
     const Uint8* rir_ptr = &cacheValuePtr[0];
     Uint32 rir;
     memcpy(&rir, rir_ptr, 4);
-    assert(rir != 0);
+    if (!(rir != 0))
+    {
+      setError(InvalidCache, __LINE__);
+      return -1;
+    }
     Uint32 unq_prev = 0;
     for (uint k = 0; k < c.m_keyAttrs; k++)
     {
       Uint8* unq_ptr = &cacheValuePtr[4 + k * 4];
       Uint32 unq;
       memcpy(&unq, unq_ptr, 4);
-      assert(unq != 0);
-      assert(rir >= unq);
-      assert(unq >= unq_prev);
+      if (!(unq != 0))
+      {
+        setError(InvalidCache, __LINE__);
+        return -1;
+      }
+      if (!(rir >= unq))
+      {
+        setError(InvalidCache, __LINE__);
+        return -1;
+      }
+      if (!(unq >= unq_prev))
+      {
+        setError(InvalidCache, __LINE__);
+        return -1;
+      }
       unq_prev = unq;
     }
   }
@@ -1713,6 +1729,34 @@ NdbIndexStatImpl::cache_verify(const Cac
         setError(InvalidCache, __LINE__);
         return -1;
       }
+      const Uint8* ptr1 = c.get_valueptr(pos1);
+      const Uint8* ptr2 = c.get_valueptr(pos2);
+      Uint32 rir1;
+      Uint32 rir2;
+      memcpy(&rir1, &ptr1[0], 4);
+      memcpy(&rir2, &ptr2[0], 4);
+      if (!(rir1 < rir2))
+      {
+        setError(InvalidCache, __LINE__);
+        return -1;
+      }
+      for (uint k = 0; k < c.m_keyAttrs; k++)
+      {
+        Uint32 unq1;
+        Uint32 unq2;
+        memcpy(&unq1, &ptr1[4 + k * 4], 4);
+        memcpy(&unq2, &ptr2[4 + k * 4], 4);
+        if (!(unq1 <= unq2))
+        {
+          setError(InvalidCache, __LINE__);
+          return -1;
+        }
+        if (k == c.m_keyAttrs - 1 && !(unq1 < unq2))
+        {
+          setError(InvalidCache, __LINE__);
+          return -1;
+        }
+      }
     }
   }
   return 0;
@@ -2196,7 +2240,7 @@ NdbIndexStatImpl::query_interpolate(cons
       cnt == stat.m_numEqH &&
       side == -1) {
     stat.m_rule = "b3.3";
-    const double u = 1.0 + c.get_unq(posL, posH, keyAttrs - 1);
+    const double u = c.get_unq(posL, posH, keyAttrs - 1);
     const double wL = 1.0 / u;
     const double wH = 1.0 - wL;
     value.m_rir = wL * c.get_rir(posL) + wH * c.get_rir(posH);

=== modified file 'storage/ndb/src/ndbapi/ndberror.c'
--- a/storage/ndb/src/ndbapi/ndberror.c	2011-09-01 18:42:31 +0000
+++ b/storage/ndb/src/ndbapi/ndberror.c	2011-09-02 08:40:48 +0000
@@ -548,7 +548,7 @@ ErrorBundle ErrorCodes[] = {
   { 4715, DMEC, AE, "Index stats for specified index do not exist" },
   { 4716, DMEC, AE, "Index stats methods usage error" },
   { 4717, DMEC, AE, "Index stats cannot allocate memory" },
-  { 4718, DMEC, IE, "Index stats memory cache is corrupted" },
+  { 4718, DMEC, IE, "Index stats samples data or memory cache is invalid" },
   { 4719, DMEC, IE, "Index stats internal error" },
   { 4720, DMEC, AE, "Index stats sys tables " NDB_INDEX_STAT_PREFIX " partly missing or invalid" },
   

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4497 to 4498) jonas oreland2 Sep