Re: Unnecessary static variable?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unnecessary static variable?
Date: 2018-01-17 19:09:35
Message-ID: 13654.1516216175@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Antonin Houska <ah(at)cybertec(dot)at> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> At one time, I think, readLen told how much data in readBuf was
>> actually valid. It seems not to be used for that anymore, but
>> I don't much like the idea that readBuf is only partially filled
>> but there is *no* persistent state indicating how much is valid.
>> The existing coding guarantees that the answer is "XLOG_BLCKSZ",
>> so that's fine, but this change would remove the guarantee.

Oh, I withdraw that complaint --- readBuf isn't a persistent data
structure anymore, so there's no need for readLen to be persistent
either.

> XLogPageRead() is a callback of the XLOG reader and that passes reqLen telling
> how much data of the page is actually needed in readBuf at the moment. And the
> function checks that readLen is high enough:
> Assert(reqLen <= readLen);

Hm. Sure would be nice if there were any mention of reqLen in the
function's specification.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-01-17 19:23:18 Re: PostgreSQL crashes with SIGSEGV
Previous Message Tom Lane 2018-01-17 19:05:19 Re: [HACKERS] GnuTLS support