Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ae9aba6

Browse files
Keep rd_newRelfilenodeSubid across overflow.
Teach RelationCacheInvalidate() to keep rd_newRelfilenodeSubid across rel cache message overflows, so that behaviour is now fully deterministic. Noah Misch
1 parent 42fa810 commit ae9aba6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/backend/utils/cache/relcache.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -2163,8 +2163,14 @@ RelationCacheInvalidate(void)
21632163
/* Must close all smgr references to avoid leaving dangling ptrs */
21642164
RelationCloseSmgr(relation);
21652165

2166-
/* Ignore new relations, since they are never cross-backend targets */
2167-
if (relation->rd_createSubid != InvalidSubTransactionId)
2166+
/*
2167+
* Ignore new relations; no other backend will manipulate them before
2168+
* we commit. Likewise, before replacing a relation's relfilenode, we
2169+
* shall have acquired AccessExclusiveLock and drained any applicable
2170+
* pending invalidations.
2171+
*/
2172+
if (relation->rd_createSubid != InvalidSubTransactionId ||
2173+
relation->rd_newRelfilenodeSubid != InvalidSubTransactionId)
21682174
continue;
21692175

21702176
relcacheInvalsReceived++;

0 commit comments

Comments
 (0)