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

Skip to content

Commit 23cb326

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 b0bdc3f commit 23cb326

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

contrib/pgbench/pgbench.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ typedef struct
204204
int state; /* state No. */
205205
int cnt; /* xacts count */
206206
int ecnt; /* error count */
207-
int listen; /* 0 indicates that an async query has been
207+
int listen; /* 1 indicates that an async query has been
208208
* sent */
209209
int sleeping; /* 1 indicates that the client is napping */
210210
bool throttling; /* whether nap is for throttling */
@@ -1274,6 +1274,13 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
12741274
}
12751275
INSTR_TIME_SET_CURRENT(end);
12761276
INSTR_TIME_ACCUM_DIFF(*conn_time, end, start);
1277+
1278+
/* Reset session-local state */
1279+
st->listen = 0;
1280+
st->sleeping = 0;
1281+
st->throttling = false;
1282+
st->is_throttled = false;
1283+
memset(st->prepared, 0, sizeof(st->prepared));
12771284
}
12781285

12791286
/*

0 commit comments

Comments
 (0)
0