On 27 February 2016 at 01:23, Andres Freund <and...@anarazel.de> wrote:
> On 2016-02-27 01:16:34 +0000, Simon Riggs wrote: > > If the above is true, then the proposed fix wouldn't work either. > > > > No point in sending a cache invalidation message on the standby if you > > haven't also written WAL, since the catalog re-read would just see the > old > > row. > > > > heap_inplace_update() does write WAL, which blows away the starting > premise. > > I'm not following here. heap_inplace_update() indeed writes WAL, but it > does *NOT* (and may not) assign an xid. Thus we're not emitting the > relcache invalidation queued in DefineIndex(), as > RecordTransactionCommit() currently skips emitting a commit record if > there's no xid. OK. Surely then the fix is to make heap_inplace_update() assign an xid? That way any catalog change will always generate a commit record containing the invalidation that goes with the change. No need to fix up the breakage later. The other heap_insert|update|delete functions (and similar) all assign xid, so it is consistent for us to do that for inplace_update also. diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index f443742..94282a0 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -6022,6 +6022,7 @@ heap_abort_speculative(Relation relation, HeapTuple tuple) void heap_inplace_update(Relation relation, HeapTuple tuple) { + TransactionId xid = GetCurrentTransactionId(); Buffer buffer; Page page; OffsetNumber offnum; -- Simon Riggs http://www.2ndQuadrant.com/ <http://www.2ndquadrant.com/> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
consistent_xid_assignment_for_inplace.v1.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers