Re: Unit tests for SLRU - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Unit tests for SLRU
Date
Msg-id 6580B85C-7A6B-4E2B-B780-65D8CAC2153F@yesql.se
Whole thread Raw
In response to Unit tests for SLRU  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers
> On 31 Mar 2022, at 16:30, Aleksander Alekseev <aleksander@timescale.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/




pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations
Next
From: Andrew Dunstan
Date:
Subject: Re: pgsql: Add 'basebackup_to_shell' contrib module.