Skip to content

Commit 0d32511

Browse files
author
Amit Kapila
committed
Fix comments in heapam.c.
After commits 85f6b49 and 3ba59cc, we can allow parallel inserts which was earlier not possible as parallel group members won't conflict for relation extension and page lock. In those commits, we forgot to update comments at few places. Author: Amit Kapila Reviewed-by: Robert Haas and Dilip Kumar Backpatch-through: 13 Discussion: https://postgr.es/m/CAFiTN-tMrQh5FFMPx5aWJ+1gi1H6JxktEhq5mDwCHgnEO5oBkA@mail.gmail.com
1 parent e5209bf commit 0d32511

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/backend/access/heap/heapam.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,12 +2044,10 @@ heap_prepare_insert(Relation relation, HeapTuple tup, TransactionId xid,
20442044
CommandId cid, int options)
20452045
{
20462046
/*
2047-
* Parallel operations are required to be strictly read-only in a parallel
2048-
* worker. Parallel inserts are not safe even in the leader in the
2049-
* general case, because group locking means that heavyweight locks for
2050-
* relation extension or GIN page locks will not conflict between members
2051-
* of a lock group, but we don't prohibit that case here because there are
2052-
* useful special cases that we can safely allow, such as CREATE TABLE AS.
2047+
* To allow parallel inserts, we need to ensure that they are safe to be
2048+
* performed in workers. We have the infrastructure to allow parallel
2049+
* inserts in general except for the cases where inserts generate a new
2050+
* CommandId (eg. inserts into a table having a foreign key column).
20532051
*/
20542052
if (IsParallelWorker())
20552053
ereport(ERROR,
@@ -5725,10 +5723,10 @@ heap_inplace_update(Relation relation, HeapTuple tuple)
57255723
uint32 newlen;
57265724

57275725
/*
5728-
* For now, parallel operations are required to be strictly read-only.
5729-
* Unlike a regular update, this should never create a combo CID, so it
5730-
* might be possible to relax this restriction, but not without more
5731-
* thought and testing. It's not clear that it would be useful, anyway.
5726+
* For now, we don't allow parallel updates. Unlike a regular update,
5727+
* this should never create a combo CID, so it might be possible to relax
5728+
* this restriction, but not without more thought and testing. It's not
5729+
* clear that it would be useful, anyway.
57325730
*/
57335731
if (IsInParallelMode())
57345732
ereport(ERROR,

0 commit comments

Comments
 (0)