Below is the list of changes that have just been committed into a local
4.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.2483 06/05/24 00:06:32 stewart@stripped +2 -0
BUG#19914 SELECT COUNT(*) sometimes returns MAX_INT on cluster tables
The optimizer can use the handler::info function for a quick COUNT(*) if
the handler says it can do exact count.
But, for NDB, ::info can fail (as it talks to the cluster). Check for error and
try an alternative method.
See comments in the bug for more details.
sql/opt_sum.cc
1.46 06/05/24 00:06:26 stewart@stripped +15 -1
With NDB, ha_ndbcluster::info may have an error condition when getting the
exact count.
Handle this and try alternative methods to get a row count. These are less
efficient, so we should first try to use ::info.
sql/ha_ndbcluster.cc
1.181 06/05/24 00:06:26 stewart@stripped +4 -1
If there was an error getting the table statistics, say we had an error by
setting m_ha_not_exact_count.
This is just per-handler, so eventually we'll retry getting the exact count
from NDB the quick way.
# 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/4.1/bug19914
--- 1.45/sql/opt_sum.cc 2005-09-26 04:22:20 +10:00
+++ 1.46/sql/opt_sum.cc 2006-05-24 00:06:26 +10:00
@@ -126,7 +126,21 @@
else
{
tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
- count*= tl->table->file->records;
+ /*
+ Since handler::info is void and not int, error notification for
+ an error on getting exact count is reported back by setting
+ the HA_NOT_EXACT_COUNT table_flag.
+
+ Optimiser can then try a different method to get the count.
+ You may then get a better error message.
+ */
+ if(tl->table->file->table_flags() & HA_NOT_EXACT_COUNT)
+ {
+ is_exact_count= FALSE;
+ count= 1;
+ }
+ else
+ count*= tl->table->file->records;
}
}
--- 1.180/sql/ha_ndbcluster.cc 2006-05-16 00:23:54 +10:00
+++ 1.181/sql/ha_ndbcluster.cc 2006-05-24 00:06:26 +10:00
@@ -273,6 +273,8 @@
if(ndb_get_table_statistics(ndb, m_tabname, &rows, 0) == 0){
info->records= rows;
}
+ else
+ m_ha_not_exact_count= true;
}
{
THD *thd= current_thd;
@@ -2820,7 +2822,8 @@
Ndb *ndb= get_ndb();
Uint64 rows= 100;
if (current_thd->variables.ndb_use_exact_count)
- ndb_get_table_statistics(ndb, m_tabname, &rows, 0);
+ if(ndb_get_table_statistics(ndb, m_tabname, &rows, 0)<0)
+ m_ha_not_exact_count= true;
records= rows;
}
}
| Thread |
|---|
| • bk commit into 4.1 tree (stewart:1.2483) BUG#19914 | Stewart Smith | 23 May |