Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2218 06/06/28 01:07:44 stewart@stripped +2 -0
BUG#20725 MySQLD cluster use "fast count" is broken
Post recent handler changes, fast count(*) for cluster was broken.
Seeing as we maintain an exact count for ndb, we can easily use this for an optimisation.
With this patch, and use_exact_count DISABLED, we will use the fast way
of getting count(*) but not use the exact count for the optimiser.
With this patch and use_exact_count ENABLED, we will use the fast way of
getting count(*) and use the exact count for the optimiser.
sql/ha_ndbcluster.h
1.144 06/06/28 01:07:17 stewart@stripped +1 -0
we implment handler::records() for fast count(*)
sql/ha_ndbcluster.cc
1.336 06/06/28 01:07:17 stewart@stripped +26 -1
Implement handler::records() and set appropriate handler flag.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: stewart
# Host: willster.(none)
# Root: /home/stewart/Documents/MySQL/5.1/bug20725
--- 1.335/sql/ha_ndbcluster.cc 2006-06-25 23:58:05 +10:00
+++ 1.336/sql/ha_ndbcluster.cc 2006-06-28 01:07:17 +10:00
@@ -414,6 +414,30 @@
DBUG_VOID_RETURN;
}
+ha_rows ha_ndbcluster::records()
+{
+ ha_rows retval;
+ DBUG_ENTER("ha_ndbcluster::records");
+ struct Ndb_local_table_statistics *info= m_table_info;
+ DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
+ ((const NDBTAB *)m_table)->getTableId(),
+ info->no_uncommitted_rows_count));
+
+ Ndb *ndb= get_ndb();
+ ndb->setDatabaseName(m_dbname);
+ struct Ndb_statistics stat;
+ if (ndb_get_table_statistics(ndb, m_table, &stat) == 0)
+ {
+ retval= stat.row_count;
+ }
+
+ THD *thd= current_thd;
+ if (get_thd_ndb(thd)->error)
+ info->no_uncommitted_rows_count= 0;
+
+ DBUG_RETURN(retval + info->no_uncommitted_rows_count);
+}
+
void ha_ndbcluster::records_update()
{
if (m_ha_not_exact_count)
@@ -5455,7 +5479,8 @@
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | \
HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | \
HA_PARTIAL_COLUMN_READ | \
- HA_HAS_OWN_BINLOGGING
+ HA_HAS_OWN_BINLOGGING | \
+ HA_HAS_RECORDS
ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg):
handler(&ndbcluster_hton, table_arg),
--- 1.143/sql/ha_ndbcluster.h 2006-06-23 09:49:15 +10:00
+++ 1.144/sql/ha_ndbcluster.h 2006-06-28 01:07:17 +10:00
@@ -622,6 +622,7 @@
int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
bool get_error_message(int error, String *buf);
+ ha_rows records();
void info(uint);
void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id);
int extra(enum ha_extra_function operation);
| Thread |
|---|
| • bk commit into 5.1 tree (stewart:1.2218) BUG#20725 | Stewart Smith | 27 Jun |