Here is an alternative version of the updated assert is a bit stricter
(and potentially a bit more risky?) than the assert in the committed patch:
=== modified file 'sql/handler.cc'
--- sql/handler.cc 2011-04-11 09:35:34 +0000
+++ sql/handler.cc 2011-04-13 13:29:26 +0000
@@ -4777,19 +4777,20 @@
/*
This assert will hit if we have pushed an index condition to the
primary key index and then "change our mind" and use a different
- index for retrieving data with MRR.
-
- This assert is too strict for the existing code. If an index
- condition has been pushed on the primary index the existing code
- does not clean up information about the pushed index condition when
- the index scan is completed. Disables the assert until we have
- a fix for better cleaning up after a pushed index condition.
+ index for retrieving data with MRR. One of the following criteria
+ must be true:
+ 1. We have not pushed an index conditon on this handler.
+ 2. We have pushed an index condition and this is on the
+ currently used index.
+ 3. We have pushed an index condition but this is not for the
+ primary key.
+ 4. We have pushed an index condition and this has be transferred to
+ the clone of the handler object.
*/
- /*
DBUG_ASSERT(!h->pushed_idx_cond ||
h->pushed_idx_cond_keyno == h->active_index ||
- h->pushed_idx_cond_keyno != table->s->primary_key);
- */
+ h->pushed_idx_cond_keyno != table->s->primary_key ||
+ (h2 && h->pushed_idx_cond_keyno == h2->active_index));
rowids_buf= buf->buffer;
Olav
On 04/13/11 03:11 PM, Olav Sandstaa wrote:
> === modified file 'sql/handler.cc'
> --- a/sql/handler.cc 2011-04-11 09:35:34 +0000
> +++ b/sql/handler.cc 2011-04-13 13:11:15 +0000
> @@ -4777,19 +4777,19 @@ int DsMrr_impl::dsmrr_init(handler *h_ar
> /*
> This assert will hit if we have pushed an index condition to the
> primary key index and then "change our mind" and use a different
> - index for retrieving data with MRR.
> -
> - This assert is too strict for the existing code. If an index
> - condition has been pushed on the primary index the existing code
> - does not clean up information about the pushed index condition when
> - the index scan is completed. Disables the assert until we have
> - a fix for better cleaning up after a pushed index condition.
> + index for retrieving data with MRR. One of the following criteria
> + must be true:
> + 1. This handler object does not have an active index.
> + 2. We have not pushed an index conditon on this handler.
> + 3. We have pushed and index condition and this is on the
> + currently used index.
> + 4. We have pushed and index condition but this is not for the
> + primary key.
> */
> - /*
> - DBUG_ASSERT(!h->pushed_idx_cond ||
> + DBUG_ASSERT(h->active_index == MAX_KEY ||
> + !h->pushed_idx_cond ||
> h->pushed_idx_cond_keyno == h->active_index ||
> h->pushed_idx_cond_keyno != table->s->primary_key);
> - */
>
> rowids_buf= buf->buffer;
>
>
>
>
>