Comment 1 for bug 1287650

Revision history for this message
George Ormond Lorch III (gl-az) wrote :

So Laurynas, do you think changing the "thd->thread_id % thd->variables.log_slow_rate_limit" test to something like "thd->thread_id % thd->variables.log_slow_rate_limit != rand() % thd->variables.log_slow_rate_limit" would be acceptable?

There are other ways but this would yield a non deterministic actual rate. Over the long haul the real output rate would certainly approximate the desired rate but it would not be a guarantee that "one in every log_slow_rate_limit queries will be logged", i.e. if log_slow_rate_limit is set to 100, there is no absolute guarantee that in 100 queries, exactly one will be logged.

Another way would be to keep some extra value and do something like:

static somevalue = rand() % log_slow_rate_limit;

if( thd->thread_id % thd->variables.log_slow_rate_limit == somevalue)