Re: unexpected data beyond EOF and character encoding - Mailing list pgsql-general

From Tom Lane
Subject Re: unexpected data beyond EOF and character encoding
Date
Msg-id 24872.1175094150@sss.pgh.pa.us
Whole thread Raw
In response to Re: unexpected data beyond EOF and character encoding  (Jaime Silvela <JSilvela@Bear.com>)
Responses Re: unexpected data beyond EOF and character encoding
List pgsql-general
Jaime Silvela <JSilvela@bear.com> writes:
> The kernel is Linux 2.6.5

2.6.5.what (give us full uname -a output please)?  On what hardware?
If memory serves, we had some reason to think that it only occurred on
specific 64-bit multi-CPU platforms, so I'm not just asking idly.
The error check was put in as a consequence of this thread:
http://archives.postgresql.org/pgsql-admin/2006-09/msg00250.php

> So I take it that this happens on the restore part, not the dump part then?

It's definitely a write failure not a read failure.  Per the code comments:

         * We get here only in the corner case where we are trying to extend
         * the relation but we found a pre-existing buffer marked BM_VALID.
         * This can happen because mdread doesn't complain about reads beyond
         * EOF --- which is arguably bogus, but changing it seems tricky ---
         * and so a previous attempt to read a block just beyond EOF could
         * have left a "valid" zero-filled buffer.  Unfortunately, we have
         * also seen this case occurring because of buggy Linux kernels that
         * sometimes return an lseek(SEEK_END) result that doesn't account for
         * a recent write.  In that situation, the pre-existing buffer would
         * contain valid data that we don't want to overwrite.  Since the
         * legitimate cases should always have left a zero-filled buffer,
         * complain if not PageIsNew.

            regards, tom lane

pgsql-general by date:

Previous
From: Jaime Silvela
Date:
Subject: Re: unexpected data beyond EOF and character encoding
Next
From: Tom Lane
Date:
Subject: Re: Slow sequential scans on one DB but not another; fragmentation?