Fix error status of vacuumdb when multiple jobs are used
authorMichael Paquier <michael@paquier.xyz>
Thu, 9 May 2019 01:29:10 +0000 (10:29 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 9 May 2019 01:29:10 +0000 (10:29 +0900)
When running a batch of VACUUM or ANALYZE commands on a given database,
there were cases where it is possible to have vacuumdb not report an
error where it actually should, leading to incorrect status results.

Author: Julien Rouhaud
Reviewed-by: Amit Kapila, Michael Paquier
Discussion: https://postgr.es/m/CAOBaU_ZuTwz7CtqLYJ1Ouuh272bTQPLN8b1bAPk0bCBm4PDMTQ@mail.gmail.com
Backpatch-through: 9.5

src/bin/scripts/vacuumdb.c

index f15e1ad8f1ca9856fd0cb627be3f5783f189c3ac..e9da74c3bae3e818785a40c1bdc36a0c11289f75 100644 (file)
@@ -712,7 +712,10 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
        for (j = 0; j < concurrentCons; j++)
        {
            if (!GetQueryResult((slots + j)->connection, progname))
+           {
+               failed = true;
                goto finish;
+           }
        }
    }