Fix contradictory comment for pgstat_slru_flush_cb()

Started by Shinya Kato1 day ago2 messageshackers
Jump to latest
#1Shinya Kato
shinya11.kato@gmail.com

Hi hackers,

The comment above pgstat_slru_flush_cb() in pgstat_slru.c describes
the return value twice, and the two descriptions contradict each
other:

/*
* Flush out locally pending SLRU stats entries
*
* If nowait is true, this function returns false on lock failure. Otherwise
* this function always returns true.
*
* If nowait is true, this function returns true if the lock could not be
* acquired. Otherwise return false.
*/

The first paragraph has the return value backwards. The function
returns true only when nowait is set and the lock could not be
acquired, and false otherwise, as the second paragraph correctly
states. The reversed paragraph is a leftover from f4d3ca421d9, which
removed an unrelated sentence but not the surrounding text.

The attached patch removes the incorrect first paragraph.

Thoughts?

--
Best regards,
Shinya Kato
NTT OSS Center

Attachments:

v1-0001-pgstat-Fix-return-value-comment-for-pgstat_slru_f.patchapplication/octet-stream; name=v1-0001-pgstat-Fix-return-value-comment-for-pgstat_slru_f.patchDownload+0-4
#2Michael Paquier
michael@paquier.xyz
In reply to: Shinya Kato (#1)
Re: Fix contradictory comment for pgstat_slru_flush_cb()

On Mon, Jun 22, 2026 at 10:00:58PM +0900, Shinya Kato wrote:

The first paragraph has the return value backwards. The function
returns true only when nowait is set and the lock could not be
acquired, and false otherwise, as the second paragraph correctly
states. The reversed paragraph is a leftover from f4d3ca421d9, which
removed an unrelated sentence but not the surrounding text.

The attached patch removes the incorrect first paragraph.

Looks like you are right here. Grabbed for later.
--
Michael