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

Commit40c3fe4

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 parent6cc54f3 commit40c3fe4

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 */
@@ -1830,6 +1831,7 @@ doCustom(TState *thread, CState *st, StatsData *agg)
18301831
}
18311832
}
18321833

1834+
st->sleep_until=st->txn_scheduled;
18331835
st->sleeping= true;
18341836
st->throttling= true;
18351837
st->is_throttled= true;
@@ -1842,7 +1844,7 @@ doCustom(TState *thread, CState *st, StatsData *agg)
18421844
{/* are we sleeping? */
18431845
if (INSTR_TIME_IS_ZERO(now))
18441846
INSTR_TIME_SET_CURRENT(now);
1845-
if (INSTR_TIME_GET_MICROSEC(now)<st->txn_scheduled)
1847+
if (INSTR_TIME_GET_MICROSEC(now)<st->sleep_until)
18461848
return true;/* Still sleeping, nothing to do here */
18471849
/* Else done sleeping, go ahead with next command */
18481850
st->sleeping= false;
@@ -2141,7 +2143,7 @@ doCustom(TState *thread, CState *st, StatsData *agg)
21412143
usec *=1000000;
21422144

21432145
INSTR_TIME_SET_CURRENT(now);
2144-
st->txn_scheduled=INSTR_TIME_GET_MICROSEC(now)+usec;
2146+
st->sleep_until=INSTR_TIME_GET_MICROSEC(now)+usec;
21452147
st->sleeping= true;
21462148

21472149
st->listen= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp