Do not emit WAL record for FSM truncaton when unneeded. - Mailing list pgsql-hackers

From Kirill Reshke
Subject Do not emit WAL record for FSM truncaton when unneeded.
Date
Msg-id CALdSSPhhWpufHQAFT8bZXR_qQNmYNDEVUfJtKYXSNSUDOyeCgw@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi hackers!

While working on other matters, I noticed that the
`fsm_truncate_avail` function returns a bool parameter which is never
used.  This makes me think we can make an enhancement here. There are
basically two options:
1) make return type `void`
2) make use of return value.

I tried the second option. In FreeSpaceMapPrepareTruncateRel (the only
user of fsm_truncate_avail), we call fsm_truncate_avail and then
WAL-log FSM page changes.
Instead,  can use `fsm_truncate_avail ` return value to check if
WAL-logging can be skipped.
PFA with these changes.

Thoughts?

P.S. I did not make a POC of real-life scenarios when the FSM page is
unaltered by fsm_truncate_avail (yet). I wonder if there are such
scenarios. If there is none, option 1 should proceed IMHO.

-- 
Best regards,
Kirill Reshke

Attachment

pgsql-hackers by date:

Previous
From: Nico Williams
Date:
Subject: Re: [oauth] SASL mechanisms
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: meson and check-tests