Re: WIP: extensible enums
От | Tom Lane |
---|---|
Тема | Re: WIP: extensible enums |
Дата | |
Msg-id | 11144.1287877942@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: WIP: extensible enums (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: WIP: extensible enums
|
Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes: > On Oct 23, 2010, at 7:12 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> I've been working through this patch. It occurs to me that there's a >> fairly serious problem with the current implementation of insertion of >> new values within the bounds of the current sort ordering. Namely, that >> it does that by reassigning the enumsortorder values of pre-existing >> rows. That creates a race condition: > It strikes me that this is merely one facet of our failure to do proper locking on DDL objects other than relations, andthat this would be as good a time as any to start fixing it. ISTM that ALTER TYPE should grab a self-excluding lock justas ALTER TABLE already does. The point of all the design thrashing we've been doing here is to *avoid* taking locks while comparing enum OIDs. So I'm not impressed with this proposal. (A self-exclusive lock to prevent concurrent ALTER TYPEs might be a good idea, but I don't want to block enum comparisons too.) I did just think of a possible solution that would work with the updating implementation: readers of pg_enum could use an MVCC snapshot instead of SnapshotNow while loading their caches. I'm not certain offhand how unpleasant this'd be at the C-code level, but it should be possible. I still prefer the idea of not changing rows once they're inserted, though --- doing so could possibly also cause transient failures in, eg, enum_in/enum_out, since those depend on syscaches that are loaded with SnapshotNow. regards, tom lane
В списке pgsql-hackers по дате отправления: