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

Commitedb5c40

Browse files
committed
Fix latency calculation when there are \sleep commands in the script.
We can't use txn_scheduled to hold the sleep-until time for \sleep, becausethat interferes with calculation of the latency of the transaction as whole.Backpatch to 9.4, where this bug was introduced.Fabien COELHODiscussion: <alpine.DEB.2.20.1608231622170.7102@lancre>
1 parent52acf02 commitedb5c40

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ typedef struct
219219
Variable*variables;/* array of variable definitions */
220220
intnvariables;
221221
int64txn_scheduled;/* scheduled start time of transaction (usec) */
222+
int64sleep_until;/* scheduled start time of next cmd (usec) */
222223
instr_timetxn_begin;/* used for measuring schedule lag times */
223224
instr_timestmt_begin;/* used for measuring statement latencies */
224225
int64txn_latencies;/* cumulated latencies */
@@ -1238,6 +1239,7 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
12381239
}
12391240
}
12401241

1242+
st->sleep_until=st->txn_scheduled;
12411243
st->sleeping=1;
12421244
st->throttling= true;
12431245
st->is_throttled= true;
@@ -1253,7 +1255,7 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
12531255
if (INSTR_TIME_IS_ZERO(now))
12541256
INSTR_TIME_SET_CURRENT(now);
12551257
now_us=INSTR_TIME_GET_MICROSEC(now);
1256-
if (st->txn_scheduled <=now_us)
1258+
if (st->sleep_until <=now_us)
12571259
{
12581260
st->sleeping=0;/* Done sleeping, go ahead with next command */
12591261
if (st->throttling)
@@ -1721,7 +1723,7 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
17211723
usec *=1000000;
17221724

17231725
INSTR_TIME_SET_CURRENT(now);
1724-
st->txn_scheduled=INSTR_TIME_GET_MICROSEC(now)+usec;
1726+
st->sleep_until=INSTR_TIME_GET_MICROSEC(now)+usec;
17251727
st->sleeping=1;
17261728

17271729
st->listen=1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp