Loading include/my_sys.h +1 −1 Original line number Diff line number Diff line Loading @@ -73,8 +73,8 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ Loading myisam/mi_check.c +7 −6 Original line number Diff line number Diff line Loading @@ -336,7 +336,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info) flush_key_blocks(info->s->key_cache, info->s->kfile, FLUSH_FORCE_WRITE); size=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0)); size= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)); if ((skr=(my_off_t) info->state->key_file_length) != size) { if (skr > size) Loading Loading @@ -595,7 +595,8 @@ static int chk_index_down(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, { /* purecov: begin tested */ /* Give it a chance to fit in the real file size. */ my_off_t max_length= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(0)); my_off_t max_length= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)); mi_check_print_error(param, "Invalid key block position: %s " "key block size: %u file_length: %s", llstr(page, llbuff), keyinfo->block_length, Loading Loading @@ -4039,10 +4040,10 @@ int test_if_almost_full(MI_INFO *info) { if (info->s->options & HA_OPTION_COMPRESS_RECORD) return 0; return (my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0))/10*9 > (my_off_t) (info->s->base.max_key_file_length) || return my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)) / 10 * 9 > (my_off_t) info->s->base.max_key_file_length || my_seek(info->dfile, 0L, MY_SEEK_END, MYF(0)) / 10 * 9 > (my_off_t) info->s->base.max_data_file_length); (my_off_t) info->s->base.max_data_file_length; } /* Recreate table with bigger more alloced record-data */ Loading mysql-test/r/blackhole.result +4 −0 Original line number Diff line number Diff line Loading @@ -123,3 +123,7 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1 master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3 master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3 drop table t1,t2,t3; CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; INSERT DELAYED INTO t1 VALUES(1); ERROR HY000: Table storage engine for 't1' doesn't have this option DROP TABLE t1; mysql-test/t/blackhole.test +9 −0 Original line number Diff line number Diff line Loading @@ -126,4 +126,13 @@ show binlog events; drop table t1,t2,t3; # # BUG#27998 - mysqld crashed when executing INSERT DELAYED on a BLACKHOLE # table # CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; --error 1031 INSERT DELAYED INTO t1 VALUES(1); DROP TABLE t1; # End of 4.1 tests mysys/my_seek.c +13 −2 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ my_off_t pos The expected position (absolute or relative) int whence A direction parameter and one of {SEEK_SET, SEEK_CUR, SEEK_END} myf MyFlags Not used. myf MyFlags MY_THREADSAFE must be set in case my_seek may be mixed with my_pread/my_pwrite calls and fd is shared among threads. DESCRIPTION The my_seek function is a wrapper around the system call lseek and Loading @@ -51,6 +53,15 @@ my_off_t my_seek(File fd, my_off_t pos, int whence, whence, MyFlags)); DBUG_ASSERT(pos != MY_FILEPOS_ERROR); /* safety check */ #if defined(THREAD) && !defined(HAVE_PREAD) if (MyFlags & MY_THREADSAFE) { pthread_mutex_lock(&my_file_info[fd].mutex); newpos= lseek(fd, pos, whence); pthread_mutex_unlock(&my_file_info[fd].mutex); } else #endif newpos= lseek(fd, pos, whence); if (newpos == (os_off_t) -1) { Loading Loading
include/my_sys.h +1 −1 Original line number Diff line number Diff line Loading @@ -73,8 +73,8 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ Loading
myisam/mi_check.c +7 −6 Original line number Diff line number Diff line Loading @@ -336,7 +336,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info) flush_key_blocks(info->s->key_cache, info->s->kfile, FLUSH_FORCE_WRITE); size=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0)); size= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)); if ((skr=(my_off_t) info->state->key_file_length) != size) { if (skr > size) Loading Loading @@ -595,7 +595,8 @@ static int chk_index_down(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, { /* purecov: begin tested */ /* Give it a chance to fit in the real file size. */ my_off_t max_length= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(0)); my_off_t max_length= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)); mi_check_print_error(param, "Invalid key block position: %s " "key block size: %u file_length: %s", llstr(page, llbuff), keyinfo->block_length, Loading Loading @@ -4039,10 +4040,10 @@ int test_if_almost_full(MI_INFO *info) { if (info->s->options & HA_OPTION_COMPRESS_RECORD) return 0; return (my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0))/10*9 > (my_off_t) (info->s->base.max_key_file_length) || return my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)) / 10 * 9 > (my_off_t) info->s->base.max_key_file_length || my_seek(info->dfile, 0L, MY_SEEK_END, MYF(0)) / 10 * 9 > (my_off_t) info->s->base.max_data_file_length); (my_off_t) info->s->base.max_data_file_length; } /* Recreate table with bigger more alloced record-data */ Loading
mysql-test/r/blackhole.result +4 −0 Original line number Diff line number Diff line Loading @@ -123,3 +123,7 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1 master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3 master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3 drop table t1,t2,t3; CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; INSERT DELAYED INTO t1 VALUES(1); ERROR HY000: Table storage engine for 't1' doesn't have this option DROP TABLE t1;
mysql-test/t/blackhole.test +9 −0 Original line number Diff line number Diff line Loading @@ -126,4 +126,13 @@ show binlog events; drop table t1,t2,t3; # # BUG#27998 - mysqld crashed when executing INSERT DELAYED on a BLACKHOLE # table # CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; --error 1031 INSERT DELAYED INTO t1 VALUES(1); DROP TABLE t1; # End of 4.1 tests
mysys/my_seek.c +13 −2 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ my_off_t pos The expected position (absolute or relative) int whence A direction parameter and one of {SEEK_SET, SEEK_CUR, SEEK_END} myf MyFlags Not used. myf MyFlags MY_THREADSAFE must be set in case my_seek may be mixed with my_pread/my_pwrite calls and fd is shared among threads. DESCRIPTION The my_seek function is a wrapper around the system call lseek and Loading @@ -51,6 +53,15 @@ my_off_t my_seek(File fd, my_off_t pos, int whence, whence, MyFlags)); DBUG_ASSERT(pos != MY_FILEPOS_ERROR); /* safety check */ #if defined(THREAD) && !defined(HAVE_PREAD) if (MyFlags & MY_THREADSAFE) { pthread_mutex_lock(&my_file_info[fd].mutex); newpos= lseek(fd, pos, whence); pthread_mutex_unlock(&my_file_info[fd].mutex); } else #endif newpos= lseek(fd, pos, whence); if (newpos == (os_off_t) -1) { Loading