diff options
author | unknown <sasha@mysql.sashanet.com> | 2002-01-24 22:49:47 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2002-01-24 22:49:47 -0700 |
commit | de172721edc0d619f12ea9769373fa0d7fcfbeb5 (patch) | |
tree | dbd006cf3d35d4daf9ae21af895de3a3261faf0b /mysys/mf_iocache.c | |
parent | 1c2802931e0ac2c328d5a0caa8955e774048bbb3 (diff) | |
download | mariadb-git-de172721edc0d619f12ea9769373fa0d7fcfbeb5.tar.gz |
more predicatable slave behaviour with wait_for_slave_stop in mysqltest
fixed a couple of bugs with SEQ_READ_APPEND cache
rpl000016 still has non-deterministic result, but I am going to commit and
push since what I have is now better than what is in the main repository
client/mysqltest.c:
added wait_for_slave_to_stop
cleaned up TODO and comments
include/my_sys.h:
fixed race in flush_io_cache in SEQ_READ_APPEND cache
mysql-test/r/rpl000016.result:
updated result
mysql-test/t/rpl000016.test:
use wait_for_slave_to_stop to have deterministic slave behaviour for the test
mysys/mf_iocache.c:
fixed race in flush_io_cache()
fixed failure to unlock mutex in my_b_append()
sql/log.cc:
be compatible with 3.23 master
sql/log_event.cc:
3.23 master compat
sql/slave.cc:
3.23 master compat
sql/sql_class.h:
compat with 3.23 master
Diffstat (limited to 'mysys/mf_iocache.c')
-rw-r--r-- | mysys/mf_iocache.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 6b0d83212c4..34de5dfd7f3 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -808,13 +808,19 @@ int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count) Buffer+=rest_length; Count-=rest_length; info->write_pos+=rest_length; - if (flush_io_cache(info)) + if (_flush_io_cache(info,0)) + { + unlock_append_buffer(info); return 1; + } if (Count >= IO_SIZE) { /* Fill first intern buffer */ length=Count & (uint) ~(IO_SIZE-1); if (my_write(info->file,Buffer,(uint) length,info->myflags | MY_NABP)) + { + unlock_append_buffer(info); return info->error= -1; + } Count-=length; Buffer+=length; } @@ -883,14 +889,16 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count, /* Flush write cache */ -int flush_io_cache(IO_CACHE *info) +int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) { uint length; my_bool append_cache; my_off_t pos_in_file; DBUG_ENTER("flush_io_cache"); - append_cache = (info->type == SEQ_READ_APPEND); + if (!(append_cache = (info->type == SEQ_READ_APPEND))) + need_append_buffer_lock=0; + if (info->type == WRITE_CACHE || append_cache) { if (info->file == -1) @@ -898,6 +906,8 @@ int flush_io_cache(IO_CACHE *info) if (real_open_cached_file(info)) DBUG_RETURN((info->error= -1)); } + if (need_append_buffer_lock) + lock_append_buffer(info); if ((length=(uint) (info->write_pos - info->write_buffer))) { pos_in_file=info->pos_in_file; @@ -909,6 +919,8 @@ int flush_io_cache(IO_CACHE *info) if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == MY_FILEPOS_ERROR) { + if (need_append_buffer_lock) + unlock_append_buffer(info); DBUG_RETURN((info->error= -1)); } if (!append_cache) @@ -932,6 +944,8 @@ int flush_io_cache(IO_CACHE *info) info->end_of_file+=(info->write_pos-info->append_read_pos); info->append_read_pos=info->write_pos=info->write_buffer; + if (need_append_buffer_lock) + unlock_append_buffer(info); DBUG_RETURN(info->error); } } @@ -942,6 +956,8 @@ int flush_io_cache(IO_CACHE *info) info->inited=0; } #endif + if (need_append_buffer_lock) + unlock_append_buffer(info); DBUG_RETURN(0); } |