diff options
author | unknown <tnurnberg@sin.intern.azundris.com> | 2007-07-17 06:59:24 +0200 |
---|---|---|
committer | unknown <tnurnberg@sin.intern.azundris.com> | 2007-07-17 06:59:24 +0200 |
commit | 7858729d94017d7bf62dfd50e4eb36b1e69cbf91 (patch) | |
tree | f30bfff2c0d9a7544353027e8cffc8d44fa7b33a /sql/sql_class.h | |
parent | d3d38d0b14e6ad4acfcd89a7ef8c6b7eaef23e8a (diff) | |
parent | e587830c50ede0fd40f2efe372f0ea25774e7a76 (diff) | |
download | mariadb-git-7858729d94017d7bf62dfd50e4eb36b1e69cbf91.tar.gz |
Merge sin.intern.azundris.com:/home/tnurnberg/27198/41-27198
into sin.intern.azundris.com:/home/tnurnberg/27198/50-27198
sql/mysql_priv.h:
Auto merged
sql/sql_class.h:
Auto merged
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index a5cbc21684f..0cfe8dc6668 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1588,11 +1588,27 @@ public: proc_info = old_msg; 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 void set_time() { if (user_time) start_time=time_after_lock=user_time; else time_after_lock=time(&start_time); } - inline void end_time() { 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() { safe_time(&start_time); } 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) { last_insert_id= id_arg; |