Hi!
On Jun 13, Jay Pipes wrote:
>
> mi_write() performs the write of both the index pages, and
> the MyISAM record. The index blocks are written first, in the
> subroutines _mi_ck_write_btree() and _mi_ck_write_tree() (for
> bulk inserts). Most of the functions in mi_write.c concern the
> writing of these index blocks. After the index blocks are
> written (in mi_write()), you should see the code which looks
> something like:
>
> if (!(info->opt_flag & OPT_NO_ROWS))
> {
> if ((*share->write_record)(info,record))
> goto err;
> share->state.checksum+=info->checksum;
> }
>
> I believe this is where the main record (non-paged isam) is written.
> The write_record member variable is a function pointer to one of the
> read or write methods of the record cache, and is done this way to
> facilitate easy transition from memory writes to disk writes using
> the IO_CACHE struct. Look at the _my_b_write macro(s) for more info-
> rmation. It's been a little while since I looked at the code for this,
> so if I have gotten something incorrect, or missed something big,
> please let me (and Dr. H?pfner) know.
Almost everything is right. Good understanding!
The only comment - write_record is not for "facilitate easy transition
from memory writes to disk writes the IO_CACHE struct".
It's to support tables with different row structure - namely, static
(fixed-length), dynamic (variable-length), and packed (compressed).
See in mi_open.c how write_record is assigned.
Regards,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com