pgbench: If we fail to send a command to the server, fail.
authorRobert Haas <rhaas@postgresql.org>
Fri, 29 Sep 2017 17:51:14 +0000 (13:51 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 29 Sep 2017 17:56:04 +0000 (13:56 -0400)
This beats the old behavior of busy-waiting hands down.

Oversight in commit 12788ae49e1933f463bc59a6efe46c4a01701b76.

Report by Pavan Deolasee. Patch by Fabien Coelho.  Reviewed by
Pavan Deolasee.

Discussion: http://postgr.es/m/CABOikdPhfXTypckMC1Ux6Ko+hKBWwUBA=EXsvamXYSg8M9J94w@mail.gmail.com

src/bin/pgbench/pgbench.c

index ae78c7b1d46fe06041f9017e982247b7a31bbccb..58fdc477eee26911553b93cf360203a18a00596c 100644 (file)
@@ -2157,12 +2157,8 @@ doCustom(TState *thread, CState *st, StatsData *agg)
                {
                    if (!sendCommand(st, command))
                    {
-                       /*
-                        * Failed. Stay in CSTATE_START_COMMAND state, to
-                        * retry. ??? What the point or retrying? Should
-                        * rather abort?
-                        */
-                       return;
+                       commandFailed(st, "SQL command send failed");
+                       st->state = CSTATE_ABORTED;
                    }
                    else
                        st->state = CSTATE_WAIT_RESULT;