From 1f05ac4ac38a54a3116bc039378247b6f70317c0 Mon Sep 17 00:00:00 2001
From: "stewart@willster.(none)" <>
Date: Wed, 25 Oct 2006 20:37:10 +1000
Subject: [PATCH] post merge fixes (from merging test fixes from bug 19914)

---
 mysql-test/r/ndb_multi.result |  4 ++++
 sql/ha_ndbcluster.cc          | 15 +++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/mysql-test/r/ndb_multi.result b/mysql-test/r/ndb_multi.result
index 73012fc110..1c9633589e 100644
--- a/mysql-test/r/ndb_multi.result
+++ b/mysql-test/r/ndb_multi.result
@@ -35,6 +35,10 @@ a
 select * from t1;
 a
 2
+flush status;
+select * from t1;
+a
+2
 update t1 set a=3 where a=2;
 show status like 'handler_discover%';
 Variable_name	Value
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 4b7ccc3736..8e802d449b 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -449,16 +449,13 @@ ha_rows ha_ndbcluster::records()
   Ndb *ndb= get_ndb();
   ndb->setDatabaseName(m_dbname);
   struct Ndb_statistics stat;
-  if (ndb_get_table_statistics(ndb, m_table, &stat) == 0)
+  if (ndb_get_table_statistics(this, true, ndb, m_table, &stat) == 0)
   {
     retval= stat.row_count;
   }
   else
   {
-    /**
-     * Be consistent with BUG#19914 until we fix it properly
-     */
-    DBUG_RETURN(-1);
+    DBUG_RETURN(HA_POS_ERROR);
   }
 
   THD *thd= current_thd;
@@ -5760,8 +5757,10 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
     Ndb *ndb= get_ndb();
     ndb->setDatabaseName(m_dbname);
     struct Ndb_statistics stat;
-    res= ndb_get_table_statistics(NULL, false, ndb, m_tabname, &stat);
-    records= stat.row_count;
+    res= ndb_get_table_statistics(NULL, false, ndb, m_table, &stat);
+    stats.mean_rec_length= stat.row_size;
+    stats.data_file_length= stat.fragment_memory;
+    stats.records= stat.row_count;
     if(!res)
       res= info(HA_STATUS_CONST);
   }
@@ -6829,7 +6828,7 @@ ha_ndbcluster::records_in_range(uint inx, key_range *min_key,
       else
       {
         Ndb_statistics stat;
-        if ((res=ndb_get_table_statistics(ndb, m_table, &stat)) != 0)
+        if ((res=ndb_get_table_statistics(this, true, ndb, m_table, &stat)) != 0)
           break;
         table_rows=stat.row_count;
         DBUG_PRINT("info", ("use db row_count: %llu", table_rows));
-- 
2.30.9