Hi Zardosht, On Fri, Feb 15, 2013 at 06:00:52PM -0500, Zardosht Kasheff wrote:
On implementing this. Looking at MariaDB-5.5.28a, I see MyISAM, InnoDB, and Aria all have the code below in their engine.
Is that all that is required? Do we need to copy and paste that code into our engine?
Generally, the answer depends on how you intend to implement MRR. As a counter-example, NDB storage engine has its own MRR implementation that shares no code with the Dsik-Sweep implementation of MRR that MyISAM/InnoDB/Aria are using (careful: NDB code in MariaDB is not maintained and is likely very out of date). I don't know how MRR should be implemented for TokuDB (my exposure to TokuDB has been limited to watching videos/slides). I guess, DS-MRR could be used as a first approach. But perhaps, a more advanced, specialized MRR implementation is posisble.
In fact, the only difference I see is that INnoDB has: if (prebuilt->select_lock_type != LOCK_NONE) *flags |= HA_MRR_USE_DEFAULT_IMPL; in multi_range_read_info_const.
In case you decide to use DS-MRR: there are also ds_mrr.dsmrr_close() calls in several places. Your engine needs to make them, too. It is also a good idea to set stats.mrr_length_per_rec, just like the other engines doo.
Thanks -Zardosht
The code:
int ha_maria::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf) { return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf); }
int ha_maria::multi_range_read_next(range_id_t *range_info) { return ds_mrr.dsmrr_next(range_info); }
ha_rows ha_maria::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, COST_VECT *cost) { /* This call is here because there is no location where this->table would already be known. TODO: consider moving it into some per-query initialization call. */ ds_mrr.init(this, table); return ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges, bufsz, flags, cost); }
ha_rows ha_maria::multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint key_parts, uint *bufsz, uint *flags, COST_VECT *cost) { ds_mrr.init(this, table); return ds_mrr.dsmrr_info(keyno, n_ranges, keys, key_parts, bufsz, flags, cost); }
int ha_maria::multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) { return ds_mrr.dsmrr_explain_info(mrr_mode, str, size); }
On Fri, Feb 15, 2013 at 5:17 PM, Igor Babaev <igor@askmonty.org> wrote:
On 02/15/2013 04:17 AM, Zardosht Kasheff wrote:
Hello all,
Is there anything to implementing multi range read for storage engines? Or is there a default implementation that is likely good enough.
Also, is there anything one can read to understand how the feature works and its benefits?
Thanks -Zardosht
Hi Zardosht,
I googled "MySQL Multi Range Read" and got among other references:
1. https://kb.askmonty.org/en/multi-range-read-optimization/
2. http://dev.mysql.com/doc/refman/5.6/en/mrr-optimization.html
The first article was written by Sergey Petrunia, the guy who wrote disk-sweep MRR. I find it the most comprehensive.
The second article was written also by him but when he worked at Sun. Later this article was slightly changed by MySQL/Oracle people.
Regards, Igor.
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
-- BR Sergei -- Sergei Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog