Commit 6fe6288d authored by Rohit Kalhans's avatar Rohit Kalhans

bug#11759333:

follow-up patch for the failure on pb2 windows build
parent 3a71ab08
...@@ -4814,8 +4814,7 @@ show_query_type(THD::enum_binlog_query_type qtype) ...@@ -4814,8 +4814,7 @@ show_query_type(THD::enum_binlog_query_type qtype)
//number of limit unsafe warnings after which the suppression will be activated //number of limit unsafe warnings after which the suppression will be activated
#define LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT 50 #define LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT 50
static struct timeval limit_unsafe_suppression_start_time; static ulonglong limit_unsafe_suppression_start_time= 0;
static struct timezone limit_unsafe_suppression_start_time_zone;
static bool unsafe_warning_suppression_is_activated= false; static bool unsafe_warning_suppression_is_activated= false;
static int limit_unsafe_warning_count= 0; static int limit_unsafe_warning_count= 0;
...@@ -4827,8 +4826,7 @@ static void reset_binlog_unsafe_suppression() ...@@ -4827,8 +4826,7 @@ static void reset_binlog_unsafe_suppression()
DBUG_ENTER("reset_binlog_unsafe_suppression"); DBUG_ENTER("reset_binlog_unsafe_suppression");
unsafe_warning_suppression_is_activated= false; unsafe_warning_suppression_is_activated= false;
limit_unsafe_warning_count= 0; limit_unsafe_warning_count= 0;
gettimeofday(&limit_unsafe_suppression_start_time, limit_unsafe_suppression_start_time= my_getsystime()/10000000;
&limit_unsafe_suppression_start_time_zone);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -4860,8 +4858,7 @@ static void print_unsafe_warning_to_log(int unsafe_type, char* buf, ...@@ -4860,8 +4858,7 @@ static void print_unsafe_warning_to_log(int unsafe_type, char* buf,
*/ */
static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query) static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query)
{ {
struct timeval now; ulonglong now= 0;
struct timezone tz_now;
DBUG_ENTER("do_unsafe_limit_checkout"); DBUG_ENTER("do_unsafe_limit_checkout");
DBUG_ASSERT(unsafe_type == LEX::BINLOG_STMT_UNSAFE_LIMIT); DBUG_ASSERT(unsafe_type == LEX::BINLOG_STMT_UNSAFE_LIMIT);
limit_unsafe_warning_count++; limit_unsafe_warning_count++;
...@@ -4870,10 +4867,9 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query) ...@@ -4870,10 +4867,9 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query)
If this is the first time this function is called with log warning If this is the first time this function is called with log warning
enabled, the monitoring the unsafe warnings should start. enabled, the monitoring the unsafe warnings should start.
*/ */
if (limit_unsafe_suppression_start_time.tv_sec == 0) if (limit_unsafe_suppression_start_time == 0)
{ {
gettimeofday(&limit_unsafe_suppression_start_time, limit_unsafe_suppression_start_time= my_getsystime()/10000000;
&limit_unsafe_suppression_start_time_zone);
print_unsafe_warning_to_log(unsafe_type, buf, query); print_unsafe_warning_to_log(unsafe_type, buf, query);
} }
else else
...@@ -4884,7 +4880,7 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query) ...@@ -4884,7 +4880,7 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query)
if (limit_unsafe_warning_count >= if (limit_unsafe_warning_count >=
LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT) LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT)
{ {
gettimeofday (&now, &tz_now); now= my_getsystime()/10000000;
if (!unsafe_warning_suppression_is_activated) if (!unsafe_warning_suppression_is_activated)
{ {
/* /*
...@@ -4893,7 +4889,7 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query) ...@@ -4893,7 +4889,7 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query)
less than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT we activate the less than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT we activate the
suppression. suppression.
*/ */
if ((now.tv_sec-limit_unsafe_suppression_start_time.tv_sec) <= if ((now-limit_unsafe_suppression_start_time) <=
LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT) LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT)
{ {
unsafe_warning_suppression_is_activated= true; unsafe_warning_suppression_is_activated= true;
...@@ -4905,8 +4901,7 @@ unsafety warning suppression has been activated.")); ...@@ -4905,8 +4901,7 @@ unsafety warning suppression has been activated."));
/* /*
there is no flooding till now, therefore we restart the monitoring there is no flooding till now, therefore we restart the monitoring
*/ */
gettimeofday(&limit_unsafe_suppression_start_time, limit_unsafe_suppression_start_time= my_getsystime()/10000000;
&limit_unsafe_suppression_start_time_zone);
limit_unsafe_warning_count= 0; limit_unsafe_warning_count= 0;
} }
} }
...@@ -4919,15 +4914,14 @@ unsafety warning suppression has been activated.")); ...@@ -4919,15 +4914,14 @@ unsafety warning suppression has been activated."));
during the last %d seconds in the error log", during the last %d seconds in the error log",
limit_unsafe_warning_count, limit_unsafe_warning_count,
(int) (int)
(now.tv_sec - (now-limit_unsafe_suppression_start_time));
limit_unsafe_suppression_start_time.tv_sec));
print_unsafe_warning_to_log(unsafe_type, buf, query); print_unsafe_warning_to_log(unsafe_type, buf, query);
/* /*
DEACTIVATION: We got LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT DEACTIVATION: We got LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT
warnings in more than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT, the warnings in more than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT, the
suppression should be deactivated. suppression should be deactivated.
*/ */
if ((now.tv_sec - limit_unsafe_suppression_start_time.tv_sec) > if ((now - limit_unsafe_suppression_start_time) >
LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT) LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT)
{ {
reset_binlog_unsafe_suppression(); reset_binlog_unsafe_suppression();
......
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