diff options
author | monty@hundin.mysql.fi <> | 2001-11-28 15:18:29 +0200 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-11-28 15:18:29 +0200 |
commit | 4d5d1ae2ef5d57c0f926a7e5c489d726755b8211 (patch) | |
tree | 2dd4497fe2f19df48908a85a4cae1d9426040533 | |
parent | 41afc03a85b92ac9d3bfe81a633631f17832b461 (diff) | |
download | mariadb-git-4d5d1ae2ef5d57c0f926a7e5c489d726755b8211.tar.gz |
Added read log caching and fixed a possible bug in write cacheing.
This should cause fewer seeks when using replication.
-rw-r--r-- | Docs/manual.texi | 4 | ||||
-rw-r--r-- | mysys/mf_iocache2.c | 27 |
2 files changed, 25 insertions, 6 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index deac65945f7..8763c9a517a 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46851,6 +46851,10 @@ Fixed bug when joining with caching (unlikely to happen). Fixed race condition when using the binary log and @code{INSERT DELAYED} which could cause the binary log to have rows that was not yet written to MyISAM tables. +@item +Changed caching of binary log to make replication slightly faster. +@item +Fixed bug in replication on Mac OS X. @end itemize @node News-3.23.45, News-3.23.44, News-3.23.46, News-3.23.x diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 9c0f99aea82..3e9cc74e0a2 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -32,20 +32,35 @@ void my_b_seek(IO_CACHE *info,my_off_t pos) { + my_off_t offset = (pos - info->pos_in_file); + DBUG_ENTER("my_b_seek"); + DBUG_PRINT("enter",("pos: %lu", (ulong) pos)); + if (info->type == READ_CACHE) { - info->rc_pos=info->rc_end=info->buffer; + if ((ulonglong) offset < (ulonglong) (info->rc_end - info->buffer)) + { + /* The read is in the current buffer; Reuse it */ + info->rc_pos = info->buffer + offset; + DBUG_VOID_RETURN; + } + else + { + /* Force a new read on next my_b_read */ + info->rc_pos=info->rc_end=info->buffer; + } } else if (info->type == WRITE_CACHE) { - byte* try_rc_pos; - try_rc_pos = info->rc_pos + (pos - info->pos_in_file); - if (try_rc_pos >= info->buffer && try_rc_pos <= info->rc_end) + /* If write is in current buffer, reuse it */ + if ((ulonglong) offset < + (ulonglong) (info->rc_end - info->buffer)) { - info->rc_pos = try_rc_pos; - return; + info->rc_pos = info->buffer + offset; + DBUG_VOID_RETURN; } flush_io_cache(info); + info->rc_end=(info->buffer+info->buffer_length-(pos & (IO_SIZE-1))); } info->pos_in_file=pos; info->seek_not_done=1; |