|
|||||||||||
|
bk commit into 4.0 tree (tnurnberg:1.2214) BUG#27198
From: Tatjana A Nuernberg <azundris(at)mysql.com>
Date: Wed Jun 27 2007 - 07:00:01 EDT
ChangeSet@1.2214, 2007-06-27 13:00:00+02:00, tnurnberg@sin.intern.azundris.com +1 -0 Bug#27198: Error returns from time() are ignored gettimeofday() can fail and presumably, so can time(). Keep an eye on it. Since we have no data on this at all so far, we just retry on failure (and log the event), assuming that this is just an intermittant failure. This might of course hang the threat until we succeed. Once we know more about these failures, an appropriate more clever scheme may be picked (only try so many times per thread, etc., if that fails, return last "good" time() we got or some such). Using sql_print_information() to log as this probably only occurs in high load scenarios where the debugtrace likely is disabled (or might interfere with testing the effect). No test-case as this is a non-deterministic issue. sql/sql_class.h@1.192, 2007-06-27 12:59:59+02:00, tnurnberg@sin.intern.azundris.com +34 -16 Bug#27198: Error returns from time() are ignored gettimeofday() can fail and presumably, so can time(). Keep an eye on it. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: tnurnberg # Host: sin.intern.azundris.com # Root: /home/tnurnberg/27198/40-27198 --- 1.191/sql/sql_class.h 2004-12-03 00:02:39 +01:00 +++ 1.192/sql/sql_class.h 2007-06-27 12:59:59 +02:00#endif
+void sql_print_information(const char *format, ...);
+
class Query_log_event;
{
char buf1[22],buf2[22];
DBUG_ENTER("harvest_bytes_written");
(*counter)+=bytes_written;
DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1),
@@ -148,7 +150,7 @@ public:
*/
int generate_new_name(char *new_name,const char *old_name);
void make_log_name(char* buf, const char* log_ident);
bool is_active(const char* log_file_name);
ULL *ull;
struct st_my_thread_var *mysys_var;
ulonglong next_insert_id,last_insert_id,current_insert_id,
limit_found_rows;
*/ ulong slave_proxy_id; NET* slave_net; // network connection from slave -> m.- +
/* Used by the sys_var class to store temporary values */
union
pthread_mutex_unlock(&LOCK_delete);
}
void awake(bool prepare_to_die);
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)
{ last_insert_id=id; insert_id_used=1; } inline ulonglong insert_id(void) {
if (!last_insert_id_used)
- {
+ {
last_insert_id_used=1;
current_insert_id=last_insert_id;
}
@@ -588,10 +606,10 @@ public:
inline ulonglong found_rows(void)
return limit_found_rows;
- }
+ }
inline bool active_transaction()
return (transaction.all.bdb_tid != 0 ||
transaction.all.innodb_active_trans != 0);
#else
@@ -619,8 +637,8 @@ public:
memcpy(ptr,str,size);
return ptr;
} - inline gptr trans_alloc(unsigned int size) - { + inline gptr trans_alloc(unsigned int size) + {
return alloc_root(&transaction.mem_root,size);
}
# define tmp_disable_binlog(A) \ ulong save_options= (A)->options, save_master_access= (A)->master_access; \ (A)->options&= ~OPTION_BIN_LOG; \ - (A)->master_access|= SUPER_ACL; /* unneeded in 4.1 */+ (A)->master_access|= SUPER_ACL; /* unneeded in 4.1 */ #define reenable_binlog(A) \ (A)->options= save_options; \ - (A)->master_access= save_master_access;+ (A)->master_access= save_master_access; /* Flags for the THD::system_thread (bitmap) variable */ #define SYSTEM_THREAD_DELAYED_INSERT 1 -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Wed Jun 27 07:00:10 2007 This archive was generated by hypermail 2.1.8 : Wed Jun 27 2007 - 07:10:02 EDT |
||||||||||
|
|||||||||||