8000 Fix "pg_bench -C -M prepared". · dpirotte/postgres@1965a8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 1965a8c

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 0c94970 commit 1965a8c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

contrib/pgbench/pgbench.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ typedef struct
170170
int state; /* state No. */
171171
int cnt; /* xacts count */
172172
int ecnt; /* error count */
173-
int listen; /* 0 indicates that an async query has been
173+
int listen; /* 1 indicates that an async query has been
174174
* sent */
175175
int sleeping; /* 1 indicates that the client is napping */
176176
int64 until; /* napping until (usec) */
@@ -910,6 +910,11 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile)
910910
}
911911
INSTR_TIME_SET_CURRENT(end);
912912
INSTR_TIME_ACCUM_DIFF(*conn_time, end, start);
913+
914+
/* Reset session-local state */
915+
st->listen = 0;
916+
st->sleeping = 0;
917+
memset(st->prepared, 0, sizeof(st->prepared));
913918
}
914919

915920
/* Record transaction start time if logging is enabled */

0 commit comments

Comments
 (0)
0