[PATCH] Remove unused PageIsPredicateLocked()

Started by Aleksander Alekseev2 months ago8 messageshackers
Jump to latest
#1Aleksander Alekseev
aleksander@tigerdata.com

Hi,

The proposed patch removes dead code in src/backend/storage/lmgr/predicate.c

If my understanding is correct, PageIsPredicateLocked() was added in
dafaa3efb75 (Feb 2011) but its call was removed in 47ad79122bc (Mar
2011) and we have never used it since. It was mentioned in one recent
discussion [1]/messages/by-id/CA+COZaBo+ZpKgMvxcdACUjNtdYipe9Em06iX5KHLTVaTmFibiw@mail.gmail.com but it was pointed out that it can't be used there
either.

If anyone believes that we should keep it alternatively we could cover
it with tests or at least add an Assert() somewhere.

[1]: /messages/by-id/CA+COZaBo+ZpKgMvxcdACUjNtdYipe9Em06iX5KHLTVaTmFibiw@mail.gmail.com

--
Best regards,
Aleksander Alekseev

Attachments:

t253811_1
v1-0001-Remove-unused-PageIsPredicateLocked.patchtext/x-patch; charset=US-ASCII; name=v1-0001-Remove-unused-PageIsPredicateLocked.patchDownload+0-44
#2Matthias van de Meent
boekewurm+postgres@gmail.com
In reply to: Aleksander Alekseev (#1)
Re: [PATCH] Remove unused PageIsPredicateLocked()

On Wed, 16 Sept 2026 at 15:23, Aleksander Alekseev
<aleksander@tigerdata.com> wrote:

Hi,

The proposed patch removes dead code in src/backend/storage/lmgr/predicate.c

If my understanding is correct, PageIsPredicateLocked() was added in
dafaa3efb75 (Feb 2011) but its call was removed in 47ad79122bc (Mar
2011) and we have never used it since. It was mentioned in one recent
discussion [1] but it was pointed out that it can't be used there
either.

If anyone believes that we should keep it alternatively we could cover
it with tests or at least add an Assert() somewhere.

I'm fine with removing it, for reasons including because its signature
promise wasn't ever truly clear.

-Matthias

#3Pierre Forstmann
pierre.forstmann@gmail.com
In reply to: Matthias van de Meent (#2)
Re: [PATCH] Remove unused PageIsPredicateLocked()

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not tested

Hello,

This patch looks good to me using master commit e73841ffbceea314cf9fa3f64a5eae9f87a46449.

doxygen.postgresql.org shows no reference for this routine.
Searching this routine in whole source code returns no match.

There is neither need to check SQL compliance not to update documentation.

Regards,
PF.

The new status of this patch is: Ready for Committer

#4solai v
solai.cdac@gmail.com
In reply to: Aleksander Alekseev (#1)
Re: [PATCH] Remove unused PageIsPredicateLocked()

Hi all,

On Tue, Sep 22, 2026 at 10:28 AM Aleksander Alekseev
<aleksander@tigerdata.com> wrote:

Hi,

The proposed patch removes dead code in src/backend/storage/lmgr/predicate.c

If my understanding is correct, PageIsPredicateLocked() was added in
dafaa3efb75 (Feb 2011) but its call was removed in 47ad79122bc (Mar
2011) and we have never used it since. It was mentioned in one recent
discussion [1] but it was pointed out that it can't be used there
either.

If anyone believes that we should keep it alternatively we could cover
it with tests or at least add an Assert() somewhere.

[1]: /messages/by-id/CA+COZaBo+ZpKgMvxcdACUjNtdYipe9Em06iX5KHLTVaTmFibiw@mail.gmail.com

--

Thank you for the patch. I tested the patch and verified that the
changes are limited to removing the function implementation and its
declaration. I also find this to be a relevant cleanup and have
confirmed that no references to PageIsPredicateLocked() remain in the
source tree. Then I ran make check-world and git diff --check, which
passed successfully without any issues. There are no functional issues
with the patch and it looks good to me.

Regards,
Solai

#5Fujii Masao
masao.fujii@gmail.com
In reply to: solai v (#4)
Re: [PATCH] Remove unused PageIsPredicateLocked()

On Tue, Sep 22, 2026 at 5:54 PM solai v <solai.cdac@gmail.com> wrote:

There are no functional issues
with the patch and it looks good to me.

The patch looks good to me as well. Barring any objections, I will
commit it.

Regards,

--
Fujii Masao

#6Fujii Masao
masao.fujii@gmail.com
In reply to: Fujii Masao (#5)
Re: [PATCH] Remove unused PageIsPredicateLocked()

On Thu, Oct 22, 2026 at 9:44 PM Fujii Masao <masao.fujii@gmail.com> wrote:

On Tue, Sep 22, 2026 at 5:54 PM solai v <solai.cdac@gmail.com> wrote:

There are no functional issues
with the patch and it looks good to me.

The patch looks good to me as well. Barring any objections, I will
commit it.

BTW, while removing PageIsPredicateLocked(), I found that the
"INTERFACE ROUTINES" comment in predicate.c is outdated. For example,
it lists RegisterPredicateLockingXid(void), although the function takes
a TransactionId, and omits functions such as
CheckForSerializableConflictOutNeeded() and ShareSerializableXact().

Rather than updating the list, isn't it better to remove it? The declarations
are already available in the headers predicate.h, and maintaining
a duplicate list seems likely to result in further omissions and
outdated signatures.

Thought?

Regards,

--
Fujii Masao

Attachments:

nocfbot-0002-Remove-the-redundant-interface-list-and-fix-funct.patchapplication/octet-stream; name=nocfbot-0002-Remove-the-redundant-interface-list-and-fix-funct.patchDownload+2-43
#7Aleksander Alekseev
aleksander@tigerdata.com
In reply to: Fujii Masao (#6)
Re: [PATCH] Remove unused PageIsPredicateLocked()

Hi,

Thanks for the attention to the patch.

The patch looks good to me as well. Barring any objections, I will
commit it.

BTW, while removing PageIsPredicateLocked(), I found that the
"INTERFACE ROUTINES" comment in predicate.c is outdated. For example,
it lists RegisterPredicateLockingXid(void), although the function takes
a TransactionId, and omits functions such as
CheckForSerializableConflictOutNeeded() and ShareSerializableXact().

Rather than updating the list, isn't it better to remove it? The declarations
are already available in the headers predicate.h, and maintaining
a duplicate list seems likely to result in further omissions and
outdated signatures.

Thought?

Sounds good to me.

--
Best regards,
Aleksander Alekseev

#8Fujii Masao
masao.fujii@gmail.com
In reply to: Aleksander Alekseev (#7)
Re: [PATCH] Remove unused PageIsPredicateLocked()

On Fri, Oct 23, 2026 at 10:42 PM Aleksander Alekseev
<aleksander@tigerdata.com> wrote:

Sounds good to me.

I've pushed both patches. Thanks!

Regards,

--
Fujii Masao