summaryrefslogtreecommitdiff
path: root/sql/ha_federated.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-11-30 17:08:00 +0400
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-11-30 17:08:00 +0400
commitcef31e05e58b43ec4f7c02569432df70c60969f5 (patch)
treee2d1d5118bdd7f792aeb98e95e3673bff9941091 /sql/ha_federated.cc
parent1490691e31deb4577402120a80c5a448d3a28d6d (diff)
downloadmariadb-git-cef31e05e58b43ec4f7c02569432df70c60969f5.tar.gz
Bug #32374 crash with filesort when selecting from federated table and view.
filesort() uses file->estimate_rows_upper_bound() call to allocate internal buffers. If this function returns a value smaller than a number of row that will be returned later in find_all_keys(), that can cause server crash. Fixed by implementing ha_federated::estimate_rows_upper_bound() to return maximum possible number of rows. Present estimation for FEDERATED always returns 0 if the linked to the VIEW. mysql-test/r/federated.result: Bug #32374 crash with filesort when selecting from federated table and view. test result mysql-test/t/federated.test: Bug #32374 crash with filesort when selecting from federated table and view. test case sql/ha_federated.cc: Bug #32374 crash with filesort when selecting from federated table and view. ha_federated::estimate_rows_upper_bound() implemented sql/ha_federated.h: Bug #32374 crash with filesort when selecting from federated table and view. ha_federated::estimate_rows_upper_bound() interface
Diffstat (limited to 'sql/ha_federated.cc')
-rw-r--r--sql/ha_federated.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index d7f2309657b..ac1e0962ffb 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -2166,6 +2166,24 @@ error:
}
+/*
+ This method is used exlusevely by filesort() to check if we
+ can create sorting buffers of necessary size.
+ If the handler returns more records that it declares
+ here server can just crash on filesort().
+ We cannot guarantee that's not going to happen with
+ the FEDERATED engine, as we have records==0 always if the
+ client is a VIEW, and for the table the number of
+ records can inpredictably change during execution.
+ So we return maximum possible value here.
+*/
+
+ha_rows ha_federated::estimate_rows_upper_bound()
+{
+ return HA_POS_ERROR;
+}
+
+
/* Initialized at each key walk (called multiple times unlike rnd_init()) */
int ha_federated::index_init(uint keynr)