Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1795 05/03/09 17:19:02 jimw@stripped +3 -0
Add APPEND_CACHE mode for IO caching, which is just like
WRITE_CACHE but for files opened using O_APPEND, so it can
avoid calling seek() to write to the end of the file. This
makes it possible to use a FIFO for the query and slow
logs. (Bug #8271)
sql/sql_class.h
1.224 05/03/09 17:19:00 jimw@stripped +2 -2
Use APPEND_CACHE for log files.
mysys/mf_iocache.c
1.51 05/03/09 17:18:59 jimw@stripped +11 -10
Handle APPEND_CACHE: just like WRITE_CACHE, except it assumes
the file was assumed using O_APPEND so it cand avoid doing a
seek on the file to write to the end.
include/my_sys.h
1.145 05/03/09 17:18:59 jimw@stripped +1 -0
Add APPEND_CACHE
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jimw
# Host: rama.(none)
# Root: /home/jimw/my/mysql-5.0-8271
--- 1.144/include/my_sys.h 2005-03-09 04:37:13 -08:00
+++ 1.145/include/my_sys.h 2005-03-09 17:18:59 -08:00
@@ -279,6 +279,7 @@
enum cache_type
{
READ_CACHE,WRITE_CACHE,
+ APPEND_CACHE, /* Avoids tell() and seek() */
SEQ_READ_APPEND /* sequential read or append */,
READ_FIFO, READ_NET,WRITE_NET};
--- 1.50/mysys/mf_iocache.c 2005-03-08 08:12:08 -08:00
+++ 1.51/mysys/mf_iocache.c 2005-03-09 17:18:59 -08:00
@@ -87,7 +87,7 @@
void setup_io_cache(IO_CACHE* info)
{
/* Ensure that my_b_tell() and my_b_bytes_in_cache works */
- if (info->type == WRITE_CACHE)
+ if (info->type == WRITE_CACHE || info->type == APPEND_CACHE)
{
info->current_pos= &info->write_pos;
info->current_end= &info->write_end;
@@ -247,7 +247,7 @@
}
#endif
- if (type == WRITE_CACHE)
+ if (type == WRITE_CACHE || type == APPEND_CACHE)
info->write_end=
info->buffer+info->buffer_length- (seek_offset & (IO_SIZE-1));
else
@@ -318,6 +318,7 @@
/* One can't do reinit with the following types */
DBUG_ASSERT(type != READ_NET && info->type != READ_NET &&
type != WRITE_NET && info->type != WRITE_NET &&
+ type != APPEND_CACHE && info->type != APPEND_CACHE &&
type != SEQ_READ_APPEND && info->type != SEQ_READ_APPEND);
/* If the whole file is in memory, avoid flushing to disk */
@@ -1119,14 +1120,14 @@
int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
{
uint length;
- my_bool append_cache;
+ my_bool read_append;
my_off_t pos_in_file;
DBUG_ENTER("my_b_flush_io_cache");
- if (!(append_cache = (info->type == SEQ_READ_APPEND)))
+ if (!(read_append = (info->type == SEQ_READ_APPEND)))
need_append_buffer_lock=0;
- if (info->type == WRITE_CACHE || append_cache)
+ if (info->type == WRITE_CACHE || info->type == APPEND_CACHE || read_append)
{
if (info->file == -1)
{
@@ -1139,10 +1140,10 @@
{
pos_in_file=info->pos_in_file;
/*
- If we have append cache, we always open the file with
+ For SEQ_READ_APPEND and APPEND_CACHE, we always open the file with
O_APPEND which moves the pos to EOF automatically on every write
*/
- if (!append_cache && info->seek_not_done)
+ if (!read_append && info->type != APPEND_CACHE &&
info->seek_not_done)
{ /* File touched, do seek */
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
MY_FILEPOS_ERROR)
@@ -1150,10 +1151,10 @@
UNLOCK_APPEND_BUFFER;
DBUG_RETURN((info->error= -1));
}
- if (!append_cache)
+ if (!read_append)
info->seek_not_done=0;
}
- if (!append_cache)
+ if (!read_append)
info->pos_in_file+=length;
info->write_end= (info->write_buffer+info->buffer_length-
((pos_in_file+length) & (IO_SIZE-1)));
@@ -1163,7 +1164,7 @@
info->error= -1;
else
info->error= 0;
- if (!append_cache)
+ if (!read_append)
{
set_if_bigger(info->end_of_file,(pos_in_file+length));
}
--- 1.223/sql/sql_class.h 2005-03-09 04:02:37 -08:00
+++ 1.224/sql/sql_class.h 2005-03-09 17:19:00 -08:00
@@ -297,13 +297,13 @@
{
char buf[FN_REFLEN];
return open(generate_name(log_name, ".log", 0, buf),
- LOG_NORMAL, 0, WRITE_CACHE, 0, 0, 0);
+ LOG_NORMAL, 0, APPEND_CACHE, 0, 0, 0);
}
bool open_slow_log(const char *log_name)
{
char buf[FN_REFLEN];
return open(generate_name(log_name, "-slow.log", 0, buf),
- LOG_NORMAL, 0, WRITE_CACHE, 0, 0, 0);
+ LOG_NORMAL, 0, APPEND_CACHE, 0, 0, 0);
}
bool open_index_file(const char *index_file_name_arg,
const char *log_name);
| Thread |
|---|
| • bk commit into 5.0 tree (jimw:1.1795) BUG#8271 | Jim Winstead | 10 Mar |