forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb39630f
committed
Fix access to no-longer-open relcache entry in logical-rep worker.
If we redirected a replicated tuple operation into a partition childtable, and then tried to fire AFTER triggers for that event, therelation cache entry for the child table was already closed. This hasno visible ill effects as long as the entry is still there and stillvalid, but an unluckily-timed cache flush could result in a crash orother misbehavior.To fix, postpone the ExecCleanupTupleRouting call (which is whatcloses the child table) until after we've fired triggers. Thisrequires a bit of refactoring so that the cleanup function canhave access to the necessary state.In HEAD, I took the opportunity to simplify some of worker.c'sfunction APIs based on use of the new ApplyExecutionData struct.However, it doesn't seem safe/practical to back-patch that aspect,at least not without a lot of analysis of possible interactionswitha04daa9.In passing, add an Assert to afterTriggerInvokeEvents to catchsuch cases. This seems worthwhile because we've grown a numberof fairly unstructured ways of calling AfterTriggerEndQuery.Back-patch to v13, where worker.c grew the ability to deal withpartitioned target tables.Discussion:https://postgr.es/m/3382681.1621381328@sss.pgh.pa.us1 parent7ce7d07 commitb39630f
2 files changed
+129
-78
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4219 | 4219 |
| |
4220 | 4220 |
| |
4221 | 4221 |
| |
| 4222 | + | |
| 4223 | + | |
4222 | 4224 |
| |
4223 | 4225 |
| |
4224 | 4226 |
| |
|
0 commit comments
Comments
(0)