Re: Refactor UnpinBuffer()

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Zhang Mingli <zmlpostgres(at)gmail(dot)com>
Subject: Re: Refactor UnpinBuffer()
Date: 2022-09-29 11:47:51
Message-ID: CAJ7c6TPMDutnzi+cVaPzDbgeOZz+AFULkGgUO4i1wAAZg4+SWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-09-29 11:57:54 Re: Generalize ereport_startup_progress infrastructure
Previous Message Daniel Verite 2022-09-29 11:10:43 [patch] \g with multiple result sets and \watch with copy queries