On Mon, 2007-03-05 at 11:39 -0500, Tom Lane wrote:
> "Simon Riggs" <[EMAIL PROTECTED]> writes:
> > The first function reads a single block from a file, returning the
> > complete page as a bytea of length BLCKSZ. 
> >  CREATE OR REPLACE FUNCTION bufpage_get_raw_page(text, int4)
> >  RETURNS bytea ...
> 
> Directly from the file?  What if the version in buffers is completely
> different? 

No, I was doing from shared buffers.

>  OTOH, if you try to pull from shared buffers then you won't
> be able to deal with corrupted pages, so I think you are claiming that
> the function can serve purposes that it can't really fulfill
> simultaneously.

Here's the code I was using... 
Is there validation in this path? I thought not, maybe I'm wrong. 

buf = ReadBuffer(rel, blkno);
{
        bufpage = BufferGetPage(buf);

        raw_page = (bytea *) palloc(BLCKSZ + VARHDRSZ);
        SET_VARSIZE(raw_page, BLCKSZ + VARHDRSZ);
        raw_page_data = VARDATA(raw_page);

        LockBuffer(buf, BUFFER_LOCK_SHARE);

        /* SnapshotEverything */
        {
                memcpy(raw_page_data, bufpage, BLCKSZ);
        }       
        LockBuffer(buf, BUFFER_LOCK_UNLOCK);
}
ReleaseBuffer(buf);


> As for putting it in core, we already had that discussion w.r.t. the
> adminpack functions, and you have not provided any argument adequate
> to override the concerns expressed about those.

The main point is to get a set of functions that can be used directly in
additional regression tests as well as diagnostics. ISTM we need to
*prove* HOT works, not just claim it. I'm very open to different
approaches as to how we might do this.

If we say these functions can't be used for block corruptions, thats
fine - that was just an additional point, not the main thought. I'll
still want a good way to produce regression tests that show HOT working
correctly.

-- 
  Simon Riggs             
  EnterpriseDB   http://www.enterprisedb.com



---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to