Re: WIP: extensible enums

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WIP: extensible enums
Дата
Msg-id 13145.1287343029@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: WIP: extensible enums  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: WIP: extensible enums  (Andrew Dunstan <andrew@dunslane.net>)
Re: WIP: extensible enums  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 17 October 2010 18:53, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> We could fix that with Dean's idea of reloading the cache whenever
>> we see that we are being asked to compare a value we don't have in the
>> cache entry. �However, that assumes that we even notice that it's not
>> in the cache entry. �If we're trying to use "fast" comparison then we
>> wouldn't notice that.

> That makes me think maybe the "fast" and "slow" comparisons should
> both be done the same way, having a cache so that we notice
> immediately if we get a new value.

Actually ... the race conditions can be a lot worse than just a race.
Consider
begin;alter type myenum add 'some-value';insert into mytab values('some-value');rollback;

If mytab has an index on the enum col, we now have an index entry that
contains an enum value that isn't valid according to anybody, and nobody
knows how to compare it.  If that entry is near the root then the index
is hopelessly corrupt: no one can tell which way to descend when
comparing it to some valid value.

I think what this says is that we cannot allow any manipulations that
involve an uncommitted enum value.  Probably the easiest way is to make
the ALTER TYPE operation disallowed-inside-transaction-block.  That's
pretty ugly, but doesn't seem like a serious restriction in practice
(though for example it'd mean we couldn't use it in pg_dump).

I'm not sure if enforcing such a restriction helps much in terms of
managing cache invalidations.  Even with that, it seems possible to
encounter index entries for values that you haven't yet noticed the
invalidation message for.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Floating-point timestamps versus Range Types
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Fate of the old cvs repository