Re: Red-black tree for GIN

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Red-black tree for GIN
Дата
Msg-id 407d949e1001101854o55464134u7092db9a8a5a3e82@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Red-black tree for GIN  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Mon, Jan 11, 2010 at 2:42 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> The coding pattern that this patch uses also merits some discussion.
> Basically, rbtree.c is a generic implementation of red-black trees -
> from a textbook - which ginbulk.c then uses for GIN.  One possible
> advantage of this implementation is that it might make it possible for
> us to use the rbtree.c logic in other places, if we have other data
> structures that need similar treatment.  But I'm not sure if that's
> the way we want to go.  The other alternative is to drop the
> generalized implementation and incorporate the logic directly into
> ginbulk.c.  I really don't know which is better, but I'd like to hear
> some other opinions...
>

So, code reuse is not the only advantage of abstraction. It's also
just plain easier to understand and test code written with clear
abstract interfaces. The way you describe it someone with no knowledge
could look at rbtree.c and see if it's done correctly and maybe
improve it. And someone reading ginbulk only has to understand the
operations red-black trees support and no understand how they're
implemented to follow the code.

Is there any advantage of integrating the code with ginbulk.c? Does it
let us get away with finer grained locks or do any tricks doing
gin-specific changes while we're in the middle of rebalancing or
anything like that?

--
greg


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Red-black tree for GIN
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: RADIUS authentication