mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
DS-MRR improvements:
- address the review feedback (class/var renames) - fix wrong test result (bug in buffer refill logic)
This commit is contained in:
@ -623,21 +623,26 @@ int Mrr_ordered_rndpos_reader::get_next(char **range_info)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (rowid_buffer->is_empty())
|
if (rowid_buffer->is_empty()) /* We're out of rowids */
|
||||||
{
|
{
|
||||||
/*
|
/* First, finish off the sorted keys we have */
|
||||||
We're out of rowids. If there are still some sorted keys, use up them
|
|
||||||
first (that is, don't call re-fill for keys when we still have some).
|
|
||||||
*/
|
|
||||||
if (!index_reader->eof())
|
if (!index_reader->eof())
|
||||||
{
|
{
|
||||||
if ((res= refill_buffer()))
|
if ((res= refill_buffer()))
|
||||||
return res; /* for fatal errors */
|
return res; /* for fatal errors */
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (rowid_buffer->is_empty())
|
||||||
{
|
{
|
||||||
//TODO: here: redistribute the buffer space, then refill the index
|
/*
|
||||||
//reader, then refill us.
|
Ok neither index_reader nor us have any records. Refill index
|
||||||
|
reader, then refill us.
|
||||||
|
*/
|
||||||
|
// TODO: if key buffer is empty, too, redistribute the buffer space.
|
||||||
|
|
||||||
|
if ((res= index_reader->refill_buffer()) ||
|
||||||
|
(res= refill_buffer()))
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,7 +876,7 @@ int DsMrr_impl::setup_two_handlers()
|
|||||||
if (keyno == h->pushed_idx_cond_keyno)
|
if (keyno == h->pushed_idx_cond_keyno)
|
||||||
pushed_cond= h->pushed_idx_cond;
|
pushed_cond= h->pushed_idx_cond;
|
||||||
|
|
||||||
Mrr_strategy *save_strategy= strategy;
|
Mrr_reader *save_strategy= strategy;
|
||||||
strategy= NULL;
|
strategy= NULL;
|
||||||
/*
|
/*
|
||||||
Caution: this call will invoke this->dsmrr_close(). Do not put the
|
Caution: this call will invoke this->dsmrr_close(). Do not put the
|
||||||
@ -910,7 +915,7 @@ int DsMrr_impl::setup_two_handlers()
|
|||||||
if (h->inited == handler::INDEX)
|
if (h->inited == handler::INDEX)
|
||||||
{
|
{
|
||||||
handler *save_h2= h2;
|
handler *save_h2= h2;
|
||||||
Mrr_strategy *save_strategy= strategy;
|
Mrr_reader *save_strategy= strategy;
|
||||||
h2= NULL;
|
h2= NULL;
|
||||||
strategy= NULL;
|
strategy= NULL;
|
||||||
res= h->ha_index_end();
|
res= h->ha_index_end();
|
||||||
@ -919,7 +924,7 @@ int DsMrr_impl::setup_two_handlers()
|
|||||||
if (res)
|
if (res)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if ((h->inited == handler::RND) && h->ha_rnd_init(FALSE))
|
if ((h->inited != handler::RND) && h->ha_rnd_init(FALSE))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
@ -130,18 +130,18 @@ public:
|
|||||||
been reached and get_next() must not be called anymore.
|
been reached and get_next() must not be called anymore.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Mrr_strategy
|
class Mrr_reader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int get_next(char **range_info) = 0;
|
virtual int get_next(char **range_info) = 0;
|
||||||
virtual int refill_buffer()=0;
|
virtual int refill_buffer()=0;
|
||||||
|
|
||||||
virtual ~Mrr_strategy() {};
|
virtual ~Mrr_reader() {}; /* just to remove compiler warning */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* A common base for strategies that do index scans and produce index tuples */
|
/* A common base for strategies that do index scans and produce index tuples */
|
||||||
class Mrr_index_reader : public Mrr_strategy
|
class Mrr_index_reader : public Mrr_reader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
handler *h;
|
handler *h;
|
||||||
@ -241,7 +241,7 @@ private:
|
|||||||
|
|
||||||
/* MRR strategy that fetches rowids */
|
/* MRR strategy that fetches rowids */
|
||||||
|
|
||||||
class Mrr_ordered_rndpos_reader : public Mrr_strategy
|
class Mrr_ordered_rndpos_reader : public Mrr_reader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int init(handler *h, Mrr_index_reader *index_reader, uint mode,
|
int init(handler *h, Mrr_index_reader *index_reader, uint mode,
|
||||||
@ -271,7 +271,7 @@ private:
|
|||||||
uchar *rowids_range_id;
|
uchar *rowids_range_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Mrr_strategy_factory
|
class Mrr_reader_factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mrr_ordered_rndpos_reader ordered_rndpos_reader;
|
Mrr_ordered_rndpos_reader ordered_rndpos_reader;
|
||||||
@ -458,8 +458,8 @@ private:
|
|||||||
/* TRUE <=> sort rowids and use rnd_pos() to get and return full records */
|
/* TRUE <=> sort rowids and use rnd_pos() to get and return full records */
|
||||||
//bool do_rndpos_scan;
|
//bool do_rndpos_scan;
|
||||||
|
|
||||||
Mrr_strategy_factory strategy_factory;
|
Mrr_reader_factory strategy_factory;
|
||||||
Mrr_strategy *strategy;
|
Mrr_reader *strategy;
|
||||||
Mrr_index_reader *index_strategy;
|
Mrr_index_reader *index_strategy;
|
||||||
|
|
||||||
/* The whole buffer space that we're using */
|
/* The whole buffer space that we're using */
|
||||||
|
Reference in New Issue
Block a user