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

Skip to content

Commit 8ee2e5f

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 3f14d8d commit 8ee2e5f

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
@@ -212,7 +212,7 @@ typedef struct
212212
int state; /* state No. */
213213
int cnt; /* xacts count */
214214
int ecnt; /* error count */
215-
int listen; /* 0 indicates that an async query has been
215+
int listen; /* 1 indicates that an async query has been
216216
* sent */
217217
int sleeping; /* 1 indicates that the client is napping */
218218
bool throttling; /* whether nap is for throttling */
@@ -1405,6 +1405,13 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
14051405
}
14061406
INSTR_TIME_SET_CURRENT(end);
14071407
INSTR_TIME_ACCUM_DIFF(*conn_time, end, start);
1408+
1409+
/* Reset session-local state */
1410+
st->listen = 0;
1411+
st->sleeping = 0;
1412+
st->throttling = false;
1413+
st->is_throttled = false;
1414+
memset(st->prepared, 0, sizeof(st->prepared));
14081415
}
14091416

14101417
/*

0 commit comments

Comments
 (0)
0