From: magnus.blaudd Date: June 27 2011 9:06am Subject: bzr commit into mysql-5.5-cluster branch (magnus.blaudd:3374) List-Archive: http://lists.mysql.com/commits/139889 Message-Id: <20110627090635.198EB13402A@pilot> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1280555527507891226==" --===============1280555527507891226== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/msvensson/mysql/5.5-cluster/ based on revid:jonas.oreland@stripped 3374 magnus.blaudd@stripped 2011-06-27 ndb - Mark patches for SPJ with MCP_WL4784 tags - minor adjustments to minimize MCP in handler and sql_select modified: sql/handler.cc sql/handler.h sql/opt_range.h sql/sql_select.cc sql/sql_select.h === modified file 'sql/handler.cc' --- a/sql/handler.cc 2011-06-23 06:59:40 +0000 +++ b/sql/handler.cc 2011-06-27 09:06:30 +0000 @@ -4022,6 +4022,7 @@ int ha_table_exists_in_engine(THD* thd, DBUG_RETURN(args.err); } +#ifndef MCP_WL4784 /** Prepare (sub-) sequences of joins in this statement which may be pushed to each storage engine for execution. @@ -4042,7 +4043,7 @@ int ha_make_pushed_joins(THD *thd, AQP:: } return 0; } - +#endif #ifdef HAVE_NDB_BINLOG /* === modified file 'sql/handler.h' --- a/sql/handler.h 2011-06-23 06:59:40 +0000 +++ b/sql/handler.h 2011-06-27 09:06:30 +0000 @@ -236,13 +236,15 @@ Index scan will not return records in rowid order. Not guaranteed to be set for unordered (e.g. HASH) indexes. */ -#define HA_KEY_SCAN_NOT_ROR 128 +#define HA_KEY_SCAN_NOT_ROR 128 +#ifndef MCP_WL4784 /* no IO if read data when scan index i.e index is covering */ #define HA_CLUSTERED_INDEX 256 +#endif /* operations for disable/enable indexes */ #define HA_KEY_SWITCH_NONUNIQ 0 @@ -406,6 +408,7 @@ typedef ulonglong my_xid; // this line i #define COMPATIBLE_DATA_YES 0 #define COMPATIBLE_DATA_NO 1 +#ifndef MCP_WL4784 namespace AQP { class Join_plan; }; @@ -429,6 +432,7 @@ enum ha_push_flag { */ ,HA_PUSH_NO_ORDERED_INDEX }; +#endif /** struct xid_t is binary compatible with the XID structure as @@ -836,8 +840,10 @@ struct handlerton int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db, const char *name); - int (*make_pushed_join)(handlerton *hton, THD* thd, +#ifndef MCP_WL4784 + int (*make_pushed_join)(handlerton *hton, THD* thd, AQP::Join_plan* plan); +#endif uint32 license; /* Flag for Engine License */ void *data; /* Location for engines to keep personal structures */ @@ -1199,7 +1205,6 @@ uint calculate_key_len(TABLE *, uint, co */ #define make_prev_keypart_map(N) (((key_part_map)1 << (N)) - 1) - /** The handler class is the interface for dynamically loadable storage engines. Do not add ifdefs and take care when adding or @@ -1938,6 +1943,7 @@ public: */ virtual void cond_pop() { return; }; +#ifndef MCP_WL4784 /** Reports #tables included in pushed join which this handler instance is part of. ==0 -> Not pushed @@ -1970,11 +1976,8 @@ public: virtual int index_next_pushed(uchar * buf) { return HA_ERR_WRONG_COMMAND; } +#endif - - /* - Part of old fast alter table, to be depricated - */ virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info, uint table_changes) { return COMPATIBLE_DATA_NO; } @@ -2323,8 +2326,10 @@ int ha_rollback_to_savepoint(THD *thd, S int ha_savepoint(THD *thd, SAVEPOINT *sv); int ha_release_savepoint(THD *thd, SAVEPOINT *sv); +#ifndef MCP_WL4784 /* Build pushed joins in handlers implementing this feature */ int ha_make_pushed_joins(THD *thd, AQP::Join_plan* plan); +#endif /* these are called by storage engines */ void trans_register_ha(THD *thd, bool all, handlerton *ht); === modified file 'sql/opt_range.h' --- a/sql/opt_range.h 2011-06-23 06:59:40 +0000 +++ b/sql/opt_range.h 2011-06-27 09:06:30 +0000 @@ -374,7 +374,7 @@ class SEL_ARG; /* Quick select that does a range scan on a single key. The records are - returned in key order if 'QUICK_SELECT_I::sorted==true'. + returned in key order. */ class QUICK_RANGE_SELECT : public QUICK_SELECT_I { === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2011-06-23 06:59:40 +0000 +++ b/sql/sql_select.cc 2011-06-27 09:06:30 +0000 @@ -48,7 +48,9 @@ #include "filesort.h" // filesort_free_buffers #include "sql_union.h" // mysql_union #include "debug_sync.h" // DEBUG_SYNC +#ifndef MCP_WL4784 #include "abstract_query_plan.h" +#endif #include #include @@ -173,6 +175,9 @@ static void join_read_key_unlock_row(st_ static int join_read_always_key(JOIN_TAB *tab); static int join_read_last_key(JOIN_TAB *tab); static int join_no_more_records(READ_RECORD *info); +#ifdef MCP_WL4784 +static int join_read_next(READ_RECORD *info); +#endif static int join_init_quick_read_record(JOIN_TAB *tab); static int test_if_quick_select(JOIN_TAB *tab); static int join_init_read_record(JOIN_TAB *tab); @@ -186,8 +191,10 @@ static int join_ft_read_first(JOIN_TAB * static int join_ft_read_next(READ_RECORD *info); int join_read_always_key_or_null(JOIN_TAB *tab); int join_read_next_same_or_null(READ_RECORD *info); +#ifndef MCP_WL4784 static int join_read_linked_first(JOIN_TAB *tab); static int join_read_linked_next(READ_RECORD *info); +#endif static COND *make_cond_for_table(COND *cond,table_map table, table_map used_table); static Item* part_of_refkey(TABLE *form,Field *field); @@ -200,6 +207,11 @@ static bool test_if_cheaper_ordering(con ha_rows *new_select_limit, uint *new_used_key_parts= NULL, uint *saved_best_key_parts= NULL); +#ifdef MCP_WL4784 +static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order, + ha_rows select_limit, bool no_changes, + key_map *map); +#endif static bool list_contains_unique_index(TABLE *table, bool (*find_func) (Field *, void *), void *data); static bool find_field_in_item_list (Field *field, void *data); @@ -257,8 +269,9 @@ static Item *remove_additional_cond(Item static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab); static bool test_if_ref(Item_field *left_item,Item *right_item); +#ifndef MCP_WL4784 static int make_pushed_join(THD *thd, JOIN *join); - +#endif /** This handles SELECT with and without UNION. @@ -1557,8 +1570,10 @@ JOIN::optimize() } } +#ifndef MCP_WL4784 if (make_pushed_join(thd, this)) DBUG_RETURN(1); +#endif tmp_having= having; if (select_options & SELECT_DESCRIBE) @@ -1709,7 +1724,7 @@ JOIN::optimize() DBUG_RETURN(0); } - +#ifndef MCP_WL4784 static int make_pushed_join(THD *thd, JOIN *join) { @@ -1774,7 +1789,7 @@ make_pushed_join(THD *thd, JOIN *join) DBUG_ASSERT(active_pushed_joins==0); return 0; } - +#endif /** Restore values in temporary join. @@ -2842,8 +2857,12 @@ make_join_statistics(JOIN *join, TABLE_L no_partitions_used) && !s->dependent && (table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) && +#ifndef MCP_WL4784 !table->fulltext_searched && !join->no_const_tables && !table->file->test_push_flag(HA_PUSH_BLOCK_CONST_TABLE)) +#else + !table->fulltext_searched && !join->no_const_tables) +#endif { set_position(join,const_count++,s,(KEYUSE*) 0); } @@ -3037,8 +3056,12 @@ make_join_statistics(JOIN *join, TABLE_L if (eq_part.is_prefix(table->key_info[key].key_parts) && !table->fulltext_searched && +#ifndef MCP_WL4784 !table->pos_in_table_list->embedding && !table->file->test_push_flag(HA_PUSH_BLOCK_CONST_TABLE)) +#else + !table->pos_in_table_list->embedding) +#endif { if (table->key_info[key].flags & HA_NOSAME) { @@ -5556,13 +5579,13 @@ best_extension_by_limited_search(JOIN 'join' is a partial plan with lower cost than the best plan so far, so continue expanding it further with the tables in 'remaining_tables'. */ + JOIN_TAB *s; double best_record_count= DBL_MAX; double best_read_time= DBL_MAX; DBUG_EXECUTE("opt", print_plan(join, idx, record_count, read_time, read_time, "part_plan");); - JOIN_TAB *s; #ifndef MCP_BUG59326 JOIN_TAB *saved_refs[MAX_TABLES]; // Save 'best_ref[]' as we has to restore before return. @@ -5660,11 +5683,12 @@ best_extension_by_limited_search(JOIN } if ( (search_depth > 1) && (remaining_tables & ~real_table_bit) ) - { #ifdef MCP_BUG59326 + { /* Recursively expand the current partial plan */ swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); +#else + { /* Explore more best extensions of plan */ #endif - /* Explore more best extensions of plan */ if (best_extension_by_limited_search(join, remaining_tables & ~real_table_bit, idx + 1, @@ -7015,14 +7039,13 @@ make_join_readinfo(JOIN *join, ulonglong uint i; bool statistics= test(!(join->select_options & SELECT_DESCRIBE)); bool ordered_set= 0; - DBUG_ENTER("make_join_readinfo"); - #ifdef MCP_BUG11764737 bool sorted= 1; #else /* First table sorted if ORDER or GROUP BY was specified */ bool sorted= (join->order || join->group_list); #endif + DBUG_ENTER("make_join_readinfo"); for (i=join->const_tables ; i < join->tables ; i++) { @@ -12513,7 +12536,7 @@ join_read_key_unlock_row(st_join_table * tab->ref.use_count--; } - +#ifndef MCP_WL4784 /** Read a table *assumed* to be included in execution of a pushed join. This is the counterpart of join_read_key() / join_read_always_key() @@ -12584,7 +12607,7 @@ join_read_linked_next(READ_RECORD *info) } DBUG_RETURN(error); } - +#endif /* ref access method implementation: "read_first" function @@ -13950,7 +13973,11 @@ find_field_in_item_list (Field *field, v 1 We can use an index. */ +#ifndef MCP_WL4784 bool +#else +static bool +#endif test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, bool no_changes, key_map *map) { @@ -17225,6 +17252,7 @@ static void select_describe(JOIN *join, } else { +#ifndef MCP_WL4784 const TABLE* pushed_root= table->file->root_of_pushed_join(); if (pushed_root) { @@ -17258,6 +17286,7 @@ static void select_describe(JOIN *join, } extra.append(buf,len); } +#endif if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT || quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) @@ -17893,9 +17922,11 @@ test_if_cheaper_ordering(const JOIN_TAB If not used with LIMIT, only use keys if the whole query can be resolved with a key; This is because filesort() is usually faster than retrieving all rows through an index. +#ifndef MCP_WL4784 The exception is if there is a pushed join which we can't filesort(). This is due to the prefetch of result rows from the pushed join which filesort() is not able to buffer. +#endif */ if (select_limit >= table_records) { === modified file 'sql/sql_select.h' --- a/sql/sql_select.h 2011-06-23 06:59:40 +0000 +++ b/sql/sql_select.h 2011-06-27 09:06:30 +0000 @@ -614,9 +614,11 @@ uint find_shortest_key(TABLE *table, con Field* create_tmp_field_from_field(THD *thd, Field* org_field, const char *name, TABLE *table, Item_field *item, uint convert_blob_length); +#ifndef MCP_WL4784 bool test_if_skip_sort_order(JOIN_TAB *tab, ORDER *order, ha_rows select_limit, bool no_changes, key_map *map); +#endif bool is_indexed_agg_distinct(JOIN *join, List *out_args); --===============1280555527507891226== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/magnus.blaudd@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: magnus.blaudd@stripped\ # 5uqog1mfrksjcdsc # target_branch: file:///home/msvensson/mysql/5.5-cluster/ # testament_sha1: 8ff2d684e69dadb8873ae106331af37fb6ef599d # timestamp: 2011-06-27 11:06:34 +0200 # source_branch: file:///home/msvensson/mysql/5.5/ # base_revision_id: jonas.oreland@stripped\ # 3c94k44zdjsonvgr # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWVQd3VQABgPfgHQweXf//37/ 3qC////4YAod6aEO+CnbNCsWtXd93DyKpDabQKQkkQBGVPDIMVT9onolPxKaeUYg/UaamQD0aTag kkTRkYqfqT0SYQbKaAANGgNAaAaADSU2j1QAAA0AAD1BoAAAAANMkyEpmpqfpE81IDQNAAAAAADQ EFT9UAyBo0aaAAyGgwQAAaAACSQCZTAiTxqJ4pkwhT9IBGQDIwCM0UlgWnH1b3KzS4eCCSSCxJJq kbpEkk8lIkmooBmcIUDe0g98+7OCEnekQIvzGD4SOxZEn3QglkJENcCEbZTACRvpJLGjvJ2hnLBg OpxIORxEM2pg8QbzW9ShuWiiJTypeKCLB4M2i5vWl3FLKimcnlKJ2QrvbGh7N5uHDcP48qLV6vlN 6iUmn5I2orQwzAlgCSQCQASwGH2DMA+zZjv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