|
1 | 1 | /*
|
2 |
| - * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.19 2002/09/04 20:31:08 momjian Exp $ |
| 2 | + * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.20 2002/10/07 05:10:02 ishii Exp $ |
3 | 3 | *
|
4 | 4 | * pgbench: a simple TPC-B like benchmark program for PostgreSQL
|
5 | 5 | * written by Tatsuo Ishii
|
@@ -184,17 +184,16 @@ doOne(CState * state, int n, int debug, int ttype)
|
184 | 184 | { /* are we receiver? */
|
185 | 185 | if (debug)
|
186 | 186 | fprintf(stderr, "client %d receiving\n", n);
|
187 |
| - while (PQisBusy(st->con) == TRUE) |
188 |
| - { |
189 |
| - if (!PQconsumeInput(st->con)) |
190 |
| - { /* there's something wrong */ |
191 |
| - fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state); |
192 |
| - remains--; /* I've aborted */ |
193 |
| - PQfinish(st->con); |
194 |
| - st->con = NULL; |
195 |
| - return; |
196 |
| - } |
| 187 | + if (!PQconsumeInput(st->con)) |
| 188 | + { /* there's something wrong */ |
| 189 | + fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state); |
| 190 | + remains--; /* I've aborted */ |
| 191 | + PQfinish(st->con); |
| 192 | + st->con = NULL; |
| 193 | + return; |
197 | 194 | }
|
| 195 | + if (PQisBusy(st->con)) |
| 196 | + return; /* don't have the whole result yet */ |
198 | 197 |
|
199 | 198 | switch (st->state)
|
200 | 199 | {
|
@@ -367,17 +366,16 @@ doSelectOnly(CState * state, int n, int debug)
|
367 | 366 | { /* are we receiver? */
|
368 | 367 | if (debug)
|
369 | 368 | fprintf(stderr, "client %d receiving\n", n);
|
370 |
| - while (PQisBusy(st->con) == TRUE) |
371 |
| - { |
372 |
| - if (!PQconsumeInput(st->con)) |
373 |
| - { /* there's something wrong */ |
374 |
| - fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state); |
375 |
| - remains--; /* I've aborted */ |
376 |
| - PQfinish(st->con); |
377 |
| - st->con = NULL; |
378 |
| - return; |
379 |
| - } |
| 369 | + if (!PQconsumeInput(st->con)) |
| 370 | + { /* there's something wrong */ |
| 371 | + fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state); |
| 372 | + remains--; /* I've aborted */ |
| 373 | + PQfinish(st->con); |
| 374 | + st->con = NULL; |
| 375 | + return; |
380 | 376 | }
|
| 377 | + if (PQisBusy(st->con)) |
| 378 | + return; /* don't have the whole result yet */ |
381 | 379 |
|
382 | 380 | switch (st->state)
|
383 | 381 | {
|
|
0 commit comments