Re: Unit tests for SLRU

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: Unit tests for SLRU
Date: 2022-03-31 18:24:05
Message-ID: 6580B85C-7A6B-4E2B-B780-65D8CAC2153F@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 31 Mar 2022, at 16:30, Aleksander Alekseev <aleksander(at)timescale(dot)com> wrote:

Thanks for hacking on increasing test coverage!

> While on it, I moved the Asserts() outside of SimpleLruInit(). It didn't seem
> to be a right place to check the IsUnderPostmaster value, and complicated the
> test implementation.

+ *
+ * Returns false if the cache didn't exist before the call, true otherwise.
*/
-void
+bool
SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,

If we're changing the API to make it testable, that should be noted in the
comment and how the return value should be interpreted (and when it can be
ignored). It also doesn't seem all that appealing that SimpleLruInit can
return false on successful function invocation, it makes for a confusing API.

--
Daniel Gustafsson https://vmware.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-03-31 18:27:04 Re: pgsql: Add 'basebackup_to_shell' contrib module.
Previous Message Peter Geoghegan 2022-03-31 18:19:53 Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations