Re: Refactor UnpinBuffer() - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Refactor UnpinBuffer()
Date
Msg-id CAJ7c6TPMDutnzi+cVaPzDbgeOZz+AFULkGgUO4i1wAAZg4+SWw@mail.gmail.com
Whole thread Raw
In response to Re: Refactor UnpinBuffer()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Refactor UnpinBuffer()
List 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



pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: [patch] \g with multiple result sets and \watch with copy queries
Next
From: Bharath Rupireddy
Date:
Subject: Re: Generalize ereport_startup_progress infrastructure