Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2772799

Browse files
committed
Prevent integer overflow with --progress >= 2148
If --progress=2148 or higher was given, the calculation of the next timeto report overflowed, and pgbench would print a progress report veryfrequently.Kingter Wang
1 parentd8a0b96 commit2772799

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎contrib/pgbench/pgbench.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,7 +2974,7 @@ threadRun(void *arg)
29742974
/* for reporting progress: */
29752975
int64thread_start=INSTR_TIME_GET_MICROSEC(thread->start_time);
29762976
int64last_report=thread_start;
2977-
int64next_report=last_report+progress*1000000;
2977+
int64next_report=last_report+(int64)progress*1000000;
29782978
int64last_count=0,last_lats=0,last_sqlats=0,last_lags=0;
29792979

29802980
AggValsaggs;
@@ -3210,7 +3210,7 @@ threadRun(void *arg)
32103210
last_sqlats=sqlats;
32113211
last_lags=lags;
32123212
last_report=now;
3213-
next_report+=progress*1000000;
3213+
next_report+=(int64)progress*1000000;
32143214
}
32153215
}
32163216
#else
@@ -3261,7 +3261,7 @@ threadRun(void *arg)
32613261
last_sqlats=sqlats;
32623262
last_lags=lags;
32633263
last_report=now;
3264-
next_report+=progress*1000000;
3264+
next_report+=(int64)progress*1000000;
32653265
}
32663266
}
32673267
#endif/* PTHREAD_FORK_EMULATION */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp