Commit 5f3c31c6 authored by unknown's avatar unknown

Removed mysql_ssl_clear()

Added statistics information for alarms (for bug tracking)
Don't store "incomplete" in the xxx.cfg file if we are not using --restart. (Crash-me)
Enlarged STACK_BUF_ALLOC becasue of failed crash-me test
Aded new script mysql_tableinfo to make a system directory.


Docs/manual.texi:
  Changelog and TODO
include/mysql.h:
  Removed mysql_ssl_clear() (One should use mysql_close() instead)
include/thr_alarm.h:
  Added info for alarms
libmysql/libmysql.c:
  Made mysql_ssl_clear() static
libmysql/libmysql.def:
  cleanup
libmysqld/libmysqld.def:
  cleanup
myisam/myisamchk.c:
  describe -> description
myisam/myisampack.c:
  Fixed copyright.
mysys/thr_alarm.c:
  Added statistics information for alarms (for bug tracking)
scripts/Makefile.am:
  Added mysql_table_info
sql-bench/crash-me.sh:
  Don't store "incomplete" in the xxx.cfg file if we are not using --restart.
  This was done becasue "incomplete" made it harder to quickly repeat a test that
  failed.
sql-bench/limits/mysql.cfg:
  Update to 1.58
sql/hostname.cc:
  Remved compiler warning
sql/item_func.cc:
  cleanup
sql/item_func.h:
  Cleanup
sql/mysql_priv.h:
  Enlarged STACK_BUF_ALLOC becasue of failed crash-me test
sql/opt_range.cc:
  Removed purify warning
sql/sql_parse.cc:
  cleanup
sql/sql_test.cc:
  Added ala
