mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
misc replication bugfixes including some needed modifications in IO_CACHE
likely() and unlikely() branch prediction compiler hint macros clean-up of comments include/my_global.h: added likely() and unlikely() macros to help some compilers optimize the code for architecture-specific branch prediction policies include/my_sys.h: coverted my_b_append_tell() from macro to a function as it needed to be more complex to avoid a potential race condition mysql-test/mysql-test-run.sh: hostname-independent relay log name to have consistent SHOW SLAVE STATUS output mysql-test/r/rpl000014.result: result update mysql-test/r/rpl000015.result: result update mysql-test/r/rpl000016.result: result update mysql-test/r/rpl_log.result: result update mysql-test/t/rpl000017-slave.sh: proper cleanup of old logs mysys/mf_iocache.c: cosmetic changes + more debugging asserts mysys/mf_iocache2.c: my_b_append_tell() cleanup of comments sql/log.cc: fix potential bug - do not rotate log in the middle of event sql/slave.cc: do not write stop events when the server does not actually stop but just rotates the log fixed race between queue_event() and show_slave_status() clean-up of comments sql/slave.h: added ignore_stop_event flag to SLAVE_LOG_INFO
This commit is contained in:
parent
845db7c20b
commit
83666b3e54
13 changed files with 131 additions and 44 deletions
|
|
@ -542,7 +542,7 @@ read_append_buffer:
|
|||
|
||||
DBUG_ASSERT(info->append_read_pos <= info->write_pos);
|
||||
/*
|
||||
TODO: figure out if the below assert is needed or correct.
|
||||
TODO: figure out if the assert below is needed or correct.
|
||||
*/
|
||||
DBUG_ASSERT(pos_in_file == info->end_of_file);
|
||||
copy_len=min(Count, len_in_buff);
|
||||
|
|
@ -889,6 +889,17 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
|
|||
|
||||
/* Flush write cache */
|
||||
|
||||
#ifdef THREAD
|
||||
#define LOCK_APPEND_BUFFER if (need_append_buffer_lock) \
|
||||
lock_append_buffer(info);
|
||||
#define UNLOCK_APPEND_BUFFER if (need_append_buffer_lock) \
|
||||
unlock_append_buffer(info);
|
||||
#else
|
||||
#define LOCK_APPEND_BUFFER
|
||||
#define UNLOCK_APPEND_BUFFER
|
||||
#endif
|
||||
|
||||
|
||||
int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
||||
{
|
||||
uint length;
|
||||
|
|
@ -906,8 +917,8 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
|||
if (real_open_cached_file(info))
|
||||
DBUG_RETURN((info->error= -1));
|
||||
}
|
||||
if (need_append_buffer_lock)
|
||||
lock_append_buffer(info);
|
||||
LOCK_APPEND_BUFFER;
|
||||
|
||||
if ((length=(uint) (info->write_pos - info->write_buffer)))
|
||||
{
|
||||
pos_in_file=info->pos_in_file;
|
||||
|
|
@ -919,8 +930,7 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
|||
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);
|
||||
UNLOCK_APPEND_BUFFER;
|
||||
DBUG_RETURN((info->error= -1));
|
||||
}
|
||||
if (!append_cache)
|
||||
|
|
@ -941,11 +951,13 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
|||
set_if_bigger(info->end_of_file,(pos_in_file+length));
|
||||
}
|
||||
else
|
||||
{
|
||||
info->end_of_file+=(info->write_pos-info->append_read_pos);
|
||||
DBUG_ASSERT(info->end_of_file == my_tell(info->file,MYF(0)));
|
||||
}
|
||||
|
||||
info->append_read_pos=info->write_pos=info->write_buffer;
|
||||
if (need_append_buffer_lock)
|
||||
unlock_append_buffer(info);
|
||||
UNLOCK_APPEND_BUFFER;
|
||||
DBUG_RETURN(info->error);
|
||||
}
|
||||
}
|
||||
|
|
@ -956,8 +968,7 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
|||
info->inited=0;
|
||||
}
|
||||
#endif
|
||||
if (need_append_buffer_lock)
|
||||
unlock_append_buffer(info);
|
||||
UNLOCK_APPEND_BUFFER;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue