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)
//number of limit unsafe warnings after which the suppression will be activated
#define LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT 50
static struct timeval limit_unsafe_suppression_start_time;
static struct timezone limit_unsafe_suppression_start_time_zone;
static ulonglong limit_unsafe_suppression_start_time= 0;
static bool unsafe_warning_suppression_is_activated= false;
static int limit_unsafe_warning_count= 0;
......@@ -4827,8 +4826,7 @@ static void reset_binlog_unsafe_suppression()
DBUG_ENTER("reset_binlog_unsafe_suppression");
unsafe_warning_suppression_is_activated= false;
limit_unsafe_warning_count= 0;
gettimeofday(&limit_unsafe_suppression_start_time,
&limit_unsafe_suppression_start_time_zone);
limit_unsafe_suppression_start_time= my_getsystime()/10000000;
DBUG_VOID_RETURN;
}
......@@ -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)
{
struct timeval now;
struct timezone tz_now;
ulonglong now= 0;
DBUG_ENTER("do_unsafe_limit_checkout");
DBUG_ASSERT(unsafe_type == LEX::BINLOG_STMT_UNSAFE_LIMIT);
limit_unsafe_warning_count++;
......@@ -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
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_zone);
limit_unsafe_suppression_start_time= my_getsystime()/10000000;
print_unsafe_warning_to_log(unsafe_type, buf, query);
}
else
......@@ -4884,7 +4880,7 @@ static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query)
if (limit_unsafe_warning_count >=
LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT)
{
gettimeofday (&now, &tz_now);
now= my_getsystime()/10000000;
if (!unsafe_warning_suppression_is_activated)
{
/*
......@@ -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
suppression.
*/
if ((now.tv_sec-limit_unsafe_suppression_start_time.tv_sec) <=
if ((now-limit_unsafe_suppression_start_time) <=
LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT)
{
unsafe_warning_suppression_is_activated= true;
......@@ -4905,8 +4901,7 @@ unsafety warning suppression has been activated."));
/*
there is no flooding till now, therefore we restart the monitoring
*/
gettimeofday(&limit_unsafe_suppression_start_time,
&limit_unsafe_suppression_start_time_zone);
limit_unsafe_suppression_start_time= my_getsystime()/10000000;
limit_unsafe_warning_count= 0;
}
}
......@@ -4919,15 +4914,14 @@ unsafety warning suppression has been activated."));
during the last %d seconds in the error log",
limit_unsafe_warning_count,
(int)
(now.tv_sec -
limit_unsafe_suppression_start_time.tv_sec));
(now-limit_unsafe_suppression_start_time));
print_unsafe_warning_to_log(unsafe_type, buf, query);
/*
DEACTIVATION: We got LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT
warnings in more than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT, the
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)
{
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