From cd825a19936d26735db0c1b4b251bd78617d0c2b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 3 Nov 2001 16:54:00 -0700 Subject: more work on IO_CACHE portability fixes for systems with broken syscalls that do not interrupt on a signal temporary commit - will not be pushed, need to sync up include/my_sys.h: work on READ_APPEND cache mysys/Makefile.am: change to test IO_CACHE mysys/mf_iocache.c: work on READ_APPEND cache BitKeeper/etc/ignore: Added mysys/#mf_iocache.c# mysys/test_io_cache to the ignore list sql/mysqld.cc: make shutdown work on broken systems sql/sql_repl.cc: make sure slave can be stopped on broken systems in all cases, clean-up --- include/my_sys.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/my_sys.h b/include/my_sys.h index f6d303a6ccb..5174425006d 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -293,6 +293,16 @@ typedef struct st_dynamic_string { struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); +#ifdef THREAD +#define lock_append_buffer(info) \ + pthread_mutex_lock(&(info)->append_buffer_lock) +#define unlock_append_buffer(info) \ + pthread_mutex_unlock(&(info)->append_buffer_lock) +#else +#define lock_append_buffer(info) +#define unlock_append_buffer(info) +#endif + typedef struct st_io_cache /* Used when cacheing files */ { my_off_t pos_in_file,end_of_file; @@ -301,7 +311,7 @@ typedef struct st_io_cache /* Used when cacheing files */ that will use a buffer allocated somewhere else */ - byte *append_buffer, *append_pos, *append_end; + byte *append_buffer, *append_read_pos, *append_write_pos, *append_end; /* for append buffer used in READ_APPEND cache */ #ifdef THREAD pthread_mutex_t append_buffer_lock; @@ -348,10 +358,15 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); _my_b_get(info)) #define my_b_write(info,Buffer,Count) \ + ((info)->type != SEQ_READ_APPEND) ? (\ ((info)->rc_pos + (Count) <= (info)->rc_end ?\ (memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \ ((info)->rc_pos+=(Count)),0) :\ - _my_b_write(info,Buffer,Count)) + _my_b_write(info,Buffer,Count))) : \ + ((info)->append_write_pos + (Count) <= (info)->append_end ?\ + (memcpy((info)->append_write_pos,Buffer,(size_t)Count), \ + ((info)->append_write_pos+=(Count),0)) : \ + _my_b_append(info,Buffer,Count)) /* my_b_write_byte dosn't have any err-check */ #define my_b_write_byte(info,chr) \ @@ -564,6 +579,7 @@ extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_get(IO_CACHE *info); extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); +extern int _my_b_append(IO_CACHE *info,const byte *Buffer,uint Count); extern int my_block_write(IO_CACHE *info, const byte *Buffer, uint Count, my_off_t pos); extern int flush_io_cache(IO_CACHE *info); -- cgit v1.2.1 From fa09f2cd7e74fc99d6699a7bcda60fc7135b6f0e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Nov 2001 16:17:40 -0700 Subject: manager clean-up ( added pid-file and kill in mysql-test-run when things go wrong) fixes for IO_CACHE need to pull Monty's fixes - this is not final, will not be pushed include/my_sys.h: IO_CACHE fixes mysql-test/mysql-test-run.sh: manager clean-up mysys/mf_iocache.c: IO_CACHE fix sql/mysqld.cc: more debug messages tools/mysqlmanager.c: added pid-file --- include/my_sys.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/my_sys.h b/include/my_sys.h index 5174425006d..f9df265df0f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -311,13 +311,15 @@ typedef struct st_io_cache /* Used when cacheing files */ that will use a buffer allocated somewhere else */ - byte *append_buffer, *append_read_pos, *append_write_pos, *append_end; + byte *append_buffer, *append_read_pos, *write_pos, *append_end, + *write_end; /* for append buffer used in READ_APPEND cache */ #ifdef THREAD pthread_mutex_t append_buffer_lock; /* need mutex copying from append buffer to read buffer */ #endif int (*read_function)(struct st_io_cache *,byte *,uint); + int (*write_function)(struct st_io_cache *,const byte *,uint); /* callbacks when the actual read I/O happens */ IO_CACHE_CALLBACK pre_read; IO_CACHE_CALLBACK post_read; @@ -352,21 +354,19 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); ((info)->rc_pos+=(Count)),0) :\ (*(info)->read_function)((info),Buffer,Count)) +#define my_b_write(info,Buffer,Count) \ + ((info)->write_pos + (Count) <=(info)->write_end ?\ + (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\ + ((info)->write_pos+=(Count)),0) : \ + (*(info)->write_function)((info),(Buffer),(Count))) + + + #define my_b_get(info) \ ((info)->rc_pos != (info)->rc_end ?\ ((info)->rc_pos++, (int) (uchar) (info)->rc_pos[-1]) :\ _my_b_get(info)) -#define my_b_write(info,Buffer,Count) \ - ((info)->type != SEQ_READ_APPEND) ? (\ - ((info)->rc_pos + (Count) <= (info)->rc_end ?\ - (memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \ - ((info)->rc_pos+=(Count)),0) :\ - _my_b_write(info,Buffer,Count))) : \ - ((info)->append_write_pos + (Count) <= (info)->append_end ?\ - (memcpy((info)->append_write_pos,Buffer,(size_t)Count), \ - ((info)->append_write_pos+=(Count),0)) : \ - _my_b_append(info,Buffer,Count)) /* my_b_write_byte dosn't have any err-check */ #define my_b_write_byte(info,chr) \ @@ -650,6 +650,7 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); ulong checksum(const byte *mem, uint count); uint my_bit_log2(ulong value); + #if defined(_MSC_VER) && !defined(__WIN__) extern void sleep(int sec); #endif @@ -662,3 +663,11 @@ extern my_bool have_tcpip; /* Is set if tcpip is used */ #endif #include "raid.h" #endif /* _my_sys_h */ + + + + + + + + -- cgit v1.2.1