Re: Adding doubly linked list type which stores the number of items in the list
Aleksander Alekseev <aleksander@timescale.com>
From: Aleksander Alekseev <aleksander@timescale.com>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Cc: David Rowley <dgrowleyml@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: 2022-10-31T13:28:22Z
Lists: pgsql-hackers
Hi hackers,
> I will take another look at v3 tomorrow and probably mark it RfC.
I very much like the patch. While on it:
```
+static inline bool
+dclist_is_empty(dclist_head *head)
+{
+ Assert(dlist_is_empty(&head->dlist) == (head->count == 0));
+ return (head->count == 0);
+}
```
Should we consider const'ifying the arguments of the dlist_*/dclist_*
functions that don't change the arguments?
Additionally it doesn't seem that we have any unit tests for dlist /
dclist. Should we consider adding unit tests for them to
src/test/regress?
To clarify, IMO both questions are out of scope of this specific patch
and should be submitted separately.
--
Best regards,
Aleksander Alekseev
Commits
-
Add doubly linked count list implementation
- 7c335b7a2027 16.0 landed