1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#58985: Assertion tab->quick->index != 64 failed in make_join_select()

in sql_select.cc

Follow-up patch. Add sanity check for quick select when it is
decided that it should be used.
This commit is contained in:
Jorgen Loland
2010-12-17 13:52:39 +01:00
parent fca0f1dbb7
commit ef0a01abfc
2 changed files with 56 additions and 0 deletions

View File

@ -336,6 +336,13 @@ public:
*/ */
virtual bool is_keys_used(const MY_BITMAP *fields); virtual bool is_keys_used(const MY_BITMAP *fields);
/**
Simple sanity check that the quick select has been set up
correctly. Function is overridden by quick selects that merge
indices.
*/
virtual bool is_valid() { return index != MAX_KEY; };
/* /*
rowid of last row retrieved by this quick select. This is used only when rowid of last row retrieved by this quick select. This is used only when
doing ROR-index_merge selects doing ROR-index_merge selects
@ -556,6 +563,22 @@ public:
bool clustered_pk_range() { return test(pk_quick_select); } bool clustered_pk_range() { return test(pk_quick_select); }
virtual bool is_valid()
{
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
QUICK_RANGE_SELECT *quick;
bool valid= true;
while ((quick= it++))
{
if (!quick->is_valid())
{
valid= false;
break;
}
}
return valid;
}
/* used to get rows collected in Unique */ /* used to get rows collected in Unique */
READ_RECORD read_record; READ_RECORD read_record;
}; };
@ -608,6 +631,22 @@ public:
*/ */
List<QUICK_RANGE_SELECT> quick_selects; List<QUICK_RANGE_SELECT> quick_selects;
virtual bool is_valid()
{
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
QUICK_RANGE_SELECT *quick;
bool valid= true;
while ((quick= it++))
{
if (!quick->is_valid())
{
valid= false;
break;
}
}
return valid;
}
/* /*
Merged quick select that uses Clustered PK, if there is one. This quick Merged quick select that uses Clustered PK, if there is one. This quick
select is not used for row retrieval, it is used for row retrieval. select is not used for row retrieval, it is used for row retrieval.
@ -658,6 +697,22 @@ public:
List<QUICK_SELECT_I> quick_selects; /* Merged quick selects */ List<QUICK_SELECT_I> quick_selects; /* Merged quick selects */
virtual bool is_valid()
{
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
QUICK_SELECT_I *quick;
bool valid= true;
while ((quick= it++))
{
if (!quick->is_valid())
{
valid= false;
break;
}
}
return valid;
}
QUEUE queue; /* Priority queue for merge operation */ QUEUE queue; /* Priority queue for merge operation */
MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */ MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */

View File

@ -6504,6 +6504,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
((tab->type != JT_CONST && tab->type != JT_REF) || ((tab->type != JT_CONST && tab->type != JT_REF) ||
(uint)tab->ref.key == tab->quick->index)) (uint)tab->ref.key == tab->quick->index))
{ {
DBUG_ASSERT(tab->quick->is_valid());
sel->quick=tab->quick; // Use value from get_quick_... sel->quick=tab->quick; // Use value from get_quick_...
sel->quick_keys.clear_all(); sel->quick_keys.clear_all();
sel->needed_reg.clear_all(); sel->needed_reg.clear_all();