Commit 640bd569 authored by unknown's avatar unknown

Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0


Docs/manual.texi:
  Auto merged
parents a10dc6df 10b89ff5
......@@ -47791,6 +47791,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
Fixed shutdown problem on HPUX.
@item
Added functions @code{des_encrypt()} and @code{des_decrypt()}.
@item
Added statement FLUSH DES_KEY_FILE.
......@@ -819,8 +819,8 @@ case $SYSTEM_TYPE in
;;
*hpux10.20*)
echo "Enabling snprintf workaround for hpux 10.20"
CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ"
CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX"
if test "$with_named_thread" = "no"
then
echo "Using --with-named-thread=-lpthread"
......@@ -829,8 +829,8 @@ case $SYSTEM_TYPE in
;;
*hpux11.*)
echo "Enabling pread/pwrite workaround for hpux 11"
CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK"
CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS"
if test "$with_named_thread" = "no"
then
echo "Using --with-named-thread=-lpthread"
......
......@@ -131,11 +131,11 @@ extern void bzero(gptr dst,uint len);
#if !defined(bcmp) && !defined(HAVE_BCMP)
extern int bcmp(const char *s1,const char *s2,uint len);
#endif
#ifdef HAVE_purify
extern int my_bcmp(const char *s1,const char *s2,uint len);
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#endif
#endif
#ifndef bmove512
extern void bmove512(gptr dst,const gptr src,uint len);
......
......@@ -446,6 +446,10 @@ struct hostent *my_gethostbyname_r(const char *name,
#endif /* defined(__WIN__) */
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#endif
/* safe_mutex adds checking to mutex for easier debugging */
typedef struct st_safe_mutex_t
......@@ -476,6 +480,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#undef pthread_mutex_t
#undef pthread_cond_wait
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
......
......@@ -23,14 +23,7 @@
#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */
extern const char *raid_type_string[];
#ifdef __cplusplus
extern "C" {
#endif
const char *my_raid_type(int raid_type);
#ifdef __cplusplus
}
#endif
#define my_raid_type(raid_type) raid_type_string[(int)(raid_type)]
#if defined(USE_RAID) && !defined(DONT_USE_RAID)
......
......@@ -30,6 +30,7 @@ be defined:
/* Most C compilers other than gcc do not know 'extern inline' */
#if !defined(__GNUC__) && !defined(__WIN__)
#undef UNIV_MUST_NOT_INLINE
#define UNIV_MUST_NOT_INLINE
#endif
......
......@@ -170,6 +170,7 @@ EXTRA_MYSQL_TEST_OPT=""
USE_RUNNING_SERVER=1
DO_GCOV=""
DO_GDB=""
MANUAL_GDB=""
DO_DDD=""
DO_CLIENT_GDB=""
SLEEP_TIME_FOR_DELETE=10
......@@ -272,6 +273,11 @@ while test $# -gt 0; do
fi
DO_CLIENT_GDB=1
;;
--manual-gdb )
DO_GDB=1
MANUAL_GDB=1
USE_RUNNING_SERVER=""
;;
--ddd )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
......@@ -743,7 +749,14 @@ start_master()
"gdb -x $GDB_MASTER_INIT" $MYSQLD
elif [ x$DO_GDB = x1 ]
then
( echo set args $master_args;
if [ x$MANUAL_GDB = x1 ]
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT
$ECHO "To start gdb for the master , type in another window:"
$ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT $MYSQLD"
wait_for_master=1500
else
( $ECHO set args $master_args;
if [ $USE_MANAGER = 0 ] ; then
cat <<EOF
b mysql_parse
......@@ -755,6 +768,7 @@ EOF
fi ) > $GDB_MASTER_INIT
manager_launch master $XTERM -display $DISPLAY \
-title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD
fi
else
manager_launch master $MYSQLD $master_args
fi
......@@ -845,8 +859,15 @@ start_slave()
elif [ x$DO_GDB = x1 ]
then
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
if [ x$MANUAL_GDB = x1 ]
then
echo "To start gdb for the slave, type in another window:"
echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $MYSQLD"
wait_for_slave=1500
else
manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
fi
else
manager_launch $slave_ident $SLAVE_MYSQLD $slave_args
fi
......
......@@ -67,19 +67,6 @@ Log_name
slave-bin.001
slave-bin.002
show binlog events in 'slave-bin.001' from 4;
Log_name Pos Event_type Server_id Log_seq Info
slave-bin.001 4 Start 2 1 Server ver: VERSION, Binlog ver: 2
slave-bin.001 79 Slave 2 3 host=127.0.0.1,port=MASTER_PORT,log=master-bin.001,pos=4
slave-bin.001 132 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
slave-bin.001 225 Intvar 1 3 INSERT_ID=1
slave-bin.001 253 Query 1 4 use test; insert into t1 values (NULL)
slave-bin.001 316 Query 1 5 use test; drop table t1
slave-bin.001 364 Query 1 6 use test; create table t1 (word char(20) not null)
slave-bin.001 439 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81
slave-bin.001 618 Exec_load 1 8 ;file_id=1
slave-bin.001 641 Query 1 9 use test; drop table t1
slave-bin.001 689 Rotate 1 4 slave-bin.002;pos=4; forced by master
slave-bin.001 729 Stop 2 5
show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Log_seq Info
slave-bin.002 4 Slave 2 10 host=127.0.0.1,port=MASTER_PORT,log=master-bin.002,pos=4
......
......@@ -35,8 +35,13 @@ slave start;
sync_with_master;
show master logs;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
# We can't compare binlog from slave as the result differ between
# machines based on where the LOAD DATA file is stored.
disable_result_log;
show binlog events in 'slave-bin.001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
enable_result_log;
show binlog events in 'slave-bin.002' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
......
......@@ -16,6 +16,7 @@
/* Functions to get threads more portable */
#define DONT_REMAP_PTHREAD_FUNCTIONS
#include "mysys_priv.h"
#ifdef THREAD
#include <signal.h>
......@@ -460,6 +461,27 @@ struct hostent *my_gethostbyname_r(const char *name,
#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
#endif
/*****************************************************************************
Patches for HPUX
We need these because the pthread_mutex.. code returns -1 on error,
instead of the error code.
Note that currently we only remap pthread_ functions used by MySQL.
If we are depending on the value for some other pthread_xxx functions,
this has to be added here.
*****************************************************************************/
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
{
int error=pthread_cond_timedwait(cond, mutex, abstime);
if (error == -1) /* Safety if the lib is fixed */
error=errno;
if (error == EAGAIN) /* Correct errno to Posix */
error=ETIMEDOUT;
return error;
}
/* Some help functions */
......
......@@ -81,14 +81,6 @@
const char *raid_type_string[]={"none","striped"};
extern "C" {
const char *my_raid_type(int raid_type)
{
return raid_type_string[raid_type];
}
}
#if defined(USE_RAID) && !defined(MYSQL_CLIENT)
#define RAID_SEEK_DONE ~(off_t) 0
......
......@@ -107,7 +107,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
error=pthread_mutex_unlock(&mp->mutex);
if (error)
{
fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line);
fprintf(stderr,"safe_mutex: Got error: %d (%d) when trying to unlock mutex at %s, line %d\n", error, errno, file, line);
fflush(stderr);
abort();
}
......@@ -148,7 +148,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
pthread_mutex_lock(&mp->global);
if (error)
{
fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_wait at %s, line %d\n", error, file, line);
fprintf(stderr,"safe_mutex: Got error: %d (%d) when doing a safe_mutex_wait at %s, line %d\n", error, errno, file, line);
fflush(stderr);
abort();
}
......@@ -186,15 +186,15 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#ifdef EXTRA_DEBUG
if (error && (error != EINTR && error != ETIMEDOUT))
{
fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_timedwait at %s, line %d\n", error, file, line);
fprintf(stderr,"safe_mutex: Got error: %d (%d) when doing a safe_mutex_timedwait at %s, line %d\n", error, errno, file, line);
}
#endif
pthread_mutex_lock(&mp->global);
if (mp->count++)
{
fprintf(stderr,
"safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d)\n",
mp->count-1, my_thread_id(), file, line, error);
"safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d (%d))\n",
mp->count-1, my_thread_id(), file, line, error, error);
fflush(stderr);
abort();
}
......
......@@ -321,8 +321,8 @@ then
fi
echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
echo "This is done with:"
echo "$bindir/mysqladmin -u root -p password 'new-password'"
echo "$bindir/mysqladmin -u root -h $hostname -p password 'new-password'"
echo "$bindir/mysqladmin -u root password 'new-password'"
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo "See the manual for more instructions."
#
# Print message about upgrading unless we have created a new db table.
......
......@@ -75,7 +75,7 @@ print "Insert data into the table\n";
$loop_time=new Benchmark;
if ($opt_fast && defined($server->{transactions}))
if ($opt_fast && $server->{transactions})
{
$dbh->{AutoCommit} = 0;
print "Transactions enabled\n" if ($opt_debug);
......@@ -87,7 +87,7 @@ for ($i=0 ; $i < $opt_row_count ; $i++)
$dbh->do($query) or die $DBI::errstr;
}
if ($opt_fast && defined($server->{transactions}))
if ($opt_fast && $server->{transactions})
{
$dbh->commit;
$dbh->{AutoCommit} = 1;
......
......@@ -536,7 +536,7 @@ innobase_init(void)
{
int err;
bool ret;
char current_lib[2], *default_path;
char current_lib[3], *default_path;
DBUG_ENTER("innobase_init");
......@@ -2044,7 +2044,7 @@ ha_innobase::change_active_index(
else
prebuilt->index = dict_table_get_first_index_noninline(prebuilt->table);
assert(prebuilt->search_tuple);
assert(prebuilt->search_tuple != 0);
dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields);
......@@ -2762,7 +2762,7 @@ ha_innobase::create(
innobase_table = dict_table_get(norm_name, NULL);
assert(innobase_table);
assert(innobase_table != 0);
/* Tell the InnoDB server that there might be work for
utility threads: */
......
......@@ -140,7 +140,7 @@ static void cleanup_load_tmpdir()
for (i=0;i<(uint)dirp->number_off_files;i++)
{
file=dirp->dir_entry+i;
if (!memcmp(file->name,"SQL_LOAD-",9))
if (!bcmp(file->name,"SQL_LOAD-",9))
my_delete(file->name,MYF(MY_WME));
}
......
......@@ -114,8 +114,13 @@ typedef fp_except fp_except_t;
inline void reset_floating_point_exceptions()
{
/* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL |
FP_X_DZ | FP_X_IMP));
#if defined(__i386__)
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
else
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#endif
}
#else
#define reset_floating_point_exceptions()
......@@ -390,6 +395,7 @@ static void get_options(int argc,char **argv);
static char *get_relative_path(const char *path);
static void fix_paths(void);
static pthread_handler_decl(handle_connections_sockets,arg);
static pthread_handler_decl(kill_server_thread,arg);
static int bootstrap(FILE *file);
static void close_server_sock();
static bool read_init_file(char *file_name);
......@@ -629,13 +635,20 @@ void kill_mysql(void)
{
DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */
}
#else
#elif !defined(SIGNALS_DONT_BREAK_READ)
kill(current_pid,SIGTERM);
#endif
DBUG_PRINT("quit",("After pthread_kill"));
shutdown_in_progress=1; // Safety if kill didn't work
#ifdef SIGNALS_DONT_BREAK_READ
if (!abort_loop)
{
pthread_t tmp;
abort_loop=1;
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
(void*) 0))
sql_print_error("Error: Can't create thread to kill server");
}
#endif
DBUG_VOID_RETURN;
}
......@@ -682,7 +695,7 @@ static void __cdecl kill_server(int sig_ptr)
#ifdef USE_ONE_SIGNAL_HAND
pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
static pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
{
my_thread_init(); // Initialize new thread
kill_server(0);
......@@ -2452,18 +2465,21 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
fromhost(&req);
if (!hosts_access(&req))
{
// This may be stupid but refuse() includes an exit(0)
// which we surely don't want...
// clean_exit() - same stupid thing ...
/*
This may be stupid but refuse() includes an exit(0)
which we surely don't want...
clean_exit() - same stupid thing ...
*/
syslog(deny_severity, "refused connect from %s", eval_client(&req));
if (req.sink)
((void (*)(int))req.sink)(req.fd);
// C++ sucks (the gibberish in front just translates the supplied
// sink function pointer in the req structure from a void (*sink)();
// to a void(*sink)(int) if you omit the cast, the C++ compiler
// will cry...
/*
C++ sucks (the gibberish in front just translates the supplied
sink function pointer in the req structure from a void (*sink)();
to a void(*sink)(int) if you omit the cast, the C++ compiler
will cry...
*/
(void) shutdown(new_sock,2); // This looks fine to me...
(void) closesocket(new_sock);
continue;
......@@ -2491,7 +2507,8 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
if (!(thd= new THD))
{
(void) shutdown(new_sock,2); VOID(closesocket(new_sock));
(void) shutdown(new_sock,2);
VOID(closesocket(new_sock));
continue;
}
if (!(vio_tmp=vio_new(new_sock,
......@@ -3158,7 +3175,7 @@ struct show_var_st status_vars[]= {
{"Com_drop_table", (char*) (com_stat+(uint) SQLCOM_DROP_TABLE),SHOW_LONG},
{"Com_flush", (char*) (com_stat+(uint) SQLCOM_FLUSH),SHOW_LONG},
{"Com_grant", (char*) (com_stat+(uint) SQLCOM_GRANT),SHOW_LONG},
{"Com_ha_close", (char*) (com_stat+(uint) SQLCOM_HA_OPEN),SHOW_LONG},
{"Com_ha_close", (char*) (com_stat+(uint) SQLCOM_HA_CLOSE),SHOW_LONG},
{"Com_ha_open", (char*) (com_stat+(uint) SQLCOM_HA_OPEN),SHOW_LONG},
{"Com_ha_read", (char*) (com_stat+(uint) SQLCOM_HA_READ),SHOW_LONG},
{"Com_insert", (char*) (com_stat+(uint) SQLCOM_INSERT),SHOW_LONG},
......@@ -3539,7 +3556,14 @@ static void get_options(int argc,char **argv)
int c,option_index=0;
myisam_delay_key_write=1; // Allow use of this
#ifndef HAVE_purify
my_use_symdir=1; // Use internal symbolic links
#else
/* Symlinks gives too many warnings with purify */
my_disable_symlinks=1;
my_use_symdir=0;
have_symlink=SHOW_OPTION_DISABLED;
#endif
optind = 0; // setup in case getopt() was called previously
while ((c=getopt_long(argc,argv,"ab:C:h:#::T::?l::L:O:P:sS::t:u:noVvWI?",
......@@ -4283,16 +4307,17 @@ static uint set_maximum_open_files(uint max_file_limit)
rlimit.rlim_cur=rlimit.rlim_max=max_file_limit;
if (setrlimit(RLIMIT_NOFILE,&rlimit))
{
sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %ld",
old_cur); /* purecov: inspected */
sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)",
old_cur, max_file_limit); /* purecov: inspected */
max_file_limit=old_cur;
}
else
{
(void) getrlimit(RLIMIT_NOFILE,&rlimit);
if ((uint) rlimit.rlim_cur != max_file_limit)
sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld",
(ulong) rlimit.rlim_cur); /* purecov: inspected */
sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)",
(ulong) rlimit.rlim_cur,
max_file_limit); /* purecov: inspected */
max_file_limit=rlimit.rlim_cur;
}
}
......
......@@ -766,9 +766,7 @@ int show_master_info(THD* thd)
net_store_data(packet, (longlong) glob_mi.pos);
last_log_seq = glob_mi.last_log_seq;
pthread_mutex_unlock(&glob_mi.lock);
pthread_mutex_lock(&LOCK_slave); // QQ; This is not needed
net_store_data(packet, slave_running ? "Yes":"No");
pthread_mutex_unlock(&LOCK_slave); // QQ; This is not needed
net_store_data(packet, &replicate_do_db);
net_store_data(packet, &replicate_ignore_db);
net_store_data(packet, (uint32)last_slave_errno);
......@@ -1099,6 +1097,8 @@ slave_begin:
THD *thd; // needs to be first for thread_stack
MYSQL *mysql = NULL ;
char llbuff[22];
bool retried_once = 0;
ulonglong last_failed_pos = 0;
pthread_mutex_lock(&LOCK_slave);
if (!server_id)
......@@ -1123,10 +1123,6 @@ slave_begin:
pthread_cond_broadcast(&COND_slave_start);
pthread_mutex_unlock(&LOCK_slave);
// int error = 1;
bool retried_once = 0;
ulonglong last_failed_pos = 0;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init();
slave_thd = thd = new THD; // note that contructor of THD uses DBUG_ !
......
......@@ -1951,11 +1951,35 @@ Query_cache::get_free_block(ulong len, my_bool not_less, ulong min)
if (bins[start].number != 0)
{
Query_cache_block *list = bins[start].free_blocks;
ulong max_len = list->prev->length;
if (list->prev->length >= len) // check block with max size
{
first = list;
while (first->next != list && first->length < len)
uint n = 0;
while ( n < QUERY_CACHE_MEM_BIN_TRY &&
first->length < len) //we don't need irst->next != list
{
first=first->next;
n++;
}
if (first->length >= len)
block=first;
else // we don't need if (first->next != list)
{
n = 0;
block = list->prev;
while (n < QUERY_CACHE_MEM_BIN_TRY &&
block->length > len)
{
block=block->prev;
n++;
}
if(block->length < len)
block=block->next;
}
}
else
first = list->prev;
}
if (block == 0 && start > 0)
{
......@@ -2117,18 +2141,30 @@ void Query_cache::insert_into_free_memory_list(Query_cache_block *free_block)
uint Query_cache::find_bin(ulong size)
{
int i;
DBUG_ENTER("Query_cache::find_bin");
// Begin small blocks to big (small blocks frequently asked)
for (i=mem_bin_steps - 1; i > 0 && steps[i-1].size < size; i--) ;
if (i == 0)
// Binary search
int left = 0, right = mem_bin_steps;
do
{
int middle = (left + right) / 2;
if (steps[middle].size > size)
left = middle+1;
else
right = middle;
} while (left < right);
if (left == 0)
{
// first bin not subordinate of common rules
DBUG_PRINT("qcache", ("first bin (# 0), size %lu",size));
DBUG_RETURN(0);
}
uint bin = steps[i].idx - (uint)((size - steps[i].size)/steps[i].increment);
DBUG_PRINT("qcache", ("bin %u step %u, size %lu", bin, i, size));
uint bin = steps[left].idx -
(uint)((size - steps[left].size)/steps[left].increment);
#ifndef DBUG_OFF
bins_dump();
#endif
DBUG_PRINT("qcache", ("bin %u step %u, size %lu step size %lu",
bin, left, size, steps[left].size));
DBUG_RETURN(bin);
}
......@@ -2480,6 +2516,9 @@ my_bool Query_cache::move_by_type(byte **border,
result_block = result_block->next;
} while ( result_block != first_result_block );
}
Query_cache_query *new_query= ((Query_cache_query *) new_block->data());
pthread_cond_init(&new_query->lock, NULL);
pthread_mutex_init(&new_query->clients_guard,MY_MUTEX_INIT_FAST);
NET *net = new_block->query()->writer();
if (net != 0)
{
......
......@@ -41,6 +41,10 @@
#define QUERY_CACHE_MEM_BIN_PARTS_MUL 1.2
#define QUERY_CACHE_MEM_BIN_SPC_LIM_PWR2 3
/* how many free blocks check when finding most suitable before other 'end'
of list of free blocks */
#define QUERY_CACHE_MEM_BIN_TRY 5
/* query flags masks */
#define QUERY_CACHE_CLIENT_LONG_FLAG_MASK 0x80
#define QUERY_CACHE_CHARSET_CONVERT_MASK 0x7F
......
......@@ -875,8 +875,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
thd->free_list=0;
table_list.name=table_list.real_name=thd->strdup(packet);
thd->query=fields=thd->strdup(strend(packet)+1);
thd->query_length=strlen(thd->query);
packet=strend(packet)+1;
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
break;
mysql_log.write(thd,command,"%s %s",table_list.real_name,fields);
remove_escape(table_list.real_name); // This can't have wildcards
......
......@@ -653,14 +653,14 @@ HANDLE_DECL(handle_stop_exec)
e->th=pthread_self();
if (!e->pid)
{
e->th=0;
/* e->th=0; */ /* th may be a struct */
pthread_mutex_unlock(&e->lock);
error="Process not running";
goto err;
}
if (mysql_shutdown(&e->mysql))
{
e->th=0;
/* e->th=0; */ /* th may be a struct */
pthread_mutex_unlock(&e->lock);
error="Could not send shutdown command";
goto err;
......@@ -669,7 +669,7 @@ HANDLE_DECL(handle_stop_exec)
pthread_cond_timedwait(&e->cond,&e->lock,&abstime);
if (e->pid)
error="Process failed to terminate within alotted time";
e->th=0;
/* e->th=0; */ /* th may be a struct */
pthread_mutex_unlock(&e->lock);
if (!error)
{
......@@ -1378,7 +1378,6 @@ static int run_server_loop()
pthread_t th;
struct manager_thd *thd;
int client_sock;
uint len;
Vio* vio;
pthread_attr_t thr_attr;
(void) pthread_attr_init(&thr_attr);
......@@ -1389,7 +1388,7 @@ static int run_server_loop()
for (;!shutdown_requested;)
{
len=sizeof(struct sockaddr_in);
size_socket len=sizeof(struct sockaddr_in);
if ((client_sock=accept(manager_sock,(struct sockaddr*)&manager_addr,
&len)) <0)
{
......
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