From: Ole John Aske Date: May 3 2012 12:13pm Subject: bzr push into mysql-5.5-cluster-7.2 branch (ole.john.aske:3908 to 3909) List-Archive: http://lists.mysql.com/commits/143735 Message-Id: <20120503121310.6E171242@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3909 Ole John Aske 2012-05-03 ha_ndbcluster::read_first_row() was once implemented as part of the SPJ project as we then had plans for pushing queries with 'system' tables as root operation. (JT_SYSTEM is the only use case for ::read_first_row()) It was later decided that we should not push such queries, but ha_ndbcluster::read_first_row() has remained in the code since then. There is a default implementation of this method (handler::read_first_row()) which is almost identical, except that it does not call ha_rnd_end() / ha_index_end() before returning. These calls was removed in our ha_ndbcluster::read_first_row() as pushed joins required the resultset to stay 'open' due to the child operations. However: - We do not push queries with 'system' tables so such a change is not required. - As part of fixing bug#13901890 'SQL NODE CRASHES DURING INSERT SELECT' we identified part of the root cause to be an overridden ::index_read_idx_map() which also omitted calling rnd_end()/index_end() before returning. This fix removes this obsolete, and potential evil code. modified: sql/ha_ndbcluster.cc sql/ha_ndbcluster.h 3908 Ole John Aske 2012-05-03 Backported some WL5940 related changes to 7.2-cluster: The handler extension ::test_push_flag() has now been removed. The two remaining HA_PUSH_-flags related to this extension has been made obsolete by: - HA_PUSH_BLOCK_CONST_TABLE is replaced with the 'test_flag' HA_BLOCK_CONST_TABLE. Furthermore it was identified that usage of this flag was obsolete at one of the places it was used. (As 'system' table optimization is not possible for handlers with non-EXACT statistics) - HA_PUSH_MULTIPLE_DEPENDENCY has been entirely removed as this covered a corner case with questionable advantage of being pushed. Previous changes to join_no_more_records() has been reverted. modified: mysql-test/suite/ndb/r/ndb_blob.result mysql-test/suite/ndb/r/ndb_dd_sql_features.result mysql-test/suite/ndb/r/ndb_join_pushdown_default.result sql/ha_ndbcluster.cc sql/ha_ndbcluster.h sql/ha_ndbcluster_push.cc sql/handler.h sql/sql_select.cc === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2012-05-03 10:42:49 +0000 +++ b/sql/ha_ndbcluster.cc 2012-05-03 12:12:39 +0000 @@ -6568,46 +6568,6 @@ int ha_ndbcluster::index_read_last(uchar } -/** - Read first row (only) from a table. - - This is actually (yet) never called for ndbcluster tables, as these table types - does not set HA_STATS_RECORDS_IS_EXACT. - - UPDATE: Might be called if the predicate contain ' IS NULL', and - is defined as 'NOT NULL' (or is part of primary key) - - Implemented regardless of this as the default implememtation would break - any pushed joins as it calls ha_rnd_end() / ha_index_end() at end of execution. - */ -int ha_ndbcluster::read_first_row(uchar * buf, uint primary_key) -{ - register int error; - DBUG_ENTER("ha_ndbcluster::read_first_row"); - - ha_statistic_increment(&SSV::ha_read_first_count); - - /* - If there is very few deleted rows in the table, find the first row by - scanning the table. - TODO remove the test for HA_READ_ORDER - */ - if (stats.deleted < 10 || primary_key >= MAX_KEY || - !(index_flags(primary_key, 0, 0) & HA_READ_ORDER)) - { - (void) ha_rnd_init(1); - while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ; - } - else - { - /* Find the first row through the primary key */ - (void) ha_index_init(primary_key, 0); - error=index_first(buf); - } - DBUG_RETURN(error); -} - - int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, const key_range *end_key, bool desc, bool sorted, === modified file 'sql/ha_ndbcluster.h' --- a/sql/ha_ndbcluster.h 2012-05-03 10:42:49 +0000 +++ b/sql/ha_ndbcluster.h 2012-05-03 12:12:39 +0000 @@ -180,7 +180,6 @@ class ha_ndbcluster: public handler int rnd_next(uchar *buf); int rnd_pos(uchar *buf, uchar *pos); void position(const uchar *record); - int read_first_row(uchar *buf, uint primary_key); virtual int cmp_ref(const uchar * ref1, const uchar * ref2); int read_range_first(const key_range *start_key, const key_range *end_key, No bundle (reason: useless for push emails).