aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/heapam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r--src/backend/access/heap/heapam.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index e283fe5b1f5..e61dd771d0c 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -1525,25 +1525,6 @@ heap_rescan(HeapScanDesc scan,
* reinitialize scan descriptor
*/
initscan(scan, key, true);
-
- /*
- * reset parallel scan, if present
- */
- if (scan->rs_parallel != NULL)
- {
- ParallelHeapScanDesc parallel_scan;
-
- /*
- * Caller is responsible for making sure that all workers have
- * finished the scan before calling this, so it really shouldn't be
- * necessary to acquire the mutex at all. We acquire it anyway, just
- * to be tidy.
- */
- parallel_scan = scan->rs_parallel;
- SpinLockAcquire(&parallel_scan->phs_mutex);
- parallel_scan->phs_cblock = parallel_scan->phs_startblock;
- SpinLockRelease(&parallel_scan->phs_mutex);
- }
}
/* ----------------
@@ -1641,6 +1622,25 @@ heap_parallelscan_initialize(ParallelHeapScanDesc target, Relation relation,
}
/* ----------------
+ * heap_parallelscan_reinitialize - reset a parallel scan
+ *
+ * Call this in the leader process. Caller is responsible for
+ * making sure that all workers have finished the scan beforehand.
+ * ----------------
+ */
+void
+heap_parallelscan_reinitialize(ParallelHeapScanDesc parallel_scan)
+{
+ /*
+ * It shouldn't be necessary to acquire the mutex here, but we do it
+ * anyway, just to be tidy.
+ */
+ SpinLockAcquire(&parallel_scan->phs_mutex);
+ parallel_scan->phs_cblock = parallel_scan->phs_startblock;
+ SpinLockRelease(&parallel_scan->phs_mutex);
+}
+
+/* ----------------
* heap_beginscan_parallel - join a parallel scan
*
* Caller must hold a suitable lock on the correct relation.