Re: logtape.c stats don't account for unused "prefetched" block numbers

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: logtape.c stats don't account for unused "prefetched" block numbers
Date: 2020-09-14 22:58:08
Message-ID: CAH2-Wzn2PhgQNc9k+N3KHz=mRehmR0OmsGYPEsEQcfqDzdNQUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 14, 2020 at 3:39 PM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> I think that they are an exact match in practice (i.e. nBlocksWritten
> == nBlocksAllocated), given when and how we call
> LogicalTapeSetBlocks().

Just to be clear: this is only true for external sorts. The
preallocation stuff can make nBlocksAllocated quite a lot higher.
That's probably why adding a new "Assert(lts->nBlocksWritten ==
lts->nBlocksAllocated)" assertion fails during the regression tests,
though there might be other reasons as well (I'm thinking of the
LogicalTapeRewindForRead() inconsistency Jeff mentioned).

--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-09-14 23:03:14 Re: logtape.c stats don't account for unused "prefetched" block numbers
Previous Message Ranier Vilela 2020-09-14 22:57:32 Re: Simplified version of read_binary_file (src/backend/utils/adt/genfile.c)