Re: Refactor UnpinBuffer()
Aleksander Alekseev <aleksander@timescale.com>
From: Aleksander Alekseev <aleksander@timescale.com>
To: PostgreSQL Development <pgsql-hackers@postgresql.org>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Nathan Bossart <nathandbossart@gmail.com>,
Zhang Mingli <zmlpostgres@gmail.com>
Date: 2022-09-29T11:47:51Z
Lists: pgsql-hackers
Hi Bharath,
> Also, it looks like changing the order of GetPrivateRefCountEntry()
> and ResourceOwnerForgetBuffer() doesn't have any effect as they are
> independent, but do we want to actually do that if there's no specific
> reason?
If we keep the order as it is now the code will become:
```
ref = GetPrivateRefCountEntry(b, false);
Assert(ref != NULL);
ResourceOwnerForgetBuffer(CurrentResourceOwner, b);
Assert(ref->refcount > 0);
ref->refcount--;
if (ref->refcount == 0)
```
I figured it would not hurt to gather all the calls and Asserts
related to `ref` together. This is the only reason why I choose to
rearrange the order of the calls in the patch.
So, no strong opinion in this respect from my side. I'm fine with
keeping the existing order.
--
Best regards,
Aleksander Alekseev
Commits
-
Remove useless argument from UnpinBuffer()
- 65b158ae4e89 16.0 landed
-
Fix various shortcomings of the new PrivateRefCount infrastructure.
- 2d115e47c861 9.5.0 cited