diff options
author | unknown <tnurnberg@sin.intern.azundris.com> | 2007-07-17 08:23:43 +0200 |
---|---|---|
committer | unknown <tnurnberg@sin.intern.azundris.com> | 2007-07-17 08:23:43 +0200 |
commit | 8631c57b0c7e690860f38791f5faae2388caa983 (patch) | |
tree | b1834c46bc5c483b84284a9c941de2ed38ed59fc /sql/sql_class.h | |
parent | f3fd6168ffc3c2d10d479aed088c1b01f5242d06 (diff) | |
parent | 7858729d94017d7bf62dfd50e4eb36b1e69cbf91 (diff) | |
download | mariadb-git-8631c57b0c7e690860f38791f5faae2388caa983.tar.gz |
Merge sin.intern.azundris.com:/home/tnurnberg/27198/50-27198
into sin.intern.azundris.com:/home/tnurnberg/27198/51-27198
sql/sql_class.h:
Auto merged
sql/mysql_priv.h:
manual merge
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 004c4aa4f5a..8c956d68061 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1557,11 +1557,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 ulonglong found_rows(void) { return limit_found_rows; |