Re: foreign key locks - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: foreign key locks
Date
Msg-id 20121127150734.GI4227@alvh.no-ip.org
Whole thread Raw
In response to Re: foreign key locks  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: foreign key locks - EvalPlanQual interactions  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera wrote:
> Here's version 24.

Old review emails still contains some items that didn't lead to any
changes.  I tried to keep close track of those.  To that list I add a
couple of things of my own.  Here they are, for those following along.
I welcome suggestions.


- Fix the multixact cache in multixact.c -- see mXactCacheEnt.

- ResetHintBitMulti() was removed; need to remove old XMAX_IS_MULTI somewhere; perhaps during HOT page pruning?

- EvalPlanQual and ExecLockRows maybe need a different overall locking strategy.  Right now follow_updates=false is
usedto avoid deadlocks. 

- Ensure multixact.c behaves sanely on wraparound.

- Is the case of a a non-key-update followed by a key-update actually handled when doing a heap_lock_tuple with mode =
LockTupleKeyShareand follow_updates = false? I don't really see how, so it seems to deserve at least a comment. 

- if oldestMultiXactId + db is set and then that database is dropped we seem to have a problem because
MultiXactAdvanceOldestwon't overwrite those values. Should probably use SetMultiXactIdLimit directly. 

- what stop multixacts only being filled out (i.e RecordNewMultiXact()) *after* the XLogInsert() *and* after a
MultiXactGetCheckptMulti()?Afaics MultiXactGenLock is not hold in CreateMultiXactId(). If we crash in that moment we
loosethe multixact data which now means potential data loss... 

- multixact member group data crossing 512 sector boundaries makes me uneasy (as its 5 bytes). I don't really see a
scenariowhere its dangerous, but ... Does anybody see a problem here? 

- there are quite some places that domultiStopLimit = multiWrapLimit - 100;if (multiStopLimit < FirstMultiXactId)
multiStopLimit-= FirstMultiXactId; 
 perhaps MultiXactIdAdvance and MultiXactIdRetreat macros are in order?

- not really padding, MultiXactStatus is 4bytes.../* * XXX Note: there's a lot of padding space in MultiXactMember.  We
could* find a more compact representation of this Xlog record -- perhaps all the * status flags in one XLogRecData,
thenall the xids in another one?  Not * clear that it's worth the trouble though. */ 

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Materialized views WIP patch
Next
From: Tom Lane
Date:
Subject: Re: Materialized views WIP patch