Commit 1c809563 authored by unknown's avatar unknown

fixed memory leak in replication

fixed bugs in new IO_CACHE code so that the old calls work
fixed shutdown bug
clean-up of mysql-test-run


include/my_sys.h:
  fixes for IO_CACHE
mysql-test/mysql-test-run.sh:
  fixed missing \ bug
  added --skip-gdb-magic to skip Sergei's automatic mysql_parse break
  do not delete the breakpoint in command - it crashes gdb sometimes
mysys/mf_iocache2.c:
  rc_pos->write_pos in my_b_seek for WRITE_CACHE
sql/mysqld.cc:
  fixed shutdown bug when singals DO break read introduced by the fix for 
  when they don't.
sql/repl_failsafe.cc:
  fixed memory leak
parent 91fb1d23
......@@ -361,7 +361,6 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
(*(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]) :\
......@@ -370,17 +369,23 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
/* my_b_write_byte dosn't have any err-check */
#define my_b_write_byte(info,chr) \
(((info)->rc_pos < (info)->rc_end) ?\
((*(info)->rc_pos++)=(chr)) :\
(_my_b_write(info,0,0) , ((*(info)->rc_pos++)=(chr))))
(((info)->write_pos < (info)->write_end) ?\
((*(info)->write_pos++)=(chr)) :\
(_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr))))
#define my_b_fill_cache(info) \
(((info)->rc_end=(info)->rc_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 + \
((info)->rc_pos - (info)->rc_request_pos))
my_cache_pointer(info) - (info)->rc_request_pos)
#define my_b_bytes_in_cache(info) ((uint) ((info)->rc_end - (info)->rc_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 {
const char *name; /* Name of variable */
......
......@@ -177,6 +177,7 @@ while test $# -gt 0; do
--skip-rpl) NO_SLAVE=1 ;;
--skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
--do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
--skip-gdb-magic) SKIP_GDB_MAGIC=1 ;;
--wait-timeout=*)
START_WAIT_TIMEOUT=`$ECHO "$1" | $SED -e "s;--wait-timeout=;;"`
STOP_WAIT_TIMEOUT=$START_WAIT_TIMEOUT;;
......@@ -654,7 +655,7 @@ start_master()
--basedir=$MY_BASEDIR --init-rpl-role=master \
--port=$MASTER_MYPORT \
--exit-info=256 \
--core
--core \
--datadir=$MASTER_MYDDIR \
--pid-file=$MASTER_MYPID \
--socket=$MASTER_MYSOCK \
......@@ -694,13 +695,18 @@ start_master()
"gdb -x $GDB_MASTER_INIT" $MYSQLD
elif [ x$DO_GDB = x1 ]
then
$CAT <<__GDB_MASTER_INIT__ > $GDB_MASTER_INIT
( echo set args $master_args;
if [ -z "$SKIP_GDB_MAGIC" ] ;
then
cat <<EOF
b mysql_parse
commands 1
dele 1
echo If you do not want to break here anymore, type dele 1\n
echo If you not want to break at all, use --skip-gdb-magic\n
end
r $master_args
__GDB_MASTER_INIT__
r
EOF
fi ) > $GDB_MASTER_INIT
manager_launch master $XTERM -display $DISPLAY \
-title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD
else
......
......@@ -38,10 +38,10 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
}
else if (info->type == WRITE_CACHE)
{
byte* try_rc_pos;
try_rc_pos = info->rc_pos + (pos - info->pos_in_file);
if (try_rc_pos >= info->buffer && try_rc_pos <= info->rc_end)
info->rc_pos = try_rc_pos;
byte* try_write_pos;
try_write_pos = info->write_pos + (pos - info->pos_in_file);
if (try_write_pos >= info->buffer && try_write_pos <= info->write_end)
info->write_pos = try_write_pos;
else
flush_io_cache(info);
}
......
......@@ -627,7 +627,9 @@ void kill_mysql(void)
#endif
DBUG_PRINT("quit",("After pthread_kill"));
shutdown_in_progress=1; // Safety if kill didn't work
#ifdef SIGNALS_DONT_BREAK_READ
abort_loop=1;
#endif
DBUG_VOID_RETURN;
}
......
......@@ -138,6 +138,7 @@ int update_slave_list(MYSQL* mysql)
goto err;
}
si->server_id = server_id;
hash_insert(&slave_list, (byte*)si);
}
strnmov(si->host, row[1], sizeof(si->host));
si->port = atoi(row[port_ind]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment