Commit a66165ce authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb

parents 7a35a18a 05dfca24
...@@ -279,6 +279,7 @@ enum loglevel { ...@@ -279,6 +279,7 @@ enum loglevel {
enum cache_type enum cache_type
{ {
READ_CACHE,WRITE_CACHE, READ_CACHE,WRITE_CACHE,
APPEND_CACHE, /* Like WRITE_CACHE, but only append */
SEQ_READ_APPEND /* sequential read or append */, SEQ_READ_APPEND /* sequential read or append */,
READ_FIFO, READ_NET,WRITE_NET}; READ_FIFO, READ_NET,WRITE_NET};
......
...@@ -87,7 +87,7 @@ static void my_aiowait(my_aio_result *result); ...@@ -87,7 +87,7 @@ static void my_aiowait(my_aio_result *result);
void setup_io_cache(IO_CACHE* info) void setup_io_cache(IO_CACHE* info)
{ {
/* Ensure that my_b_tell() and my_b_bytes_in_cache works */ /* 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_pos= &info->write_pos;
info->current_end= &info->write_end; info->current_end= &info->write_end;
...@@ -247,7 +247,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, ...@@ -247,7 +247,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
} }
#endif #endif
if (type == WRITE_CACHE) if (type == WRITE_CACHE || type == APPEND_CACHE)
info->write_end= info->write_end=
info->buffer+info->buffer_length- (seek_offset & (IO_SIZE-1)); info->buffer+info->buffer_length- (seek_offset & (IO_SIZE-1));
else else
...@@ -318,6 +318,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, ...@@ -318,6 +318,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
/* One can't do reinit with the following types */ /* One can't do reinit with the following types */
DBUG_ASSERT(type != READ_NET && info->type != READ_NET && DBUG_ASSERT(type != READ_NET && info->type != READ_NET &&
type != WRITE_NET && info->type != WRITE_NET && type != WRITE_NET && info->type != WRITE_NET &&
type != APPEND_CACHE && info->type != APPEND_CACHE &&
type != SEQ_READ_APPEND && info->type != SEQ_READ_APPEND); type != SEQ_READ_APPEND && info->type != SEQ_READ_APPEND);
/* If the whole file is in memory, avoid flushing to disk */ /* If the whole file is in memory, avoid flushing to disk */
...@@ -1123,7 +1124,8 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) ...@@ -1123,7 +1124,8 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
my_off_t pos_in_file; my_off_t pos_in_file;
DBUG_ENTER("my_b_flush_io_cache"); DBUG_ENTER("my_b_flush_io_cache");
if (!(append_cache = (info->type == SEQ_READ_APPEND))) if (!(append_cache = (info->type == SEQ_READ_APPEND ||
info->type == APPEND_CACHE)))
need_append_buffer_lock=0; need_append_buffer_lock=0;
if (info->type == WRITE_CACHE || append_cache) if (info->type == WRITE_CACHE || append_cache)
...@@ -1170,7 +1172,13 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) ...@@ -1170,7 +1172,13 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
else else
{ {
info->end_of_file+=(info->write_pos-info->append_read_pos); info->end_of_file+=(info->write_pos-info->append_read_pos);
DBUG_ASSERT(info->end_of_file == my_tell(info->file,MYF(0))); /*
We only need to worry that info->end_of_file is really accurate
for SEQ_READ_APPEND. For APPEND_CACHE, it is possible that the
file is non-seekable, like a FIFO.
*/
DBUG_ASSERT(info->type != SEQ_READ_APPEND ||
info->end_of_file == my_tell(info->file,MYF(0)));
} }
info->append_read_pos=info->write_pos=info->write_buffer; info->append_read_pos=info->write_pos=info->write_buffer;
......
...@@ -293,13 +293,13 @@ public: ...@@ -293,13 +293,13 @@ public:
{ {
char buf[FN_REFLEN]; char buf[FN_REFLEN];
return open(generate_name(log_name, ".log", 0, buf), 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) bool open_slow_log(const char *log_name)
{ {
char buf[FN_REFLEN]; char buf[FN_REFLEN];
return open(generate_name(log_name, "-slow.log", 0, buf), 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, bool open_index_file(const char *index_file_name_arg,
const char *log_name); const char *log_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment