Use logical operator && instead of & in vacuumparallel.c.
authorAmit Kapila <[email protected]>
Mon, 22 Aug 2022 03:23:58 +0000 (08:53 +0530)
committerAmit Kapila <[email protected]>
Mon, 22 Aug 2022 03:23:58 +0000 (08:53 +0530)
As such the current usage of & won't produce incorrect results but it
would be better to use && to short-circuit the evaluation of second
condition when the same is not required.

Author: Ranier Vilela
Reviewed-by: Tom Lane, Bharath Rupireddy
Backpatch-through: 15, where it was introduced
Discussion: https://postgr.es/m/CAEudQApL8QcoYwQuutkWKY_h7gBY8F0Xs34YKfc7-G0i83K_pw@mail.gmail.com

src/backend/commands/vacuumparallel.c

index 5c6f646eff916bf5d8408478dd4da168cea93ffa..f26d796e52b55ca6f6ac702c41ea5655b54a147c 100644 (file)
@@ -612,7 +612,7 @@ parallel_vacuum_process_all_indexes(ParallelVacuumState *pvs, int num_index_scan
                Assert(indstats->status == PARALLEL_INDVAC_STATUS_INITIAL);
                indstats->status = new_status;
                indstats->parallel_workers_can_process =
-                       (pvs->will_parallel_vacuum[i] &
+                       (pvs->will_parallel_vacuum[i] &&
                         parallel_vacuum_index_is_parallel_safe(pvs->indrels[i],
                                                                                                        num_index_scans,
                                                                                                        vacuum));