Re: Forget close an open relation in ReorderBufferProcessTXN()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Forget close an open relation in ReorderBufferProcessTXN()
Date: 2021-04-15 17:26:52
Message-ID: 3794491.1618507612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> On Thu, Apr 15, 2021 at 4:00 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
>>
>> The RelationIdGetRelation() comment says:
>>
> Caller should eventually decrement count. (Usually,
> that happens by calling RelationClose().)
>>
>> However, it doesn't do it in ReorderBufferProcessTXN().
>> I think we should close it, here is a patch that fixes it. Thoughts?
>>

> +1. Your fix looks correct to me but can we test it in some way?

I think this code has a bigger problem: it should not be using
RelationIdGetRelation and RelationClose directly. 99.44% of
the backend goes through relation_open or one of the other
relation.c wrappers, so why doesn't this?

Possibly the answer is "it copied the equally misguided code
in pgoutput.c". A quick grep shows nothing else doing it this
way.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Coleman 2021-04-15 17:35:59 Re: "could not find pathkey item to sort" for TPC-DS queries 94-96
Previous Message Alvaro Herrera 2021-04-15 17:23:13 Re: Converting contrib SQL functions to new style