Adding doubly linked list type which stores the number of items in the list

Поиск
Список
Период
Сортировка
От David Rowley
Тема Adding doubly linked list type which stores the number of items in the list
Дата
Msg-id CAApHDvrtVxr+FXEX0VbViCFKDGxA3tWDgw9oFewNXCJMmwLjLg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Adding doubly linked list type which stores the number of items in the list  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
As part of the AIO work [1], there are quite a number of dlist_heads
which a counter is used to keep track on how many items are in the
list.  We also have a few places in master which do the same thing.

In order to tidy this up and to help ensure that the count variable
does not get out of sync with the items which are stored in the list,
how about we introduce "dclist" which maintains the count for us?

I've attached a patch which does this.  The majority of the functions
for the new type are just wrappers around the equivalent dlist
function.

dclist provides all of the functionality that dlist does except
there's no dclist_delete() function.  dlist_delete() can be done by
just knowing the element to delete and not the list that the element
belongs to.  With dclist, that's not possible as we must also subtract
1 from the count variable and obviously we need the dclist_head for
that.

I'll add this to the November commitfest.

David

[1] https://www.postgresql.org/message-id/flat/20210223100344.llw5an2aklengrmn@alap3.anarazel.de

Вложения

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

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: [PoC] Improve dead tuple storage for lazy vacuum
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Allow file inclusion in pg_hba and pg_ident files