Re: Unit tests for SLRU
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2022-03-31T18:24:05Z
Lists: 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/
Commits
-
Add test module for SLRUs
- 006b69fd912b 16.0 landed
-
Fix comment of SimpleLruInit() in slru.c
- 9e0321135cae 14.7 landed
- 5962c8cbe5a6 15.2 landed
- 5ca3645cb3fb 16.0 landed