File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2244,12 +2244,13 @@ check_log_duration(char *msec_str, bool was_logged)
2244
2244
/*
2245
2245
* Do not log if log_statement_sample_rate = 0. Log a sample if
2246
2246
* log_statement_sample_rate <= 1 and avoid unecessary random() call
2247
- * if log_statement_sample_rate = 1.
2247
+ * if log_statement_sample_rate = 1. But don't compute any of this
2248
+ * unless needed.
2248
2249
*/
2249
- if ( exceeded )
2250
- in_sample = log_statement_sample_rate != 0 &&
2251
- (log_statement_sample_rate == 1 ||
2252
- random () <= log_statement_sample_rate * MAX_RANDOM_VALUE );
2250
+ in_sample = exceeded &&
2251
+ log_statement_sample_rate != 0 &&
2252
+ (log_statement_sample_rate == 1 ||
2253
+ random () <= log_statement_sample_rate * MAX_RANDOM_VALUE );
2253
2254
2254
2255
if ((exceeded && in_sample ) || log_duration )
2255
2256
{
You can’t perform that action at this time.
0 commit comments