parent f6710380
...@@ -3951,10 +3951,6 @@ Automatic output from @code{mysql} to Netscape. ...@@ -3951,10 +3951,6 @@ Automatic output from @code{mysql} to Netscape.
@item @item
@code{LOCK DATABASES} (with various options.) @code{LOCK DATABASES} (with various options.)
@item @item
@code{DECIMAL} and @code{NUMERIC} types can't read exponential numbers;
@code{Field_decimal::store(const char *from,uint len)} must be recoded
to fix this.
@item
Functions: Functions:
ADD_TO_SET(value,set) and REMOVE_FROM_SET(value,set). ADD_TO_SET(value,set) and REMOVE_FROM_SET(value,set).
@item @item
...@@ -49368,6 +49364,9 @@ Emulation of @code{pthread_mutex()} for OS/2. ...@@ -49368,6 +49364,9 @@ Emulation of @code{pthread_mutex()} for OS/2.
@item Benjamin Pflugmann @item Benjamin Pflugmann
Extended @code{MERGE} tables to handle @code{INSERTS}. Active member Extended @code{MERGE} tables to handle @code{INSERTS}. Active member
on the MySQL mailing lists. on the MySQL mailing lists.
@item Guilhem Bichot
Fixed handling of exponents for @code{DECIMAL}.
Author of @code{mysql_tableinfo}.
@end table @end table
Other contributors, bugfinders, and testers: James H. Thompson, Maurizio Other contributors, bugfinders, and testers: James H. Thompson, Maurizio
...@@ -49496,6 +49495,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. ...@@ -49496,6 +49495,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet @itemize @bullet
@item @item
Removed @code{mysql_ssl_clear()}, as this was not needed.
@item
@code{DECIMAL} and @code{NUMERIC} types can now read exponential numbers.
@item
Fixed bug in @code{innodb_log_group_home_dir} in @code{SHOW VARIABLES}. Fixed bug in @code{innodb_log_group_home_dir} in @code{SHOW VARIABLES}.
@item @item
Fixed a bug in optimiser with merge tables when non-uniques values are Fixed a bug in optimiser with merge tables when non-uniques values are
...@@ -122,17 +122,17 @@ struct st_mysql_options { ...@@ -122,17 +122,17 @@ struct st_mysql_options {
my_bool use_ssl; /* if to use SSL or not */ my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe; my_bool compress,named_pipe;
/* /*
on connect, find out the replication role of the server, and On connect, find out the replication role of the server, and
establish connections to all the peers establish connections to all the peers
*/ */
my_bool rpl_probe; my_bool rpl_probe;
/* /*
each call to mysql_real_query() will parse it to tell if it is a read Each call to mysql_real_query() will parse it to tell if it is a read
or a write, and direct it to the slave or the master or a write, and direct it to the slave or the master
*/ */
my_bool rpl_parse; my_bool rpl_parse;
/* /*
if set, never read from a master,only from slave, when doing If set, never read from a master,only from slave, when doing
a read that is replication-aware a read that is replication-aware
*/ */
my_bool no_master_reads; my_bool no_master_reads;
...@@ -185,8 +185,10 @@ typedef struct st_mysql { ...@@ -185,8 +185,10 @@ typedef struct st_mysql {
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave() added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/ */
my_bool rpl_pivot; my_bool rpl_pivot;
/* pointers to the master, and the next slave /*
connections, points to itself if lone connection */ Pointers to the master, and the next slave connections, points to
itself if lone connection.
*/
struct st_mysql* master, *next_slave; struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */ struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
...@@ -234,21 +236,27 @@ typedef struct st_mysql_manager ...@@ -234,21 +236,27 @@ typedef struct st_mysql_manager
char last_error[MAX_MYSQL_MANAGER_ERR]; char last_error[MAX_MYSQL_MANAGER_ERR];
} MYSQL_MANAGER; } MYSQL_MANAGER;
/* Set up and bring down the server; to ensure that applications will /*
* work when linked against either the standard client library or the Set up and bring down the server; to ensure that applications will
* embedded server library, these functions should be called. */ work when linked against either the standard client library or the
embedded server library, these functions should be called.
*/
int STDCALL mysql_server_init(int argc, char **argv, char **groups); int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void); void STDCALL mysql_server_end(void);
/* Set up and bring down a thread; these function should be called /*
* for each thread in an application which opens at least one MySQL Set up and bring down a thread; these function should be called
* connection. All uses of the connection(s) should be between these for each thread in an application which opens at least one MySQL
* function calls. */ connection. All uses of the connection(s) should be between these
function calls.
*/
my_bool STDCALL mysql_thread_init(void); my_bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void); void STDCALL mysql_thread_end(void);
/* Functions to get information from the MYSQL and MYSQL_RES structures */ /*
/* Should definitely be used if one uses shared libraries */ Functions to get information from the MYSQL and MYSQL_RES structures
Should definitely be used if one uses shared libraries.
*/
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
...@@ -272,7 +280,6 @@ MYSQL * STDCALL mysql_init(MYSQL *mysql); ...@@ -272,7 +280,6 @@ MYSQL * STDCALL mysql_init(MYSQL *mysql);
int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *cert, const char *ca,
const char *capath, const char *cipher); const char *capath, const char *cipher);
int STDCALL mysql_ssl_clear(MYSQL *mysql);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db); const char *passwd, const char *db);
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
......
...@@ -38,6 +38,15 @@ extern "C" { ...@@ -38,6 +38,15 @@ extern "C" {
#define THR_SERVER_ALARM SIGALRM #define THR_SERVER_ALARM SIGALRM
#endif #endif
typedef struct st_alarm_info
{
ulong next_alarm_time;
uint active_alarms;
uint max_used_alarms;
} ALARM_INFO;
void thr_alarm_info(ALARM_INFO *info);
#if defined(DONT_USE_THR_ALARM) || !defined(THREAD) #if defined(DONT_USE_THR_ALARM) || !defined(THREAD)
#define USE_ALARM_THREAD #define USE_ALARM_THREAD
......
...@@ -1448,8 +1448,8 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , ...@@ -1448,8 +1448,8 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
NB! Errors are not reported until you do mysql_real_connect. NB! Errors are not reported until you do mysql_real_connect.
**************************************************************************/ **************************************************************************/
int STDCALL static int
mysql_ssl_clear(MYSQL *mysql __attribute__((unused))) mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
{ {
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
...@@ -2051,7 +2051,7 @@ mysql_close(MYSQL *mysql) ...@@ -2051,7 +2051,7 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
mysql_ssl_clear(mysql); mysql_ssl_free(mysql);
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
/* Clear pointers for better safety */ /* Clear pointers for better safety */
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0; mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
......
...@@ -90,7 +90,7 @@ EXPORTS ...@@ -90,7 +90,7 @@ EXPORTS
mysql_real_escape_string mysql_real_escape_string
mysql_ssl_set mysql_ssl_set
mysql_ssl_clear mysql_ssl_clear
mysql_real_connect mysql_real_connect
mysql_master_query mysql_master_query
mysql_master_send_query mysql_master_send_query
mysql_slave_query mysql_slave_query
......
...@@ -63,10 +63,3 @@ EXPORTS ...@@ -63,10 +63,3 @@ EXPORTS
mysql_refresh mysql_refresh
mysql_odbc_escape_string mysql_odbc_escape_string
myodbc_remove_escape myodbc_remove_escape
...@@ -241,7 +241,7 @@ static struct my_option my_long_options[] = ...@@ -241,7 +241,7 @@ static struct my_option my_long_options[] =
{"unpack", 'u', "Unpack file packed with myisampack.", 0, 0, 0, GET_NO_ARG, {"unpack", 'u', "Unpack file packed with myisampack.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', {"verbose", 'v',
"Print more information. This can be used with --describe and --check. Use many -v for more verbosity!", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, "Print more information. This can be used with --description and --check. Use many -v for more verbosity!", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
0}, 0},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0}, 0, 0, 0, 0, 0},
...@@ -312,7 +312,7 @@ static void usage(void) ...@@ -312,7 +312,7 @@ static void usage(void)
-s, --silent Only print errors. One can use two -s to make\n\ -s, --silent Only print errors. One can use two -s to make\n\
myisamchk very silent\n\ myisamchk very silent\n\
-v, --verbose Print more information. This can be used with\n\ -v, --verbose Print more information. This can be used with\n\
--describe and --check. Use many -v for more verbosity!\n\ --description and --check. Use many -v for more verbosity!\n\
-V, --version Print version and exit.\n\ -V, --version Print version and exit.\n\
-w, --wait Wait if table is locked.\n"); -w, --wait Wait if table is locked.\n");
...@@ -365,7 +365,7 @@ static void usage(void) ...@@ -365,7 +365,7 @@ static void usage(void)
puts("Other actions:\n\ puts("Other actions:\n\
-a, --analyze Analyze distribution of keys. Will make some joins in\n\ -a, --analyze Analyze distribution of keys. Will make some joins in\n\
MySQL faster. You can check the calculated distribution\n\ MySQL faster. You can check the calculated distribution\n\
by using '--describe --verbose table_name'.\n\ by using '--description --verbose table_name'.\n\
-d, --description Prints some information about table.\n\ -d, --description Prints some information about table.\n\
-A, --set-auto-increment[=value]\n\ -A, --set-auto-increment[=value]\n\
Force auto_increment to start at this or higher value\n\ Force auto_increment to start at this or higher value\n\
......
...@@ -275,7 +275,7 @@ static void print_version(void) ...@@ -275,7 +275,7 @@ static void print_version(void)
static void usage(void) static void usage(void)
{ {
print_version(); print_version();
puts("Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB"); puts("Copyright (C) 2002 MySQL AB");
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,");
puts("and you are welcome to modify and redistribute it under the GPL license\n"); puts("and you are welcome to modify and redistribute it under the GPL license\n");
......
...@@ -44,6 +44,7 @@ my_bool thr_alarm_inited=0; ...@@ -44,6 +44,7 @@ my_bool thr_alarm_inited=0;
static pthread_mutex_t LOCK_alarm; static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set; static sigset_t full_signal_set;
static QUEUE alarm_queue; static QUEUE alarm_queue;
static uint max_used_alarms=0;
pthread_t alarm_thread; pthread_t alarm_thread;
#ifdef USE_ALARM_THREAD #ifdef USE_ALARM_THREAD
...@@ -116,10 +117,10 @@ void init_thr_alarm(uint max_alarms) ...@@ -116,10 +117,10 @@ void init_thr_alarm(uint max_alarms)
} }
/* /*
** Request alarm after sec seconds. Request alarm after sec seconds.
** A pointer is returned with points to a non-zero int when the alarm has been A pointer is returned with points to a non-zero int when the alarm has been
** given. This can't be called from the alarm-handling thread. given. This can't be called from the alarm-handling thread.
** Returns 0 if no more alarms are allowed (aborted by process) Returns 0 if no more alarms are allowed (aborted by process)
*/ */
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
...@@ -140,13 +141,17 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) ...@@ -140,13 +141,17 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
pthread_sigmask(SIG_SETMASK,&old_mask,NULL); pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (alarm_queue.elements == alarm_queue.max_elements) if (alarm_queue.elements >= max_used_alarms)
{ {
DBUG_PRINT("info", ("alarm queue full")); if (alarm_queue.elements == alarm_queue.max_elements)
fprintf(stderr,"Warning: thr_alarm queue is full\n"); {
pthread_mutex_unlock(&LOCK_alarm); DBUG_PRINT("info", ("alarm queue full"));
pthread_sigmask(SIG_SETMASK,&old_mask,NULL); fprintf(stderr,"Warning: thr_alarm queue is full\n");
DBUG_RETURN(1); pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1);
}
max_used_alarms=alarm_queue.elements+1;
} }
reschedule= (!alarm_queue.elements || reschedule= (!alarm_queue.elements ||
(int) (((ALARM*) queue_top(&alarm_queue))->expire_time - now) > (int) (((ALARM*) queue_top(&alarm_queue))->expire_time - now) >
...@@ -186,7 +191,7 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) ...@@ -186,7 +191,7 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
/* /*
** Remove alarm from list of alarms Remove alarm from list of alarms
*/ */
void thr_end_alarm(thr_alarm_t *alarmed) void thr_end_alarm(thr_alarm_t *alarmed)
...@@ -227,13 +232,13 @@ void thr_end_alarm(thr_alarm_t *alarmed) ...@@ -227,13 +232,13 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/* /*
Come here when some alarm in queue is due. Come here when some alarm in queue is due.
Mark all alarms with are finnished in list. Mark all alarms with are finnished in list.
Shedule alarms to be sent again after 1-10 sec (many alarms at once) Shedule alarms to be sent again after 1-10 sec (many alarms at once)
If alarm_aborted is set then all alarms are given and resent If alarm_aborted is set then all alarms are given and resent
every second. every second.
*/ */
sig_handler process_alarm(int sig __attribute__((unused))) sig_handler process_alarm(int sig __attribute__((unused)))
{ {
...@@ -334,8 +339,8 @@ sig_handler process_alarm(int sig __attribute__((unused))) ...@@ -334,8 +339,8 @@ sig_handler process_alarm(int sig __attribute__((unused)))
/* /*
** Shedule all alarms now. Shedule all alarms now.
** When all alarms are given, Free alarm memory and don't allow more alarms. When all alarms are given, Free alarm memory and don't allow more alarms.
*/ */
void end_thr_alarm(void) void end_thr_alarm(void)
...@@ -359,7 +364,7 @@ void end_thr_alarm(void) ...@@ -359,7 +364,7 @@ void end_thr_alarm(void)
/* /*
** Remove another thread from the alarm Remove another thread from the alarm
*/ */
void thr_alarm_kill(pthread_t thread_id) void thr_alarm_kill(pthread_t thread_id)
...@@ -382,9 +387,25 @@ void thr_alarm_kill(pthread_t thread_id) ...@@ -382,9 +387,25 @@ void thr_alarm_kill(pthread_t thread_id)
} }
void thr_alarm_info(ALARM_INFO *info)
{
pthread_mutex_lock(&LOCK_alarm);
info->next_alarm_time= 0;
info->max_used_alarms= max_used_alarms;
if ((info->active_alarms= alarm_queue.elements))
{
ulong now=(ulong) time((time_t*) 0);
long time_diff;
ALARM *alarm_data= (ALARM*) queue_top(&alarm_queue);
time_diff= (long) (alarm_data->expire_time - now);
info->next_alarm_time= (ulong) (time_diff < 0 ? 0 : time_diff);
}
pthread_mutex_unlock(&LOCK_alarm);
}
/* /*
** This is here for thread to get interruptet from read/write/fcntl This is here for thread to get interruptet from read/write/fcntl
** ARGSUSED ARGSUSED
*/ */
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
...@@ -459,7 +480,7 @@ static void *alarm_handler(void *arg __attribute__((unused))) ...@@ -459,7 +480,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
#endif /* USE_ALARM_THREAD */ #endif /* USE_ALARM_THREAD */
/***************************************************************************** /*****************************************************************************
** thr_alarm for OS/2 thr_alarm for OS/2
*****************************************************************************/ *****************************************************************************/
#elif defined(__EMX__) || defined(OS2) #elif defined(__EMX__) || defined(OS2)
...@@ -490,7 +511,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) ...@@ -490,7 +511,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
/* /*
** Remove another thread from the alarm Remove another thread from the alarm
*/ */
void thr_alarm_kill(pthread_t thread_id) void thr_alarm_kill(pthread_t thread_id)
...@@ -588,8 +609,14 @@ void init_thr_alarm(uint max_alarm) ...@@ -588,8 +609,14 @@ void init_thr_alarm(uint max_alarm)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void thr_alarm_info(ALARM_INFO *info)
{
bzero((char*) info, sizeof(*info));
}
/***************************************************************************** /*****************************************************************************
** thr_alarm for win95 thr_alarm for win95
*****************************************************************************/ *****************************************************************************/
#else /* __WIN__ */ #else /* __WIN__ */
...@@ -661,13 +688,18 @@ void init_thr_alarm(uint max_alarm) ...@@ -661,13 +688,18 @@ void init_thr_alarm(uint max_alarm)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void thr_alarm_info(ALARM_INFO *info)
{
bzero((char*) info, sizeof(*info));
}
#endif /* __WIN__ */ #endif /* __WIN__ */
#endif /* THREAD */ #endif /* THREAD */
/**************************************************************************** /****************************************************************************
** Handling of MAIN Handling of test case (when compiled with -DMAIN)
***************************************************************************/ ***************************************************************************/
#ifdef MAIN #ifdef MAIN
...@@ -867,6 +899,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) ...@@ -867,6 +899,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
pthread_attr_t thr_attr; pthread_attr_t thr_attr;
int i,*param,error; int i,*param,error;
sigset_t set; sigset_t set;
ALARM_INFO alarm_info;
MY_INIT(argv[0]); MY_INIT(argv[0]);
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#') if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#')
...@@ -927,6 +960,10 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) ...@@ -927,6 +960,10 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
pthread_attr_destroy(&thr_attr); pthread_attr_destroy(&thr_attr);
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
thr_alarm_info(&alarm_info);
printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n",
alarm_info.active_alarms, alarm_info.max_used_alarms,
alarm_info.next_alarm_time);
while (thread_count) while (thread_count)
{ {
VOID(pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)); VOID(pthread_cond_wait(&COND_thread_count,&LOCK_thread_count));
...@@ -937,6 +974,10 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) ...@@ -937,6 +974,10 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
} }
} }
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
thr_alarm_info(&alarm_info);
printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n",
alarm_info.active_alarms, alarm_info.max_used_alarms,
alarm_info.next_alarm_time);
printf("Test succeeded\n"); printf("Test succeeded\n");
return 0; return 0;
} }
......
...@@ -31,6 +31,7 @@ bin_SCRIPTS = @server_scripts@ \ ...@@ -31,6 +31,7 @@ bin_SCRIPTS = @server_scripts@ \
mysqlhotcopy \ mysqlhotcopy \
mysqldumpslow \ mysqldumpslow \
mysql_explain_log \ mysql_explain_log \
mysql_tableinfo \
mysqld_multi mysqld_multi
EXTRA_SCRIPTS = make_binary_distribution.sh \ EXTRA_SCRIPTS = make_binary_distribution.sh \
...@@ -50,6 +51,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ ...@@ -50,6 +51,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysqldumpslow.sh \ mysqldumpslow.sh \
mysql_explain_log.sh \ mysql_explain_log.sh \
mysqld_multi.sh \ mysqld_multi.sh \
mysql_tableinfo.sh \
mysqld_safe.sh mysqld_safe.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \ EXTRA_DIST = $(EXTRA_SCRIPTS) \
......
This diff is collapsed.
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
# as such, and clarify ones such as "mediumint" with comments such as # as such, and clarify ones such as "mediumint" with comments such as
# "3-byte int" or "same as xxx". # "3-byte int" or "same as xxx".
$version="1.57"; $version="1.58";
use DBI; use DBI;
use Getopt::Long; use Getopt::Long;
...@@ -2186,20 +2186,20 @@ EOF ...@@ -2186,20 +2186,20 @@ EOF
print <<EOF; print <<EOF;
Some of the tests you are about to execute may require a lot of Some of the tests you are about to execute may require a lot of
memory. Your tests WILL adversely affect system performance. It's memory. Your tests WILL adversely affect system performance. It\'s
not uncommon that either this crash-me test program, or the actual not uncommon that either this crash-me test program, or the actual
database back-end, will DIE with an out-of-memory error. So might database back-end, will DIE with an out-of-memory error. So might
any other program on your system if it requests more memory at the any other program on your system if it requests more memory at the
wrong time. wrong time.
Note also that while crash-me tries to find limits for the database server Note also that while crash-me tries to find limits for the database server
it will make a lot of queries that can't be categorized as 'normal'. It's it will make a lot of queries that can\'t be categorized as \'normal\'. It\'s
not unlikely that crash-me finds some limit bug in your server so if you not unlikely that crash-me finds some limit bug in your server so if you
run this test you have to be prepared that your server may die during it! run this test you have to be prepared that your server may die during it!
We, the creators of this utility, are not responsible in any way if your We, the creators of this utility, are not responsible in any way if your
database server unexpectedly crashes while this program tries to find the database server unexpectedly crashes while this program tries to find the
limitations of your server. By accepting the following question with 'yes', limitations of your server. By accepting the following question with \'yes\',
you agree to the above! you agree to the above!
You have been warned! You have been warned!
...@@ -2468,7 +2468,6 @@ sub report ...@@ -2468,7 +2468,6 @@ sub report
print "$prompt: "; print "$prompt: ";
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt);
save_config_data($limit,safe_query(\@queries) ? "yes" : "no",$prompt); save_config_data($limit,safe_query(\@queries) ? "yes" : "no",$prompt);
} }
print "$limits{$limit}\n"; print "$limits{$limit}\n";
...@@ -2481,7 +2480,6 @@ sub report_fail ...@@ -2481,7 +2480,6 @@ sub report_fail
print "$prompt: "; print "$prompt: ";
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt);
save_config_data($limit,safe_query(\@queries) ? "no" : "yes",$prompt); save_config_data($limit,safe_query(\@queries) ? "no" : "yes",$prompt);
} }
print "$limits{$limit}\n"; print "$limits{$limit}\n";
...@@ -2498,7 +2496,7 @@ sub report_one ...@@ -2498,7 +2496,7 @@ sub report_one
print "$prompt: "; print "$prompt: ";
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt); save_incomplete($limit,$prompt);
$result="no"; $result="no";
foreach $query (@$queries) foreach $query (@$queries)
{ {
...@@ -2524,7 +2522,7 @@ sub report_result ...@@ -2524,7 +2522,7 @@ sub report_result
print "$prompt: "; print "$prompt: ";
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt); save_incomplete($limit,$prompt);
$error=safe_query_result($query,"1",2); $error=safe_query_result($query,"1",2);
save_config_data($limit,$error ? "not supported" : $last_result,$prompt); save_config_data($limit,$error ? "not supported" : $last_result,$prompt);
} }
...@@ -2537,7 +2535,7 @@ sub report_trans ...@@ -2537,7 +2535,7 @@ sub report_trans
my ($limit,$queries,$check,$clear)=@_; my ($limit,$queries,$check,$clear)=@_;
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt); save_incomplete($limit,$prompt);
eval {undef($dbh->{AutoCommit})}; eval {undef($dbh->{AutoCommit})};
if (!$@) if (!$@)
{ {
...@@ -2579,7 +2577,7 @@ sub check_and_report ...@@ -2579,7 +2577,7 @@ sub check_and_report
print "$prompt: " if (!defined($skip_prompt)); print "$prompt: " if (!defined($skip_prompt));
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt); save_incomplete($limit,$prompt);
$tmp=1-safe_query(\@$pre); $tmp=1-safe_query(\@$pre);
$tmp=safe_query_result($query,$answer,$string_type) if (!$tmp); $tmp=safe_query_result($query,$answer,$string_type) if (!$tmp);
safe_query(\@$post); safe_query(\@$post);
...@@ -2615,7 +2613,7 @@ sub try_and_report ...@@ -2615,7 +2613,7 @@ sub try_and_report
if (!defined($limits{$limit})) if (!defined($limits{$limit}))
{ {
save_config_data($limit,"incompleted",$prompt); save_incomplete($limit,$prompt);
$type="no"; # Not supported $type="no"; # Not supported
foreach $test (@tests) foreach $test (@tests)
{ {
...@@ -2695,7 +2693,8 @@ sub safe_query_result ...@@ -2695,7 +2693,8 @@ sub safe_query_result
$sth->finish; $sth->finish;
return ($result_type == 8) ? 0 : 1; return ($result_type == 8) ? 0 : 1;
} }
if($result_type == 8) { if ($result_type == 8)
{
$sth->finish; $sth->finish;
return 1; return 1;
} }
...@@ -2787,7 +2786,7 @@ sub find_limit() ...@@ -2787,7 +2786,7 @@ sub find_limit()
print "$end (cache)\n"; print "$end (cache)\n";
return $end; return $end;
} }
save_config_data($limit,"incompleted",$prompt); save_incomplete($limit,$prompt);
if (defined($query->{'init'}) && !defined($end=$limits{'restart'}{'tohigh'})) if (defined($query->{'init'}) && !defined($end=$limits{'restart'}{'tohigh'}))
{ {
...@@ -2961,6 +2960,16 @@ sub save_all_config_data ...@@ -2961,6 +2960,16 @@ sub save_all_config_data
close CONFIG_FILE; close CONFIG_FILE;
} }
#
# Save 'incomplete' in the limits file to be able to continue if
# crash-me dies because of a bug in perl/DBI
sub save_incomplete
{
my ($limit,$prompt)= @_;
save_config_data($limit,"incompleted",$prompt) if ($opt_restart);
}
sub check_repeat sub check_repeat
{ {
......
#This file is automaticly generated by crash-me 1.57 #This file is automaticly generated by crash-me 1.58
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
...@@ -36,7 +36,7 @@ constraint_check=no # Column constraints ...@@ -36,7 +36,7 @@ constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=yes # crash me safe crash_me_safe=yes # crash me safe
crash_me_version=1.57 # crash me version crash_me_version=1.58 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
...@@ -333,7 +333,7 @@ max_char_size=255 # max char() size ...@@ -333,7 +333,7 @@ max_char_size=255 # max char() size
max_column_name=64 # column name length max_column_name=64 # column name length
max_columns=3398 # Columns in table max_columns=3398 # Columns in table
max_conditions=85660 # OR and AND in WHERE max_conditions=85660 # OR and AND in WHERE
max_expressions=856 # simple expressions max_expressions=686 # simple expressions
max_index=32 # max index max_index=32 # max index
max_index_length=500 # index length max_index_length=500 # index length
max_index_name=64 # index name length max_index_name=64 # index name length
...@@ -343,7 +343,7 @@ max_index_varchar_part_length=255 # index varchar part length ...@@ -343,7 +343,7 @@ max_index_varchar_part_length=255 # index varchar part length
max_row_length=65534 # max table row length (without blobs) max_row_length=65534 # max table row length (without blobs)
max_row_length_with_null=65502 # table row length with nulls (without blobs) max_row_length_with_null=65502 # table row length with nulls (without blobs)
max_select_alias_name=+512 # select alias name length max_select_alias_name=+512 # select alias name length
max_stack_expression=856 # stacked expressions max_stack_expression=490 # stacked expressions
max_table_alias_name=+512 # table alias name length max_table_alias_name=+512 # table alias name length
max_table_name=64 # table name length max_table_name=64 # table name length
max_text_size=1048543 # max text or blob size max_text_size=1048543 # max text or blob size
...@@ -396,7 +396,7 @@ select_limit2=yes # SELECT with LIMIT #,# ...@@ -396,7 +396,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM select_without_from=yes # SELECT without FROM
server_version=MySQL 4.0.2 alpha debug # server version server_version=MySQL 4.0.2 alpha # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values storage_of_float=round # Storage of float values
subqueries=no # subqueries subqueries=no # subqueries
......
...@@ -57,8 +57,8 @@ void hostname_cache_refresh() ...@@ -57,8 +57,8 @@ void hostname_cache_refresh()
bool hostname_cache_init() bool hostname_cache_init()
{ {
host_entry *tmp; host_entry tmp;
uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp); uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp);
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
......
...@@ -2047,13 +2047,14 @@ longlong Item_func_inet_aton::val_int() ...@@ -2047,13 +2047,14 @@ longlong Item_func_inet_aton::val_int()
return 0; return 0;
} }
void Item_func_match::init_search(bool no_order) void Item_func_match::init_search(bool no_order)
{ {
if (ft_handler) if (ft_handler)
return; return;
if (key == NO_SUCH_KEY) if (key == NO_SUCH_KEY)
concat=new Item_func_concat_ws (new Item_string(" ",1), fields); concat= new Item_func_concat_ws(new Item_string(" ",1), fields);
if (master) if (master)
{ {
...@@ -2071,7 +2072,7 @@ void Item_func_match::init_search(bool no_order) ...@@ -2071,7 +2072,7 @@ void Item_func_match::init_search(bool no_order)
// MATCH ... AGAINST (NULL) is meaningless, but possible // MATCH ... AGAINST (NULL) is meaningless, but possible
if (!(ft_tmp=key_item()->val_str(&tmp2))) if (!(ft_tmp=key_item()->val_str(&tmp2)))
{ {
ft_tmp=&tmp2; ft_tmp= &tmp2;
tmp2.set("",0); tmp2.set("",0);
} }
...@@ -2087,6 +2088,7 @@ void Item_func_match::init_search(bool no_order) ...@@ -2087,6 +2088,7 @@ void Item_func_match::init_search(bool no_order)
} }
} }
bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
{ {
List_iterator<Item> li(fields); List_iterator<Item> li(fields);
......
...@@ -171,9 +171,22 @@ class Item_num_op :public Item_func ...@@ -171,9 +171,22 @@ class Item_num_op :public Item_func
bool is_null() { (void) val(); return null_value; } bool is_null() { (void) val(); return null_value; }
Field *tmp_table_field(TABLE *t_arg) Field *tmp_table_field(TABLE *t_arg)
{ {
if (!t_arg) return result_field; Field *res;
return args[0]->result_type() == INT_RESULT ? ((max_length > 11) ? (Field *)new Field_longlong(max_length,maybe_null,name, t_arg,unsigned_flag) : (Field *)new Field_long(max_length,maybe_null,name, t_arg,unsigned_flag)) : (Field *) new Field_double(max_length, maybe_null, name,t_arg,decimals); if (!t_arg)
} return result_field;
if (args[0]->result_type() == INT_RESULT)
{
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,
unsigned_flag);
else
res= new Field_long(max_length, maybe_null, name, t_arg,
unsigned_flag);
}
else
res= new Field_double(max_length, maybe_null, name, t_arg, decimals);
return res;
}
}; };
......
...@@ -75,7 +75,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); ...@@ -75,7 +75,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define MAX_FIELDS_BEFORE_HASH 32 #define MAX_FIELDS_BEFORE_HASH 32
#define USER_VARS_HASH_SIZE 16 #define USER_VARS_HASH_SIZE 16
#define STACK_MIN_SIZE 8192 // Abort if less stack during eval. #define STACK_MIN_SIZE 8192 // Abort if less stack during eval.
#define STACK_BUFF_ALLOC 32 // For stack overrun checks #define STACK_BUFF_ALLOC 64 // For stack overrun checks
#ifndef MYSQLD_NET_RETRY_COUNT #ifndef MYSQLD_NET_RETRY_COUNT
#define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int. #define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int.
#endif #endif
......
...@@ -67,7 +67,9 @@ class SEL_ARG :public Sql_alloc ...@@ -67,7 +67,9 @@ class SEL_ARG :public Sql_alloc
SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value, SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value,
uint8 min_flag, uint8 max_flag, uint8 maybe_flag); uint8 min_flag, uint8 max_flag, uint8 maybe_flag);
SEL_ARG(enum Type type_arg) SEL_ARG(enum Type type_arg)
:elements(1),use_count(1),left(0),next_key_part(0),type(type_arg) {} :elements(1),use_count(1),left(0),next_key_part(0),color(BLACK),
type(type_arg)
{}
inline bool is_same(SEL_ARG *arg) inline bool is_same(SEL_ARG *arg)
{ {
if (type != arg->type) if (type != arg->type)
......
...@@ -345,13 +345,12 @@ char uc_update_queries[SQLCOM_END]; ...@@ -345,13 +345,12 @@ char uc_update_queries[SQLCOM_END];
static bool check_mqh(THD *thd, uint check_command) static bool check_mqh(THD *thd, uint check_command)
{ {
bool error=0; bool error=0;
DBUG_ENTER("check_mqh"); time_t check_time = thd->start_time ? thd->start_time : time(NULL);
USER_CONN *uc=thd->user_connect; USER_CONN *uc=thd->user_connect;
DBUG_ENTER("check_mqh");
DBUG_ASSERT(uc != 0); DBUG_ASSERT(uc != 0);
bool my_start = thd->start_time != 0; /* If more than a hour since last check, reset resource checking */
time_t check_time = (my_start) ? thd->start_time : time(NULL);
if (check_time - uc->intime >= 3600) if (check_time - uc->intime >= 3600)
{ {
(void) pthread_mutex_lock(&LOCK_user_conn); (void) pthread_mutex_lock(&LOCK_user_conn);
...@@ -361,6 +360,7 @@ static bool check_mqh(THD *thd, uint check_command) ...@@ -361,6 +360,7 @@ static bool check_mqh(THD *thd, uint check_command)
uc->intime=check_time; uc->intime=check_time;
(void) pthread_mutex_unlock(&LOCK_user_conn); (void) pthread_mutex_unlock(&LOCK_user_conn);
} }
/* Check that we have not done too many questions / hour */
if (uc->user_resources.questions && if (uc->user_resources.questions &&
uc->questions++ >= uc->user_resources.questions) uc->questions++ >= uc->user_resources.questions)
{ {
...@@ -371,14 +371,15 @@ static bool check_mqh(THD *thd, uint check_command) ...@@ -371,14 +371,15 @@ static bool check_mqh(THD *thd, uint check_command)
} }
if (check_command < (uint) SQLCOM_END) if (check_command < (uint) SQLCOM_END)
{ {
if (uc->user_resources.updates && uc_update_queries[check_command] && /* Check that we have not done too many updates / hour */
++(uc->updates) > uc->user_resources.updates) if (uc->user_resources.updates && uc_update_queries[check_command] &&
{ uc->updates++ >= uc->user_resources.updates)
net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_updates", {
(long) uc->user_resources.updates); net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_updates",
error=1; (long) uc->user_resources.updates);
goto end; error=1;
} goto end;
}
} }
end: end:
DBUG_RETURN(error); DBUG_RETURN(error);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_select.h" #include "sql_select.h"
#include <hash.h> #include <hash.h>
#include <thr_alarm.h>
/* Intern key cache variables */ /* Intern key cache variables */
extern "C" pthread_mutex_t THR_LOCK_keycache; extern "C" pthread_mutex_t THR_LOCK_keycache;
...@@ -239,6 +240,17 @@ Open streams: %10lu\n", ...@@ -239,6 +240,17 @@ Open streams: %10lu\n",
(ulong) cached_tables(), (ulong) cached_tables(),
(ulong) my_file_opened, (ulong) my_file_opened,
(ulong) my_stream_opened); (ulong) my_stream_opened);
ALARM_INFO alarm_info;
thr_alarm_info(&alarm_info);
printf("\nAlarm status:\n\
Active alarms: %u\n\
Max used alarms: %u\n\
Next alarm time: %lu\n",
alarm_info.active_alarms,
alarm_info.max_used_alarms,
alarm_info.next_alarm_time);
fflush(stdout); fflush(stdout);
if (thd) if (thd)
thd->proc_info="malloc"; thd->proc_info="malloc";
......
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