Commit 8a2daeac authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

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.
parent 12f9623b
......@@ -3951,10 +3951,6 @@ Automatic output from @code{mysql} to Netscape.
@item
@code{LOCK DATABASES} (with various options.)
@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:
ADD_TO_SET(value,set) and REMOVE_FROM_SET(value,set).
@item
......@@ -49368,6 +49364,9 @@ Emulation of @code{pthread_mutex()} for OS/2.
@item Benjamin Pflugmann
Extended @code{MERGE} tables to handle @code{INSERTS}. Active member
on the MySQL mailing lists.
@item Guilhem Bichot
Fixed handling of exponents for @code{DECIMAL}.
Author of @code{mysql_tableinfo}.
@end table
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}.
@itemize @bullet
@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}.
@item
Fixed a bug in optimiser with merge tables when non-uniques values are
......@@ -122,17 +122,17 @@ struct st_mysql_options {
my_bool use_ssl; /* if to use SSL or not */
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
*/
my_bool rpl_probe;
/*
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
/*
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
*/
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
*/
my_bool no_master_reads;
......@@ -185,8 +185,10 @@ typedef struct st_mysql {
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
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* last_used_slave; /* needed for round-robin slave pick */
......@@ -234,21 +236,27 @@ typedef struct st_mysql_manager
char last_error[MAX_MYSQL_MANAGER_ERR];
} 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
* embedded server library, these functions should be called. */
/*
Set up and bring down the server; to ensure that applications will
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);
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
* connection. All uses of the connection(s) should be between these
* function calls. */
/*
Set up and bring down a thread; these function should be called
for each thread in an application which opens at least one MySQL
connection. All uses of the connection(s) should be between these
function calls.
*/
my_bool STDCALL mysql_thread_init(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);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
......@@ -272,7 +280,6 @@ MYSQL * STDCALL mysql_init(MYSQL *mysql);
int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
int STDCALL mysql_ssl_clear(MYSQL *mysql);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db);
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
......
......@@ -38,6 +38,15 @@ extern "C" {
#define THR_SERVER_ALARM SIGALRM
#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)
#define USE_ALARM_THREAD
......
......@@ -1448,8 +1448,8 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
NB! Errors are not reported until you do mysql_real_connect.
**************************************************************************/
int STDCALL
mysql_ssl_clear(MYSQL *mysql __attribute__((unused)))
static int
mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
{
#ifdef HAVE_OPENSSL
my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
......@@ -2051,7 +2051,7 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
#ifdef HAVE_OPENSSL
mysql_ssl_clear(mysql);
mysql_ssl_free(mysql);
#endif /* HAVE_OPENSSL */
/* Clear pointers for better safety */
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
......
......@@ -90,7 +90,7 @@ EXPORTS
mysql_real_escape_string
mysql_ssl_set
mysql_ssl_clear
mysql_real_connect
mysql_real_connect
mysql_master_query
mysql_master_send_query
mysql_slave_query
......
......@@ -63,10 +63,3 @@ EXPORTS
mysql_refresh
mysql_odbc_escape_string
myodbc_remove_escape
......@@ -241,7 +241,7 @@ static struct my_option my_long_options[] =
{"unpack", 'u', "Unpack file packed with myisampack.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"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},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
......@@ -312,7 +312,7 @@ static void usage(void)
-s, --silent Only print errors. One can use two -s to make\n\
myisamchk very silent\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\
-w, --wait Wait if table is locked.\n");
......@@ -365,7 +365,7 @@ static void usage(void)
puts("Other actions:\n\
-a, --analyze Analyze distribution of keys. Will make some joins in\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\
-A, --set-auto-increment[=value]\n\
Force auto_increment to start at this or higher value\n\
......
......@@ -275,7 +275,7 @@ static void print_version(void)
static void usage(void)
{
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("and you are welcome to modify and redistribute it under the GPL license\n");
......
......@@ -44,6 +44,7 @@ my_bool thr_alarm_inited=0;
static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set;
static QUEUE alarm_queue;
static uint max_used_alarms=0;
pthread_t alarm_thread;
#ifdef USE_ALARM_THREAD
......@@ -116,10 +117,10 @@ void init_thr_alarm(uint max_alarms)
}
/*
** Request alarm after sec seconds.
** 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.
** Returns 0 if no more alarms are allowed (aborted by process)
Request alarm after sec seconds.
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.
Returns 0 if no more alarms are allowed (aborted by process)
*/
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);
DBUG_RETURN(1);
}
if (alarm_queue.elements == alarm_queue.max_elements)
if (alarm_queue.elements >= max_used_alarms)
{
DBUG_PRINT("info", ("alarm queue full"));
fprintf(stderr,"Warning: thr_alarm queue is full\n");
pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_RETURN(1);
if (alarm_queue.elements == alarm_queue.max_elements)
{
DBUG_PRINT("info", ("alarm queue full"));
fprintf(stderr,"Warning: thr_alarm queue is full\n");
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 ||
(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)
/*
** Remove alarm from list of alarms
Remove alarm from list of alarms
*/
void thr_end_alarm(thr_alarm_t *alarmed)
......@@ -227,13 +232,13 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_VOID_RETURN;
}
/*
Come here when some alarm in queue is due.
Mark all alarms with are finnished in list.
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
every second.
*/
/*
Come here when some alarm in queue is due.
Mark all alarms with are finnished in list.
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
every second.
*/
sig_handler process_alarm(int sig __attribute__((unused)))
{
......@@ -334,8 +339,8 @@ sig_handler process_alarm(int sig __attribute__((unused)))
/*
** Shedule all alarms now.
** When all alarms are given, Free alarm memory and don't allow more alarms.
Shedule all alarms now.
When all alarms are given, Free alarm memory and don't allow more alarms.
*/
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)
......@@ -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
** ARGSUSED
This is here for thread to get interruptet from read/write/fcntl
ARGSUSED
*/
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
......@@ -459,7 +480,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
#endif /* USE_ALARM_THREAD */
/*****************************************************************************
** thr_alarm for OS/2
thr_alarm for OS/2
*****************************************************************************/
#elif defined(__EMX__) || defined(OS2)
......@@ -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)
......@@ -588,8 +609,14 @@ void init_thr_alarm(uint max_alarm)
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__ */
......@@ -661,13 +688,18 @@ void init_thr_alarm(uint max_alarm)
DBUG_VOID_RETURN;
}
void thr_alarm_info(ALARM_INFO *info)
{
bzero((char*) info, sizeof(*info));
}
#endif /* __WIN__ */
#endif /* THREAD */
/****************************************************************************
** Handling of MAIN
Handling of test case (when compiled with -DMAIN)
***************************************************************************/
#ifdef MAIN
......@@ -867,6 +899,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
pthread_attr_t thr_attr;
int i,*param,error;
sigset_t set;
ALARM_INFO alarm_info;
MY_INIT(argv[0]);
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#')
......@@ -927,6 +960,10 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
pthread_attr_destroy(&thr_attr);
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)
{
VOID(pthread_cond_wait(&COND_thread_count,&LOCK_thread_count));
......@@ -937,6 +974,10 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
}
}
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");
return 0;
}
......
......@@ -31,6 +31,7 @@ bin_SCRIPTS = @server_scripts@ \
mysqlhotcopy \
mysqldumpslow \
mysql_explain_log \
mysql_tableinfo \
mysqld_multi
EXTRA_SCRIPTS = make_binary_distribution.sh \
......@@ -50,6 +51,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysqldumpslow.sh \
mysql_explain_log.sh \
mysqld_multi.sh \
mysql_tableinfo.sh \
mysqld_safe.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \
......
This diff is collapsed.
......@@ -38,7 +38,7 @@
# as such, and clarify ones such as "mediumint" with comments such as
# "3-byte int" or "same as xxx".
$version="1.57";
$version="1.58";
use DBI;
use Getopt::Long;
......@@ -2186,20 +2186,20 @@ EOF
print <<EOF;
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
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
wrong time.
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
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
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 have been warned!
......@@ -2468,7 +2468,6 @@ sub report
print "$prompt: ";
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_config_data($limit,safe_query(\@queries) ? "yes" : "no",$prompt);
}
print "$limits{$limit}\n";
......@@ -2481,7 +2480,6 @@ sub report_fail
print "$prompt: ";
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_config_data($limit,safe_query(\@queries) ? "no" : "yes",$prompt);
}
print "$limits{$limit}\n";
......@@ -2498,7 +2496,7 @@ sub report_one
print "$prompt: ";
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_incomplete($limit,$prompt);
$result="no";
foreach $query (@$queries)
{
......@@ -2524,7 +2522,7 @@ sub report_result
print "$prompt: ";
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_incomplete($limit,$prompt);
$error=safe_query_result($query,"1",2);
save_config_data($limit,$error ? "not supported" : $last_result,$prompt);
}
......@@ -2537,7 +2535,7 @@ sub report_trans
my ($limit,$queries,$check,$clear)=@_;
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_incomplete($limit,$prompt);
eval {undef($dbh->{AutoCommit})};
if (!$@)
{
......@@ -2579,7 +2577,7 @@ sub check_and_report
print "$prompt: " if (!defined($skip_prompt));
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_incomplete($limit,$prompt);
$tmp=1-safe_query(\@$pre);
$tmp=safe_query_result($query,$answer,$string_type) if (!$tmp);
safe_query(\@$post);
......@@ -2615,7 +2613,7 @@ sub try_and_report
if (!defined($limits{$limit}))
{
save_config_data($limit,"incompleted",$prompt);
save_incomplete($limit,$prompt);
$type="no"; # Not supported
foreach $test (@tests)
{
......@@ -2695,7 +2693,8 @@ sub safe_query_result
$sth->finish;
return ($result_type == 8) ? 0 : 1;
}
if($result_type == 8) {
if ($result_type == 8)
{
$sth->finish;
return 1;
}
......@@ -2787,7 +2786,7 @@ sub find_limit()
print "$end (cache)\n";
return $end;
}
save_config_data($limit,"incompleted",$prompt);
save_incomplete($limit,$prompt);
if (defined($query->{'init'}) && !defined($end=$limits{'restart'}{'tohigh'}))
{
......@@ -2961,6 +2960,16 @@ sub save_all_config_data
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
{
......
#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
Need_cast_for_null=no # Need to cast NULL for arithmetic
......@@ -36,7 +36,7 @@ constraint_check=no # Column constraints
constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style)
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_func=no # default value function for column
create_if_not_exists=yes # create table if not exists
......@@ -333,7 +333,7 @@ max_char_size=255 # max char() size
max_column_name=64 # column name length
max_columns=3398 # Columns in table
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_length=500 # index length
max_index_name=64 # index name 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_with_null=65502 # table row length with nulls (without blobs)
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_name=64 # table name length
max_text_size=1048543 # max text or blob size
......@@ -396,7 +396,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select
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
storage_of_float=round # Storage of float values
subqueries=no # subqueries
......
......@@ -57,8 +57,8 @@ void hostname_cache_refresh()
bool hostname_cache_init()
{
host_entry *tmp;
uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp);
host_entry tmp;
uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp);
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
......
......@@ -2047,13 +2047,14 @@ longlong Item_func_inet_aton::val_int()
return 0;
}
void Item_func_match::init_search(bool no_order)
{
if (ft_handler)
return;
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)
{
......@@ -2071,7 +2072,7 @@ void Item_func_match::init_search(bool no_order)
// MATCH ... AGAINST (NULL) is meaningless, but possible
if (!(ft_tmp=key_item()->val_str(&tmp2)))
{
ft_tmp=&tmp2;
ft_tmp= &tmp2;
tmp2.set("",0);
}
......@@ -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)
{
List_iterator<Item> li(fields);
......
......@@ -171,9 +171,22 @@ class Item_num_op :public Item_func
bool is_null() { (void) val(); return null_value; }
Field *tmp_table_field(TABLE *t_arg)
{
if (!t_arg) return result_field;
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);
}
Field *res;
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);
#define MAX_FIELDS_BEFORE_HASH 32
#define USER_VARS_HASH_SIZE 16
#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
#define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int.
#endif
......
......@@ -67,7 +67,9 @@ class SEL_ARG :public Sql_alloc
SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value,
uint8 min_flag, uint8 max_flag, uint8 maybe_flag);
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)
{
if (type != arg->type)
......
......@@ -345,13 +345,12 @@ char uc_update_queries[SQLCOM_END];
static bool check_mqh(THD *thd, uint check_command)
{
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;
DBUG_ENTER("check_mqh");
DBUG_ASSERT(uc != 0);
bool my_start = thd->start_time != 0;
time_t check_time = (my_start) ? thd->start_time : time(NULL);
/* If more than a hour since last check, reset resource checking */
if (check_time - uc->intime >= 3600)
{
(void) pthread_mutex_lock(&LOCK_user_conn);
......@@ -361,6 +360,7 @@ static bool check_mqh(THD *thd, uint check_command)
uc->intime=check_time;
(void) pthread_mutex_unlock(&LOCK_user_conn);
}
/* Check that we have not done too many questions / hour */
if (uc->user_resources.questions &&
uc->questions++ >= uc->user_resources.questions)
{
......@@ -371,14 +371,15 @@ static bool check_mqh(THD *thd, uint check_command)
}
if (check_command < (uint) SQLCOM_END)
{
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);
error=1;
goto end;
}
/* Check that we have not done too many updates / hour */
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);
error=1;
goto end;
}
}
end:
DBUG_RETURN(error);
......
......@@ -21,6 +21,7 @@
#include "mysql_priv.h"
#include "sql_select.h"
#include <hash.h>
#include <thr_alarm.h>
/* Intern key cache variables */
extern "C" pthread_mutex_t THR_LOCK_keycache;
......@@ -239,6 +240,17 @@ Open streams: %10lu\n",
(ulong) cached_tables(),
(ulong) my_file_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);
if (thd)
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