mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-04 00:28:10 +02:00
Prevent integer overflow with --progress >= 2148
If --progress=2148 or higher was given, the calculation of the next time to report overflowed, and pgbench would print a progress report very frequently. Kingter Wang
This commit is contained in:
parent
d8a0b96c50
commit
277279981f
@ -2974,7 +2974,7 @@ threadRun(void *arg)
|
|||||||
/* for reporting progress: */
|
/* for reporting progress: */
|
||||||
int64 thread_start = INSTR_TIME_GET_MICROSEC(thread->start_time);
|
int64 thread_start = INSTR_TIME_GET_MICROSEC(thread->start_time);
|
||||||
int64 last_report = thread_start;
|
int64 last_report = thread_start;
|
||||||
int64 next_report = last_report + progress * 1000000;
|
int64 next_report = last_report + (int64) progress * 1000000;
|
||||||
int64 last_count = 0, last_lats = 0, last_sqlats = 0, last_lags = 0;
|
int64 last_count = 0, last_lats = 0, last_sqlats = 0, last_lags = 0;
|
||||||
|
|
||||||
AggVals aggs;
|
AggVals aggs;
|
||||||
@ -3210,7 +3210,7 @@ threadRun(void *arg)
|
|||||||
last_sqlats = sqlats;
|
last_sqlats = sqlats;
|
||||||
last_lags = lags;
|
last_lags = lags;
|
||||||
last_report = now;
|
last_report = now;
|
||||||
next_report += progress * 1000000;
|
next_report += (int64) progress * 1000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -3261,7 +3261,7 @@ threadRun(void *arg)
|
|||||||
last_sqlats = sqlats;
|
last_sqlats = sqlats;
|
||||||
last_lags = lags;
|
last_lags = lags;
|
||||||
last_report = now;
|
last_report = now;
|
||||||
next_report += progress * 1000000;
|
next_report += (int64) progress * 1000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PTHREAD_FORK_EMULATION */
|
#endif /* PTHREAD_FORK_EMULATION */
|
||||||
|
Loading…
Reference in New Issue
Block a user