New improved IO_CACHE
include/my_global.h: Remove dbug_assert() (One should use DBUG_ASSERT() instead) mysql-test/mysql-test-run.sh: Fixed that xterm works on Solaris 2.8. Fixed printing of errors mysql-test/r/isam.result: Removed MyISAM test from ISAM test mysql-test/t/isam.test: Removed MyISAM test from ISAM test mysys/my_alloc.c: Removed warnings mysys/my_bitmap.c: Use DBUG_ASSERT mysys/my_pthread.c: Use DBUG_ASSERT mysys/my_seek.c: More DBUG sql/ha_berkeley.cc: Use DBUG_ASSERT sql/ha_innobase.cc: Use DBUG_ASSERT sql/log.cc: Use DBUG_ASSERT sql/opt_range.cc: Use DBUG_ASSERT sql/sql_base.cc: Use DBUG_ASSERT sql/sql_handler.cc: Use DBUG_ASSERT sql/sql_load.cc: Cleanup sql/sql_parse.cc: Use DBUG_ASSERT sql/sql_repl.cc: Cleanup sql/sql_select.cc: Use DBUG_ASSERT tools/mysqlmanager.c: Cleanup
This commit is contained in:
parent
f33fb18677
commit
06e1e27557
16
BUILD/compile-solaris-sparc-debug
Executable file
16
BUILD/compile-solaris-sparc-debug
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
gmake -k clean || true
|
||||||
|
/bin/rm -f */.deps/*.P config.cache
|
||||||
|
|
||||||
|
aclocal && autoheader && aclocal && automake && autoconf
|
||||||
|
(cd bdb/dist && sh s_all)
|
||||||
|
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
|
||||||
|
if [ -d gemini ]
|
||||||
|
then
|
||||||
|
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
|
||||||
|
fi
|
||||||
|
|
||||||
|
CFLAGS="-g -Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-debug
|
||||||
|
|
||||||
|
gmake -j 4
|
@ -324,11 +324,6 @@ typedef unsigned short ushort;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <dbug.h>
|
#include <dbug.h>
|
||||||
#ifndef DBUG_OFF
|
|
||||||
#define dbug_assert(A) assert(A)
|
|
||||||
#else
|
|
||||||
#define dbug_assert(A)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
|
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
|
||||||
#define ASCII_BITS_USED 8 /* Bit char used */
|
#define ASCII_BITS_USED 8 /* Bit char used */
|
||||||
|
@ -293,33 +293,21 @@ typedef struct st_dynamic_string {
|
|||||||
struct st_io_cache;
|
struct st_io_cache;
|
||||||
typedef int (*IO_CACHE_CALLBACK)(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 */
|
typedef struct st_io_cache /* Used when cacheing files */
|
||||||
{
|
{
|
||||||
my_off_t pos_in_file,end_of_file;
|
my_off_t pos_in_file,end_of_file;
|
||||||
byte *rc_pos,*rc_end,*buffer,*rc_request_pos;
|
byte *read_pos,*read_end,*buffer,*request_pos;
|
||||||
my_bool alloced_buffer; /* currented READ_NET is the only one
|
byte *write_buffer, *append_read_pos, *write_pos, *write_end;
|
||||||
that will use a buffer allocated somewhere
|
byte **current_pos, **current_end;
|
||||||
else
|
/* The lock is for append buffer used in READ_APPEND cache */
|
||||||
*/
|
|
||||||
byte *append_buffer, *append_read_pos, *write_pos, *append_end,
|
|
||||||
*write_end;
|
|
||||||
/* for append buffer used in READ_APPEND cache */
|
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
pthread_mutex_t append_buffer_lock;
|
pthread_mutex_t append_buffer_lock;
|
||||||
/* need mutex copying from append buffer to read buffer */
|
/* need mutex copying from append buffer to read buffer */
|
||||||
#endif
|
#endif
|
||||||
int (*read_function)(struct st_io_cache *,byte *,uint);
|
int (*read_function)(struct st_io_cache *,byte *,uint);
|
||||||
int (*write_function)(struct st_io_cache *,const byte *,uint);
|
int (*write_function)(struct st_io_cache *,const byte *,uint);
|
||||||
|
enum cache_type type;
|
||||||
/* callbacks when the actual read I/O happens */
|
/* callbacks when the actual read I/O happens */
|
||||||
IO_CACHE_CALLBACK pre_read;
|
IO_CACHE_CALLBACK pre_read;
|
||||||
IO_CACHE_CALLBACK post_read;
|
IO_CACHE_CALLBACK post_read;
|
||||||
@ -331,7 +319,11 @@ typedef struct st_io_cache /* Used when cacheing files */
|
|||||||
int seek_not_done,error;
|
int seek_not_done,error;
|
||||||
uint buffer_length,read_length;
|
uint buffer_length,read_length;
|
||||||
myf myflags; /* Flags used to my_read/my_write */
|
myf myflags; /* Flags used to my_read/my_write */
|
||||||
enum cache_type type;
|
/*
|
||||||
|
Currently READ_NET is the only one that will use a buffer allocated
|
||||||
|
somewhere else
|
||||||
|
*/
|
||||||
|
my_bool alloced_buffer;
|
||||||
#ifdef HAVE_AIOWAIT
|
#ifdef HAVE_AIOWAIT
|
||||||
uint inited;
|
uint inited;
|
||||||
my_off_t aio_read_pos;
|
my_off_t aio_read_pos;
|
||||||
@ -349,9 +341,9 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
|||||||
#define my_b_EOF INT_MIN
|
#define my_b_EOF INT_MIN
|
||||||
|
|
||||||
#define my_b_read(info,Buffer,Count) \
|
#define my_b_read(info,Buffer,Count) \
|
||||||
((info)->rc_pos + (Count) <= (info)->rc_end ?\
|
((info)->read_pos + (Count) <= (info)->read_end ?\
|
||||||
(memcpy(Buffer,(info)->rc_pos,(size_t) (Count)), \
|
(memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \
|
||||||
((info)->rc_pos+=(Count)),0) :\
|
((info)->read_pos+=(Count)),0) :\
|
||||||
(*(info)->read_function)((info),Buffer,Count))
|
(*(info)->read_function)((info),Buffer,Count))
|
||||||
|
|
||||||
#define my_b_write(info,Buffer,Count) \
|
#define my_b_write(info,Buffer,Count) \
|
||||||
@ -362,11 +354,10 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
|||||||
|
|
||||||
|
|
||||||
#define my_b_get(info) \
|
#define my_b_get(info) \
|
||||||
((info)->rc_pos != (info)->rc_end ?\
|
((info)->read_pos != (info)->read_end ?\
|
||||||
((info)->rc_pos++, (int) (uchar) (info)->rc_pos[-1]) :\
|
((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\
|
||||||
_my_b_get(info))
|
_my_b_get(info))
|
||||||
|
|
||||||
|
|
||||||
/* my_b_write_byte dosn't have any err-check */
|
/* my_b_write_byte dosn't have any err-check */
|
||||||
#define my_b_write_byte(info,chr) \
|
#define my_b_write_byte(info,chr) \
|
||||||
(((info)->write_pos < (info)->write_end) ?\
|
(((info)->write_pos < (info)->write_end) ?\
|
||||||
@ -374,18 +365,14 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
|||||||
(_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr))))
|
(_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr))))
|
||||||
|
|
||||||
#define my_b_fill_cache(info) \
|
#define my_b_fill_cache(info) \
|
||||||
(((info)->rc_end=(info)->rc_pos),(*(info)->read_function)(info,0,0))
|
(((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0))
|
||||||
|
|
||||||
#define my_write_cache(info) (((info)->type == WRITE_CACHE))
|
|
||||||
#define my_cache_pointer(info) (my_write_cache(info) ? \
|
|
||||||
((info)->write_pos) : ((info)->rc_pos))
|
|
||||||
|
|
||||||
#define my_b_tell(info) ((info)->pos_in_file + \
|
#define my_b_tell(info) ((info)->pos_in_file + \
|
||||||
my_cache_pointer(info) - (info)->rc_request_pos)
|
(uint) (*(info)->current_pos - (info)->request_pos))
|
||||||
|
|
||||||
|
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
|
||||||
|
*(info)->current_pos)
|
||||||
|
|
||||||
#define my_b_bytes_in_cache(info) (my_write_cache(info) ? \
|
|
||||||
((uint) ((info)->write_end - (info)->write_pos)): \
|
|
||||||
((uint) ((info)->rc_end - (info)->rc_pos)))
|
|
||||||
|
|
||||||
typedef struct st_changeable_var {
|
typedef struct st_changeable_var {
|
||||||
const char *name; /* Name of variable */
|
const char *name; /* Name of variable */
|
||||||
@ -584,7 +571,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_get(IO_CACHE *info);
|
||||||
extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
|
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_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_b_append(IO_CACHE *info,const byte *Buffer,uint Count);
|
||||||
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
|
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
|
||||||
uint Count, my_off_t pos);
|
uint Count, my_off_t pos);
|
||||||
extern int flush_io_cache(IO_CACHE *info);
|
extern int flush_io_cache(IO_CACHE *info);
|
||||||
|
@ -46,11 +46,11 @@ int _nisam_read_cache(IO_CACHE *info, byte *buff, ulong pos, uint length,
|
|||||||
buff+=read_length;
|
buff+=read_length;
|
||||||
}
|
}
|
||||||
if ((offset=pos - (ulong) info->pos_in_file) <
|
if ((offset=pos - (ulong) info->pos_in_file) <
|
||||||
(ulong) (info->rc_end - info->rc_request_pos))
|
(ulong) (info->read_end - info->request_pos))
|
||||||
{
|
{
|
||||||
in_buff_pos=info->rc_request_pos+(uint) offset;
|
in_buff_pos=info->request_pos+(uint) offset;
|
||||||
in_buff_length= min(length,(uint) (info->rc_end-in_buff_pos));
|
in_buff_length= min(length,(uint) (info->read_end-in_buff_pos));
|
||||||
memcpy(buff,info->rc_request_pos+(uint) offset,(size_t) in_buff_length);
|
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
|
||||||
if (!(length-=in_buff_length))
|
if (!(length-=in_buff_length))
|
||||||
return 0;
|
return 0;
|
||||||
pos+=in_buff_length;
|
pos+=in_buff_length;
|
||||||
@ -61,14 +61,14 @@ int _nisam_read_cache(IO_CACHE *info, byte *buff, ulong pos, uint length,
|
|||||||
if (flag & READING_NEXT)
|
if (flag & READING_NEXT)
|
||||||
{
|
{
|
||||||
if (pos != ((info)->pos_in_file +
|
if (pos != ((info)->pos_in_file +
|
||||||
(uint) ((info)->rc_end - (info)->rc_request_pos)))
|
(uint) ((info)->read_end - (info)->request_pos)))
|
||||||
{
|
{
|
||||||
info->pos_in_file=pos; /* Force start here */
|
info->pos_in_file=pos; /* Force start here */
|
||||||
info->rc_pos=info->rc_end=info->rc_request_pos; /* Everything used */
|
info->read_pos=info->read_end=info->request_pos; /* Everything used */
|
||||||
info->seek_not_done=1;
|
info->seek_not_done=1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info->rc_pos=info->rc_end; /* All block used */
|
info->read_pos=info->read_end; /* All block used */
|
||||||
if (!(*info->read_function)(info,buff,length))
|
if (!(*info->read_function)(info,buff,length))
|
||||||
return 0;
|
return 0;
|
||||||
if (!(flag & READING_HEADER) || info->error == -1 ||
|
if (!(flag & READING_HEADER) || info->error == -1 ||
|
||||||
|
@ -187,7 +187,7 @@ int _nisam_read_rnd_static_record(N_INFO *info, byte *buf,
|
|||||||
(skipp_deleted_blocks || !filepos))
|
(skipp_deleted_blocks || !filepos))
|
||||||
{
|
{
|
||||||
cache_read=1; /* Read record using cache */
|
cache_read=1; /* Read record using cache */
|
||||||
cache_length=(uint) (info->rec_cache.rc_end - info->rec_cache.rc_pos);
|
cache_length=(uint) (info->rec_cache.read_end - info->rec_cache.read_pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info->rec_cache.seek_not_done=1; /* Filepos is changed */
|
info->rec_cache.seek_not_done=1; /* Filepos is changed */
|
||||||
|
@ -172,7 +172,7 @@ void start_test(int id)
|
|||||||
}
|
}
|
||||||
if (key_cacheing && rnd(2) == 0)
|
if (key_cacheing && rnd(2) == 0)
|
||||||
init_key_cache(65536L,(uint) IO_SIZE*4*10);
|
init_key_cache(65536L,(uint) IO_SIZE*4*10);
|
||||||
printf("Process %d, pid: %d\n",id,getpid()); fflush(stdout);
|
printf("Process %d, pid: %d\n",id,(int) getpid()); fflush(stdout);
|
||||||
|
|
||||||
for (error=i=0 ; i < tests && !error; i++)
|
for (error=i=0 ; i < tests && !error; i++)
|
||||||
{
|
{
|
||||||
@ -356,7 +356,7 @@ int test_write(N_INFO *file,int id,int lock_type)
|
|||||||
nisam_extra(file,HA_EXTRA_WRITE_CACHE);
|
nisam_extra(file,HA_EXTRA_WRITE_CACHE);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(record.id,"%7d",getpid());
|
sprintf(record.id,"%7d",(int) getpid());
|
||||||
strmov(record.text,"Testing...");
|
strmov(record.text,"Testing...");
|
||||||
|
|
||||||
tries=(uint) rnd(100)+10;
|
tries=(uint) rnd(100)+10;
|
||||||
|
@ -45,11 +45,11 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
|
|||||||
buff+=read_length;
|
buff+=read_length;
|
||||||
}
|
}
|
||||||
if ((offset= (my_off_t) (pos - info->pos_in_file)) <
|
if ((offset= (my_off_t) (pos - info->pos_in_file)) <
|
||||||
(my_off_t) (info->rc_end - info->rc_request_pos))
|
(my_off_t) (info->read_end - info->request_pos))
|
||||||
{
|
{
|
||||||
in_buff_pos=info->rc_request_pos+(uint) offset;
|
in_buff_pos=info->request_pos+(uint) offset;
|
||||||
in_buff_length= min(length,(uint) (info->rc_end-in_buff_pos));
|
in_buff_length= min(length,(uint) (info->read_end-in_buff_pos));
|
||||||
memcpy(buff,info->rc_request_pos+(uint) offset,(size_t) in_buff_length);
|
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
|
||||||
if (!(length-=in_buff_length))
|
if (!(length-=in_buff_length))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
pos+=in_buff_length;
|
pos+=in_buff_length;
|
||||||
@ -60,14 +60,14 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
|
|||||||
if (flag & READING_NEXT)
|
if (flag & READING_NEXT)
|
||||||
{
|
{
|
||||||
if (pos != ((info)->pos_in_file +
|
if (pos != ((info)->pos_in_file +
|
||||||
(uint) ((info)->rc_end - (info)->rc_request_pos)))
|
(uint) ((info)->read_end - (info)->request_pos)))
|
||||||
{
|
{
|
||||||
info->pos_in_file=pos; /* Force start here */
|
info->pos_in_file=pos; /* Force start here */
|
||||||
info->rc_pos=info->rc_end=info->rc_request_pos; /* Everything used */
|
info->read_pos=info->read_end=info->request_pos; /* Everything used */
|
||||||
info->seek_not_done=1;
|
info->seek_not_done=1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info->rc_pos=info->rc_end; /* All block used */
|
info->read_pos=info->read_end; /* All block used */
|
||||||
if (!(*info->read_function)(info,buff,length))
|
if (!(*info->read_function)(info,buff,length))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
if (!(flag & READING_HEADER) || info->error == -1 ||
|
if (!(flag & READING_HEADER) || info->error == -1 ||
|
||||||
|
@ -221,7 +221,7 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
|
|||||||
(skipp_deleted_blocks || !filepos))
|
(skipp_deleted_blocks || !filepos))
|
||||||
{
|
{
|
||||||
cache_read=1; /* Read record using cache */
|
cache_read=1; /* Read record using cache */
|
||||||
cache_length=(uint) (info->rec_cache.rc_end - info->rec_cache.rc_pos);
|
cache_length=(uint) (info->rec_cache.read_end - info->rec_cache.read_pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info->rec_cache.seek_not_done=1; /* Filepos is changed */
|
info->rec_cache.seek_not_done=1; /* Filepos is changed */
|
||||||
|
@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
|
|||||||
# Program Definitions
|
# Program Definitions
|
||||||
#--
|
#--
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin
|
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin
|
||||||
|
|
||||||
# Standard functions
|
# Standard functions
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ BASENAME=`which basename | head -1`
|
|||||||
DIFF=`which diff | head -1`
|
DIFF=`which diff | head -1`
|
||||||
CAT=cat
|
CAT=cat
|
||||||
CUT=cut
|
CUT=cut
|
||||||
|
HEAD=head
|
||||||
TAIL=tail
|
TAIL=tail
|
||||||
ECHO=echo # use internal echo if possible
|
ECHO=echo # use internal echo if possible
|
||||||
EXPR=expr # use internal if possible
|
EXPR=expr # use internal if possible
|
||||||
@ -118,7 +119,7 @@ MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
|
|||||||
#
|
#
|
||||||
# Set LD_LIBRARY_PATH if we are using shared libraries
|
# Set LD_LIBRARY_PATH if we are using shared libraries
|
||||||
#
|
#
|
||||||
LD_LIBRARY_PATH="$BASEDIR/lib:$LD_LIBRARY_PATH"
|
LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$LD_LIBRARY_PATH"
|
||||||
export LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
MASTER_RUNNING=0
|
MASTER_RUNNING=0
|
||||||
@ -225,6 +226,8 @@ while test $# -gt 0; do
|
|||||||
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
|
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
|
||||||
fi
|
fi
|
||||||
DO_GDB=1
|
DO_GDB=1
|
||||||
|
# We must use manager, as things doesn't work on Linux without it
|
||||||
|
USE_MANAGER=1
|
||||||
USE_RUNNING_SERVER=""
|
USE_RUNNING_SERVER=""
|
||||||
;;
|
;;
|
||||||
--client-gdb )
|
--client-gdb )
|
||||||
@ -310,6 +313,8 @@ if [ x$SOURCE_DIST = x1 ] ; then
|
|||||||
MYSQLD="$BASEDIR/sql/mysqld"
|
MYSQLD="$BASEDIR/sql/mysqld"
|
||||||
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
|
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
|
||||||
MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
|
MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
|
||||||
|
elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
|
||||||
|
MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
|
||||||
else
|
else
|
||||||
MYSQL_TEST="$BASEDIR/client/mysqltest"
|
MYSQL_TEST="$BASEDIR/client/mysqltest"
|
||||||
fi
|
fi
|
||||||
@ -428,7 +433,7 @@ do_gdb_test ()
|
|||||||
$ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT
|
$ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT
|
||||||
echo "Set breakpoints ( if needed) and type 'run' in gdb window"
|
echo "Set breakpoints ( if needed) and type 'run' in gdb window"
|
||||||
#this xterm should not be backgrounded
|
#this xterm should not be backgrounded
|
||||||
xterm -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
|
$XTERM -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
|
||||||
}
|
}
|
||||||
|
|
||||||
error () {
|
error () {
|
||||||
@ -437,7 +442,7 @@ error () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_is () {
|
error_is () {
|
||||||
$TR "\n" " " < $TIMEFILE | $SED -e 's/.* At line \(.*\)\: \(.*\)Command .*$/ \>\> Error at line \1: \2<\</'
|
$CAT < $TIMEFILE | $SED -e 's/.* At line \(.*\)\: \(.*\)/ \>\> Error at line \1: \2<\</' | $HEAD -1
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix_to_8() {
|
prefix_to_8() {
|
||||||
@ -802,8 +807,8 @@ start_slave()
|
|||||||
elif [ x$DO_GDB = x1 ]
|
elif [ x$DO_GDB = x1 ]
|
||||||
then
|
then
|
||||||
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
|
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
|
||||||
manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e gdb -x \
|
manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
|
||||||
$GDB_SLAVE_INIT $SLAVE_MYSQLD
|
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
|
||||||
else
|
else
|
||||||
manager_launch $slave_ident $SLAVE_MYSQLD $slave_args
|
manager_launch $slave_ident $SLAVE_MYSQLD $slave_args
|
||||||
fi
|
fi
|
||||||
|
@ -1,21 +1,9 @@
|
|||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2;
|
||||||
create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a));
|
create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam;
|
||||||
check table t1;
|
|
||||||
Table Op Msg_type Msg_text
|
|
||||||
test.t1 check status OK
|
|
||||||
repair table t1;
|
|
||||||
Table Op Msg_type Msg_text
|
|
||||||
test.t1 repair status OK
|
|
||||||
delete from t1 where (a & 1);
|
delete from t1 where (a & 1);
|
||||||
check table t1;
|
select sum(length(b)) from t1;
|
||||||
Table Op Msg_type Msg_text
|
sum(length(b))
|
||||||
test.t1 check status OK
|
3274494
|
||||||
repair table t1;
|
|
||||||
Table Op Msg_type Msg_text
|
|
||||||
test.t1 repair status OK
|
|
||||||
check table t1;
|
|
||||||
Table Op Msg_type Msg_text
|
|
||||||
test.t1 check status OK
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
|
create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
|
||||||
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
|
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
|
||||||
|
@ -6,7 +6,7 @@ drop table if exists t1,t2;
|
|||||||
# Test possible problem with rows that are about 65535 bytes long
|
# Test possible problem with rows that are about 65535 bytes long
|
||||||
#
|
#
|
||||||
|
|
||||||
create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a));
|
create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam;
|
||||||
|
|
||||||
let $1=100;
|
let $1=100;
|
||||||
disable_query_log;
|
disable_query_log;
|
||||||
@ -16,12 +16,8 @@ while ($1)
|
|||||||
dec $1;
|
dec $1;
|
||||||
}
|
}
|
||||||
enable_query_log;
|
enable_query_log;
|
||||||
check table t1;
|
|
||||||
repair table t1;
|
|
||||||
delete from t1 where (a & 1);
|
delete from t1 where (a & 1);
|
||||||
check table t1;
|
select sum(length(b)) from t1;
|
||||||
repair table t1;
|
|
||||||
check table t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -26,22 +26,42 @@
|
|||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Fix that next read will be made at certain position
|
Fix that next read will be made at certain position
|
||||||
** For write cache, make next write happen at a certain position
|
For write cache, make next write happen at a certain position
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void my_b_seek(IO_CACHE *info,my_off_t pos)
|
void my_b_seek(IO_CACHE *info,my_off_t pos)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("my_b_seek");
|
||||||
|
DBUG_PRINT("enter",("pos: %lu", (ulong) pos));
|
||||||
|
|
||||||
if (info->type == READ_CACHE)
|
if (info->type == READ_CACHE)
|
||||||
{
|
{
|
||||||
info->rc_pos=info->rc_end=info->buffer;
|
byte* try_pos=info->read_pos + (pos - info->pos_in_file);
|
||||||
|
if (try_pos >= info->buffer &&
|
||||||
|
try_pos <= info->read_end)
|
||||||
|
{
|
||||||
|
/* The position is in the current buffer; Reuse it */
|
||||||
|
info->read_pos = try_pos;
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Force a new read on next my_b_read */
|
||||||
|
info->read_pos=info->read_end=info->buffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (info->type == WRITE_CACHE)
|
else if (info->type == WRITE_CACHE)
|
||||||
{
|
{
|
||||||
byte* try_write_pos;
|
byte* try_pos;
|
||||||
try_write_pos = info->write_pos + (pos - info->pos_in_file);
|
/* If write is in current buffer, reuse it */
|
||||||
if (try_write_pos >= info->buffer && try_write_pos <= info->write_end)
|
try_pos = info->write_pos + (pos - info->pos_in_file);
|
||||||
info->write_pos = try_write_pos;
|
if (try_pos >= info->write_buffer &&
|
||||||
|
try_pos <= info->write_end)
|
||||||
|
{
|
||||||
|
info->write_pos = try_pos;
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
flush_io_cache(info);
|
flush_io_cache(info);
|
||||||
}
|
}
|
||||||
@ -51,14 +71,15 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** Fill buffer. Note that this assumes that you have already used
|
** Fill buffer. Note that this assumes that you have already used
|
||||||
** all characters in the CACHE, independent of the rc_pos value!
|
** all characters in the CACHE, independent of the read_pos value!
|
||||||
** return: 0 on error or EOF (info->error = -1 on error)
|
** return: 0 on error or EOF (info->error = -1 on error)
|
||||||
** number of characters
|
** number of characters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint my_b_fill(IO_CACHE *info)
|
uint my_b_fill(IO_CACHE *info)
|
||||||
{
|
{
|
||||||
my_off_t pos_in_file=info->pos_in_file+(uint) (info->rc_end - info->buffer);
|
my_off_t pos_in_file=(info->pos_in_file+
|
||||||
|
(uint) (info->read_end - info->buffer));
|
||||||
my_off_t max_length;
|
my_off_t max_length;
|
||||||
uint diff_length,length;
|
uint diff_length,length;
|
||||||
if (info->seek_not_done)
|
if (info->seek_not_done)
|
||||||
@ -86,8 +107,8 @@ uint my_b_fill(IO_CACHE *info)
|
|||||||
info->error= -1;
|
info->error= -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
info->rc_pos=info->buffer;
|
info->read_pos=info->buffer;
|
||||||
info->rc_end=info->buffer+length;
|
info->read_end=info->buffer+length;
|
||||||
info->pos_in_file=pos_in_file;
|
info->pos_in_file=pos_in_file;
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
@ -113,11 +134,11 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
|
|||||||
char *pos,*end;
|
char *pos,*end;
|
||||||
if (length > max_length)
|
if (length > max_length)
|
||||||
length=max_length;
|
length=max_length;
|
||||||
for (pos=info->rc_pos,end=pos+length ; pos < end ;)
|
for (pos=info->read_pos,end=pos+length ; pos < end ;)
|
||||||
{
|
{
|
||||||
if ((*to++ = *pos++) == '\n')
|
if ((*to++ = *pos++) == '\n')
|
||||||
{
|
{
|
||||||
info->rc_pos=pos;
|
info->read_pos=pos;
|
||||||
*to='\0';
|
*to='\0';
|
||||||
return (uint) (to-start);
|
return (uint) (to-start);
|
||||||
}
|
}
|
||||||
@ -125,7 +146,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
|
|||||||
if (!(max_length-=length))
|
if (!(max_length-=length))
|
||||||
{
|
{
|
||||||
/* Found enough charcters; Return found string */
|
/* Found enough charcters; Return found string */
|
||||||
info->rc_pos=pos;
|
info->read_pos=pos;
|
||||||
*to='\0';
|
*to='\0';
|
||||||
return (uint) (to-start);
|
return (uint) (to-start);
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,11 @@
|
|||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
|
#undef EXTRA_DEBUG
|
||||||
#define EXTRA_DEBUG
|
#define EXTRA_DEBUG
|
||||||
|
|
||||||
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size)
|
void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
|
||||||
|
uint pre_alloc_size __attribute__((unused)))
|
||||||
{
|
{
|
||||||
mem_root->free=mem_root->used=0;
|
mem_root->free=mem_root->used=0;
|
||||||
mem_root->min_malloc=32;
|
mem_root->min_malloc=32;
|
||||||
|
@ -32,7 +32,7 @@ my_bool bitmap_init(MY_BITMAP *map, uint bitmap_size)
|
|||||||
if (!(map->bitmap=(uchar*) my_malloc((bitmap_size+7)/8,
|
if (!(map->bitmap=(uchar*) my_malloc((bitmap_size+7)/8,
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
return 1;
|
return 1;
|
||||||
dbug_assert(bitmap_size != ~(uint) 0);
|
DBUG_ASSERT(bitmap_size != ~(uint) 0);
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
pthread_mutex_init(&map->mutex, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&map->mutex, MY_MUTEX_INIT_FAST);
|
||||||
#endif
|
#endif
|
||||||
|
@ -424,7 +424,7 @@ struct hostent *my_gethostbyname_r(const char *name,
|
|||||||
int buflen, int *h_errnop)
|
int buflen, int *h_errnop)
|
||||||
{
|
{
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
dbug_assert((size_t) buflen >= sizeof(*result));
|
DBUG_ASSERT((size_t) buflen >= sizeof(*result));
|
||||||
if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
|
if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
|
||||||
return 0;
|
return 0;
|
||||||
return hp;
|
return hp;
|
||||||
@ -436,7 +436,7 @@ struct hostent *my_gethostbyname_r(const char *name,
|
|||||||
struct hostent *result, char *buffer,
|
struct hostent *result, char *buffer,
|
||||||
int buflen, int *h_errnop)
|
int buflen, int *h_errnop)
|
||||||
{
|
{
|
||||||
dbug_assert(buflen >= sizeof(struct hostent_data));
|
DBUG_ASSERT(buflen >= sizeof(struct hostent_data));
|
||||||
if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
|
if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
|
||||||
{
|
{
|
||||||
*h_errnop= errno;
|
*h_errnop= errno;
|
||||||
@ -452,7 +452,7 @@ struct hostent *my_gethostbyname_r(const char *name,
|
|||||||
int buflen, int *h_errnop)
|
int buflen, int *h_errnop)
|
||||||
{
|
{
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
dbug_assert(buflen >= sizeof(struct hostent_data));
|
DBUG_ASSERT(buflen >= sizeof(struct hostent_data));
|
||||||
hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
|
hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
|
||||||
*h_errnop= errno;
|
*h_errnop= errno;
|
||||||
return hp;
|
return hp;
|
||||||
|
@ -26,7 +26,8 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
|
|||||||
reg1 os_off_t newpos;
|
reg1 os_off_t newpos;
|
||||||
DBUG_ENTER("my_seek");
|
DBUG_ENTER("my_seek");
|
||||||
DBUG_PRINT("my",("Fd: %d Hpos: %lu Pos: %lu Whence: %d MyFlags: %d",
|
DBUG_PRINT("my",("Fd: %d Hpos: %lu Pos: %lu Whence: %d MyFlags: %d",
|
||||||
fd, ((ulonglong) pos) >> 32, (ulong) pos, whence, MyFlags));
|
fd, (ulong) (((ulonglong) pos) >> 32), (ulong) pos,
|
||||||
|
whence, MyFlags));
|
||||||
newpos=lseek(fd, pos, whence);
|
newpos=lseek(fd, pos, whence);
|
||||||
if (newpos == (os_off_t) -1)
|
if (newpos == (os_off_t) -1)
|
||||||
{
|
{
|
||||||
@ -34,6 +35,10 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
|
|||||||
DBUG_PRINT("error",("lseek: %lu, errno: %d",newpos,errno));
|
DBUG_PRINT("error",("lseek: %lu, errno: %d",newpos,errno));
|
||||||
DBUG_RETURN(MY_FILEPOS_ERROR);
|
DBUG_RETURN(MY_FILEPOS_ERROR);
|
||||||
}
|
}
|
||||||
|
if (newpos != pos)
|
||||||
|
{
|
||||||
|
DBUG_PRINT("exit",("pos: %lu", (ulong) newpos));
|
||||||
|
}
|
||||||
DBUG_RETURN((my_off_t) newpos);
|
DBUG_RETURN((my_off_t) newpos);
|
||||||
} /* my_seek */
|
} /* my_seek */
|
||||||
|
|
||||||
@ -53,6 +58,6 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
|
|||||||
#endif
|
#endif
|
||||||
if (pos == (os_off_t) -1)
|
if (pos == (os_off_t) -1)
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
DBUG_PRINT("exit",("pos: %lu",pos));
|
DBUG_PRINT("exit",("pos: %lu", (ulong) pos));
|
||||||
DBUG_RETURN((my_off_t) pos);
|
DBUG_RETURN((my_off_t) pos);
|
||||||
} /* my_tell */
|
} /* my_tell */
|
||||||
|
@ -1045,7 +1045,7 @@ int ha_berkeley::restore_keys(DB_TXN *trans, key_map changed_keys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err:
|
err:
|
||||||
dbug_assert(error != DB_KEYEXIST);
|
DBUG_ASSERT(error != DB_KEYEXIST);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1187,7 +1187,7 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record,
|
|||||||
((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) ==
|
((table->key_info[keynr].flags & (HA_NOSAME | HA_NULL_PART_KEY)) ==
|
||||||
HA_NOSAME))
|
HA_NOSAME))
|
||||||
{ // Unique key
|
{ // Unique key
|
||||||
dbug_assert(keynr == primary_key || prim_key->data != key_buff2);
|
DBUG_ASSERT(keynr == primary_key || prim_key->data != key_buff2);
|
||||||
error=key_file[keynr]->del(key_file[keynr], trans,
|
error=key_file[keynr]->del(key_file[keynr], trans,
|
||||||
keynr == primary_key ?
|
keynr == primary_key ?
|
||||||
prim_key :
|
prim_key :
|
||||||
@ -1201,7 +1201,7 @@ int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record,
|
|||||||
row to find the key to be delete and delete it.
|
row to find the key to be delete and delete it.
|
||||||
We will never come here with keynr = primary_key
|
We will never come here with keynr = primary_key
|
||||||
*/
|
*/
|
||||||
dbug_assert(keynr != primary_key && prim_key->data != key_buff2);
|
DBUG_ASSERT(keynr != primary_key && prim_key->data != key_buff2);
|
||||||
DBC *tmp_cursor;
|
DBC *tmp_cursor;
|
||||||
if (!(error=key_file[keynr]->cursor(key_file[keynr], trans,
|
if (!(error=key_file[keynr]->cursor(key_file[keynr], trans,
|
||||||
&tmp_cursor, 0)))
|
&tmp_cursor, 0)))
|
||||||
|
@ -196,7 +196,7 @@ convert_error_code_to_mysql(
|
|||||||
|
|
||||||
return(HA_ERR_TO_BIG_ROW);
|
return(HA_ERR_TO_BIG_ROW);
|
||||||
} else {
|
} else {
|
||||||
dbug_assert(0);
|
DBUG_ASSERT(0);
|
||||||
|
|
||||||
return(-1); // Unknown error
|
return(-1); // Unknown error
|
||||||
}
|
}
|
||||||
@ -259,7 +259,7 @@ check_trx_exists(
|
|||||||
trx = (trx_t*) thd->transaction.all.innobase_tid;
|
trx = (trx_t*) thd->transaction.all.innobase_tid;
|
||||||
|
|
||||||
if (trx == NULL) {
|
if (trx == NULL) {
|
||||||
dbug_assert(thd != NULL);
|
DBUG_ASSERT(thd != NULL);
|
||||||
trx = trx_allocate_for_mysql();
|
trx = trx_allocate_for_mysql();
|
||||||
|
|
||||||
trx->mysql_thd = thd;
|
trx->mysql_thd = thd;
|
||||||
@ -852,7 +852,7 @@ normalize_table_name(
|
|||||||
|
|
||||||
name_ptr = ptr + 1;
|
name_ptr = ptr + 1;
|
||||||
|
|
||||||
dbug_assert(ptr > name);
|
DBUG_ASSERT(ptr > name);
|
||||||
|
|
||||||
ptr--;
|
ptr--;
|
||||||
|
|
||||||
@ -975,7 +975,7 @@ ha_innobase::open(
|
|||||||
|
|
||||||
ref_length = DATA_ROW_ID_LEN + 10;
|
ref_length = DATA_ROW_ID_LEN + 10;
|
||||||
|
|
||||||
dbug_assert(key_used_on_scan == MAX_KEY);
|
DBUG_ASSERT(key_used_on_scan == MAX_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto_inc_counter_for_this_stat = 0;
|
auto_inc_counter_for_this_stat = 0;
|
||||||
@ -1119,8 +1119,8 @@ innobase_mysql_cmp(
|
|||||||
enum_field_types mysql_tp;
|
enum_field_types mysql_tp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dbug_assert(a_length != UNIV_SQL_NULL);
|
DBUG_ASSERT(a_length != UNIV_SQL_NULL);
|
||||||
dbug_assert(b_length != UNIV_SQL_NULL);
|
DBUG_ASSERT(b_length != UNIV_SQL_NULL);
|
||||||
|
|
||||||
mysql_tp = (enum_field_types) mysql_type;
|
mysql_tp = (enum_field_types) mysql_type;
|
||||||
|
|
||||||
@ -1158,11 +1158,11 @@ get_innobase_type_from_mysql_type(
|
|||||||
8 bits: this is used in ibuf and also when DATA_NOT_NULL is
|
8 bits: this is used in ibuf and also when DATA_NOT_NULL is
|
||||||
ORed to the type */
|
ORed to the type */
|
||||||
|
|
||||||
dbug_assert((ulint)FIELD_TYPE_STRING < 256);
|
DBUG_ASSERT((ulint)FIELD_TYPE_STRING < 256);
|
||||||
dbug_assert((ulint)FIELD_TYPE_VAR_STRING < 256);
|
DBUG_ASSERT((ulint)FIELD_TYPE_VAR_STRING < 256);
|
||||||
dbug_assert((ulint)FIELD_TYPE_DOUBLE < 256);
|
DBUG_ASSERT((ulint)FIELD_TYPE_DOUBLE < 256);
|
||||||
dbug_assert((ulint)FIELD_TYPE_FLOAT < 256);
|
DBUG_ASSERT((ulint)FIELD_TYPE_FLOAT < 256);
|
||||||
dbug_assert((ulint)FIELD_TYPE_DECIMAL < 256);
|
DBUG_ASSERT((ulint)FIELD_TYPE_DECIMAL < 256);
|
||||||
|
|
||||||
switch (field->type()) {
|
switch (field->type()) {
|
||||||
case FIELD_TYPE_VAR_STRING: if (field->flags & BINARY_FLAG) {
|
case FIELD_TYPE_VAR_STRING: if (field->flags & BINARY_FLAG) {
|
||||||
@ -2368,7 +2368,7 @@ ha_innobase::position(
|
|||||||
len = store_key_val_for_row(primary_key, (char*) ref, record);
|
len = store_key_val_for_row(primary_key, (char*) ref, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbug_assert(len <= ref_length);
|
DBUG_ASSERT(len <= ref_length);
|
||||||
|
|
||||||
ref_stored_len = len;
|
ref_stored_len = len;
|
||||||
}
|
}
|
||||||
|
@ -774,13 +774,13 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
|
|||||||
length=my_b_bytes_in_cache(cache);
|
length=my_b_bytes_in_cache(cache);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (my_b_write(&log_file, cache->rc_pos, length))
|
if (my_b_write(&log_file, cache->read_pos, length))
|
||||||
{
|
{
|
||||||
if (!write_error)
|
if (!write_error)
|
||||||
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
cache->rc_pos=cache->rc_end; // Mark buffer used up
|
cache->read_pos=cache->read_end; // Mark buffer used up
|
||||||
} while ((length=my_b_fill(cache)));
|
} while ((length=my_b_fill(cache)));
|
||||||
if (flush_io_cache(&log_file))
|
if (flush_io_cache(&log_file))
|
||||||
{
|
{
|
||||||
|
@ -52,26 +52,32 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer,
|
|||||||
{
|
{
|
||||||
int read_length;
|
int read_length;
|
||||||
NET *net= &(current_thd)->net;
|
NET *net= &(current_thd)->net;
|
||||||
|
DBUG_ENTER("_my_b_net_read");
|
||||||
|
|
||||||
if (info->end_of_file)
|
if (!info->end_of_file)
|
||||||
return 1; /* because my_b_get (no _) takes 1 byte at a time */
|
DBUG_RETURN(1); /* because my_b_get (no _) takes 1 byte at a time */
|
||||||
read_length=my_net_read(net);
|
read_length=my_net_read(net);
|
||||||
if (read_length == (int) packet_error)
|
if (read_length == (int) packet_error)
|
||||||
{
|
{
|
||||||
info->error= -1;
|
info->error= -1;
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (read_length == 0)
|
if (read_length == 0)
|
||||||
{
|
{
|
||||||
/* End of file from client */
|
info->end_of_file= 0; /* End of file from client */
|
||||||
info->end_of_file = 1; return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
/* to set up stuff for my_b_get (no _) */
|
/* to set up stuff for my_b_get (no _) */
|
||||||
info->rc_end = (info->rc_pos = (byte*) net->read_pos) + read_length;
|
info->read_end = (info->read_pos = (byte*) net->read_pos) + read_length;
|
||||||
Buffer[0] = info->rc_pos[0]; /* length is always 1 */
|
Buffer[0] = info->read_pos[0]; /* length is always 1 */
|
||||||
info->rc_pos++;
|
info->read_pos++;
|
||||||
info->buffer = info->rc_pos;
|
|
||||||
return 0;
|
/*
|
||||||
|
info->request_pos is used by log_loaded_block() to know the size
|
||||||
|
of the current block
|
||||||
|
*/
|
||||||
|
info->request_pos=info->read_pos;
|
||||||
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -2614,7 +2614,7 @@ int QUICK_SELECT_DESC::get_next()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dbug_assert(range->flag & NEAR_MAX || range_reads_after_key(range));
|
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
|
||||||
/* Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
|
/* Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
|
||||||
* do the right thing - go past all keys which match the prefix */
|
* do the right thing - go past all keys which match the prefix */
|
||||||
result=file->index_read(record, (byte*) range->max_key,
|
result=file->index_read(record, (byte*) range->max_key,
|
||||||
|
@ -882,7 +882,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
|
|||||||
table->outer_join=table->null_row=table->maybe_null=0;
|
table->outer_join=table->null_row=table->maybe_null=0;
|
||||||
table->status=STATUS_NO_RECORD;
|
table->status=STATUS_NO_RECORD;
|
||||||
table->keys_in_use_for_query=table->used_keys= table->keys_in_use;
|
table->keys_in_use_for_query=table->used_keys= table->keys_in_use;
|
||||||
dbug_assert(table->key_read == 0);
|
DBUG_ASSERT(table->key_read == 0);
|
||||||
DBUG_RETURN(table);
|
DBUG_RETURN(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||||||
mode=RNEXT;
|
mode=RNEXT;
|
||||||
break;
|
break;
|
||||||
case RLAST:
|
case RLAST:
|
||||||
dbug_assert(keyname != 0);
|
DBUG_ASSERT(keyname != 0);
|
||||||
err=table->file->index_last(table->record[0]);
|
err=table->file->index_last(table->record[0]);
|
||||||
mode=RPREV;
|
mode=RPREV;
|
||||||
break;
|
break;
|
||||||
@ -136,12 +136,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||||||
table->file->rnd_next(table->record[0]);
|
table->file->rnd_next(table->record[0]);
|
||||||
break;
|
break;
|
||||||
case RPREV:
|
case RPREV:
|
||||||
dbug_assert(keyname != 0);
|
DBUG_ASSERT(keyname != 0);
|
||||||
err=table->file->index_prev(table->record[0]);
|
err=table->file->index_prev(table->record[0]);
|
||||||
break;
|
break;
|
||||||
case RKEY:
|
case RKEY:
|
||||||
{
|
{
|
||||||
dbug_assert(keyname != 0);
|
DBUG_ASSERT(keyname != 0);
|
||||||
KEY *keyinfo=table->key_info+keyno;
|
KEY *keyinfo=table->key_info+keyno;
|
||||||
KEY_PART_INFO *key_part=keyinfo->key_part;
|
KEY_PART_INFO *key_part=keyinfo->key_part;
|
||||||
uint key_len;
|
uint key_len;
|
||||||
|
@ -551,7 +551,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
|
|||||||
need_end_io_cache = 1;
|
need_end_io_cache = 1;
|
||||||
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
|
||||||
cache.pre_read = cache.pre_close =
|
cache.pre_read = cache.pre_close =
|
||||||
(IO_CACHE_CALLBACK)log_loaded_block;
|
(IO_CACHE_CALLBACK) log_loaded_block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ static void decrease_user_connections(const char *user, const char *host)
|
|||||||
|
|
||||||
uc = (struct user_conn *) hash_search(&hash_user_connections,
|
uc = (struct user_conn *) hash_search(&hash_user_connections,
|
||||||
(byte*) temp_user, temp_len);
|
(byte*) temp_user, temp_len);
|
||||||
dbug_assert(uc != 0); // We should always find the user
|
DBUG_ASSERT(uc != 0); // We should always find the user
|
||||||
if (!uc)
|
if (!uc)
|
||||||
goto end; // Safety; Something went wrong
|
goto end; // Safety; Something went wrong
|
||||||
if (! --uc->connections)
|
if (! --uc->connections)
|
||||||
|
@ -137,7 +137,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
|
|||||||
|
|
||||||
if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0 ||
|
if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0 ||
|
||||||
init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
|
init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
|
||||||
MYF(MY_WME)))
|
MYF(MY_WME | MY_DONT_CHECK_FILESIZE)))
|
||||||
{
|
{
|
||||||
*errmsg = "Could not open log file"; // This will not be sent
|
*errmsg = "Could not open log file"; // This will not be sent
|
||||||
goto err;
|
goto err;
|
||||||
@ -1024,8 +1024,10 @@ int log_loaded_block(IO_CACHE* file)
|
|||||||
{
|
{
|
||||||
LOAD_FILE_INFO* lf_info;
|
LOAD_FILE_INFO* lf_info;
|
||||||
uint block_len ;
|
uint block_len ;
|
||||||
char* buffer = (char*)file->buffer;
|
|
||||||
if (!(block_len = file->rc_end - buffer))
|
/* file->request_pos contains position where we started last read */
|
||||||
|
char* buffer = (char*) file->request_pos;
|
||||||
|
if (!(block_len = file->read_end - buffer))
|
||||||
return 0;
|
return 0;
|
||||||
lf_info = (LOAD_FILE_INFO*)file->arg;
|
lf_info = (LOAD_FILE_INFO*)file->arg;
|
||||||
if (lf_info->last_pos_in_file != HA_POS_ERROR &&
|
if (lf_info->last_pos_in_file != HA_POS_ERROR &&
|
||||||
|
@ -2680,7 +2680,7 @@ eq_ref_table(JOIN *join, ORDER *start_order, JOIN_TAB *tab)
|
|||||||
if (order)
|
if (order)
|
||||||
{
|
{
|
||||||
found++;
|
found++;
|
||||||
dbug_assert(!(order->used & map));
|
DBUG_ASSERT(!(order->used & map));
|
||||||
order->used|=map;
|
order->used|=map;
|
||||||
continue; // Used in ORDER BY
|
continue; // Used in ORDER BY
|
||||||
}
|
}
|
||||||
|
@ -1687,7 +1687,7 @@ static void init_pid_file()
|
|||||||
if (!fp)
|
if (!fp)
|
||||||
die("Could not open pid file %s", pid_file);
|
die("Could not open pid file %s", pid_file);
|
||||||
created_pid_file=1;
|
created_pid_file=1;
|
||||||
fprintf(fp, "%d\n", getpid());
|
fprintf(fp, "%d\n", (int) getpid());
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user