File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 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)
22442244 /*
22452245 * Do not log if log_statement_sample_rate = 0. Log a sample if
22462246 * 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.
22482249 */
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 );
22532254
22542255 if ((exceeded && in_sample ) || log_duration )
22552256 {
You can’t perform that action at this time.
0 commit comments