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

Commitf65764a

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 parent156f974 commitf65764a

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
@@ -250,6 +250,7 @@ typedef struct
250250
intnvariables;/* number of variables */
251251
boolvars_sorted;/* are variables sorted by name? */
252252
int64txn_scheduled;/* scheduled start time of transaction (usec) */
253+
int64sleep_until;/* scheduled start time of next cmd (usec) */
253254
instr_timetxn_begin;/* used for measuring schedule lag times */
254255
instr_timestmt_begin;/* used for measuring statement latencies */
255256
intuse_file;/* index in sql_scripts for this client */
@@ -1828,6 +1829,7 @@ doCustom(TState *thread, CState *st, StatsData *agg)
18281829
}
18291830
}
18301831

1832+
st->sleep_until=st->txn_scheduled;
18311833
st->sleeping= true;
18321834
st->throttling= true;
18331835
st->is_throttled= true;
@@ -1840,7 +1842,7 @@ doCustom(TState *thread, CState *st, StatsData *agg)
18401842
{/* are we sleeping? */
18411843
if (INSTR_TIME_IS_ZERO(now))
18421844
INSTR_TIME_SET_CURRENT(now);
1843-
if (INSTR_TIME_GET_MICROSEC(now)<st->txn_scheduled)
1845+
if (INSTR_TIME_GET_MICROSEC(now)<st->sleep_until)
18441846
return true;/* Still sleeping, nothing to do here */
18451847
/* Else done sleeping, go ahead with next command */
18461848
st->sleeping= false;
@@ -2138,7 +2140,7 @@ doCustom(TState *thread, CState *st, StatsData *agg)
21382140
usec *=1000000;
21392141

21402142
INSTR_TIME_SET_CURRENT(now);
2141-
st->txn_scheduled=INSTR_TIME_GET_MICROSEC(now)+usec;
2143+
st->sleep_until=INSTR_TIME_GET_MICROSEC(now)+usec;
21422144
st->sleeping= true;
21432145

21442146
st->listen= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp