Commit 60e70c69 authored by unknown's avatar unknown

Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint

into  sin.intern.azundris.com:/home/tnurnberg/27198/50-27198

parents b5761c5c 7858729d
...@@ -617,6 +617,16 @@ enum enum_mysql_completiontype { ...@@ -617,6 +617,16 @@ enum enum_mysql_completiontype {
int end_trans(THD *thd, enum enum_mysql_completiontype completion); int end_trans(THD *thd, enum enum_mysql_completiontype completion);
Item *negate_expression(THD *thd, Item *expr); Item *negate_expression(THD *thd, Item *expr);
/* log.cc */
void sql_perror(const char *message);
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
#include "sql_class.h" #include "sql_class.h"
#include "sql_acl.h" #include "sql_acl.h"
#include "tztime.h" #include "tztime.h"
...@@ -1198,14 +1208,6 @@ bool is_key_used(TABLE *table, uint idx, List<Item> &fields); ...@@ -1198,14 +1208,6 @@ bool is_key_used(TABLE *table, uint idx, List<Item> &fields);
int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length); int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
bool init_errmessage(void); bool init_errmessage(void);
void sql_perror(const char *message);
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
bool fn_format_relative_to_data_home(my_string to, const char *name, bool fn_format_relative_to_data_home(my_string to, const char *name,
const char *dir, const char *extension); const char *dir, const char *extension);
......
...@@ -1588,11 +1588,27 @@ class THD :public Statement, ...@@ -1588,11 +1588,27 @@ class THD :public Statement,
proc_info = old_msg; proc_info = old_msg;
pthread_mutex_unlock(&mysys_var->mutex); pthread_mutex_unlock(&mysys_var->mutex);
} }
static inline void safe_time(time_t *t)
{
/**
Wrapper around time() which retries on error (-1)
@details
This is needed because, despite the documentation, time() may fail
in some circumstances. Here we retry time() until it succeeds, and
log the failure so that performance problems related to this can be
identified.
*/
while(unlikely(time(t) == ((time_t) -1)))
sql_print_information("time() failed with %d", errno);
}
inline time_t query_start() { query_start_used=1; return start_time; } inline time_t query_start() { query_start_used=1; return start_time; }
inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else time_after_lock=time(&start_time); } inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else { safe_time(&start_time); time_after_lock= start_time; }}
inline void end_time() { time(&start_time); } inline void end_time() { safe_time(&start_time); }
inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; } inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; }
inline void lock_time() { time(&time_after_lock); } inline void lock_time() { safe_time(&time_after_lock); }
inline void insert_id(ulonglong id_arg) inline void insert_id(ulonglong id_arg)
{ {
last_insert_id= id_arg; last_insert_id= id_arg;
......
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