Skip to content

Commit 47211af

Browse files
committed
Fix "pg_bench -C -M prepared".
This didn't work because when we dropped and re-established a database connection, we did not bother to reset session-specific state such as the statements-are-prepared flags. The st->prepared[] array certainly needs to be flushed, and I cleared a couple of other fields as well that couldn't possibly retain meaningful state for a new connection. In passing, fix some bogus comments and strange field order choices. Per report from Robins Tharakan.
1 parent 5db5146 commit 47211af

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ typedef struct
230230
int id; /* client No. */
231231
int state; /* state No. */
232232
bool listen; /* whether an async query has been sent */
233-
bool is_throttled; /* whether transaction throttling is done */
234233
bool sleeping; /* whether the client is napping */
235234
bool throttling; /* whether nap is for throttling */
235+
bool is_throttled; /* whether transaction throttling is done */
236236
Variable *variables; /* array of variable definitions */
237237
int nvariables;
238238
int64 txn_scheduled; /* scheduled start time of transaction (usec) */
@@ -1522,6 +1522,13 @@ doCustom(TState *thread, CState *st, StatsData *agg)
15221522
}
15231523
INSTR_TIME_SET_CURRENT(end);
15241524
INSTR_TIME_ACCUM_DIFF(thread->conn_time, end, start);
1525+
1526+
/* Reset session-local state */
1527+
st->listen = false;
1528+
st->sleeping = false;
1529+
st->throttling = false;
1530+
st->is_throttled = false;
1531+
memset(st->prepared, 0, sizeof(st->prepared));
15251532
}
15261533

15271534
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy