Hello,
I applied this one almost verbatim, and pushed. Indeed the diff with
trunk shrinks by 18 kB. Thanks a lot.
Minor changes I did, below:
Tor Didriksen a écrit, Le 12.01.2011 09:01:
> #At file:///export/home/didrik/repo/next-mr-opt-backporting-wl4800/ based on
> revid:tor.didriksen@stripped
>
> 3244 Tor Didriksen 2011-01-12
> WL#5257 Review comments.
>
> remove a bunch of goto end-of-function, just return instead.
> this also allows us to remove the extra scope introduced,
> making the patch about 300 lines smaller compared to the original in trunk.
>
> modified:
> sql/opt_range.cc
> === modified file 'sql/opt_range.cc'
> --- a/sql/opt_range.cc 2011-01-11 08:15:46 +0000
> +++ b/sql/opt_range.cc 2011-01-12 08:00:09 +0000
> @@ -10129,7 +10129,8 @@ get_best_group_min_max(PARAM *param, SEL
> !is_agg_distinct)
> {
> cause= "not_group_by_or_distinct";
I deleted this line above and moved the literal into the add_alnum()
call below.
> - goto return_null_not_chosen_cause;
> + trace_group.add("chosen", false).add_alnum("cause", cause);
> + DBUG_RETURN(NULL);
> }
> /* Analyze the query in more detail. */
>
> @@ -10150,7 +10151,8 @@ get_best_group_min_max(PARAM *param, SEL
> else
> {
> cause= "not_applicable_aggregate_function";
I deleted this line above and moved the literal into the add_alnum()
call below.
> - goto return_null_not_chosen_cause;
> + trace_group.add("chosen", false).add_alnum("cause", cause);
> + DBUG_RETURN(NULL);
> }
>
> /* The argument of MIN/MAX. */
> @@ -10185,7 +10187,8 @@ get_best_group_min_max(PARAM *param, SEL
> if ((*tmp_group->item)->real_item()->type() != Item::FIELD_ITEM)
> {
> cause= "group_field_is_expression";
I deleted this line above and moved the literal into the add_alnum()
call below.
> - goto return_null_not_chosen_cause;
> + trace_group.add("chosen", false).add_alnum("cause", cause);
> + DBUG_RETURN(NULL);
> }
> }
>
> @@ -10194,337 +10197,339 @@ get_best_group_min_max(PARAM *param, SEL
> (GA1,GA2) are all TRUE. If there is more than one such index, select the
> first one. Here we set the variables: group_prefix_len and index_info.
> */
> - {
> - const uint pk= param->table->s->primary_key;
> - KEY *cur_index_info= table->key_info;
> - KEY *cur_index_info_end= cur_index_info + table->s->keys;
> - SEL_ARG *cur_index_tree= NULL;
> - ha_rows cur_quick_prefix_records= 0;
> - uint cur_param_idx= MAX_KEY;
> - Opt_trace_array ota(thd->opt_trace, "potential_group_range_indices");
I renamed ota to trace_indices.
> @@ -10535,7 +10540,8 @@ get_best_group_min_max(PARAM *param, SEL
> Field::itMBR : Field::itRAW))
> {
> cause= "unsupported_predicate_on_agg_attribute";
I deleted this line above and moved the literal into the add_alnum()
call below.
> - goto return_null_not_usable_cause;
> + trace_group.add("usable", false).add_alnum("cause", cause);
> + DBUG_RETURN(NULL);
> }
> /* The query passes all tests, so construct a new TRP object. */
> read_plan= new (param->mem_root)
> @@ -10568,15 +10574,11 @@ get_best_group_min_max(PARAM *param, SEL
>
> DBUG_RETURN(read_plan);
>
I deleted all lines below.
> -return_null_not_chosen_cause:
> - DBUG_ASSERT(cause);
> - trace_group.add("chosen", false).add_alnum("cause", cause);
> - DBUG_RETURN(NULL);
> -
> -return_null_not_usable_cause:
> - DBUG_ASSERT(cause);
> - trace_group.add("usable", false).add_alnum("cause", cause);
> - DBUG_RETURN(NULL);
> +//return_null_not_chosen_cause:
> +//DBUG_ASSERT(cause);
> +
> +//return_null_not_usable_cause:
> +//DBUG_ASSERT(cause);
> }