Re: how do I clear a page, or set an item in a page to - Mailing list pgsql-general

From Eric Parusel
Subject Re: how do I clear a page, or set an item in a page to
Date
Msg-id 423F2043.9090502@globalrelay.net
Whole thread Raw
In response to Re: how do I clear a page, or set an item in a page to 'free'?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: how do I clear a page, or set an item in a page to
Re: how do I clear a page, or set an item in a page to
List pgsql-general
Tom Lane wrote:
> Eric Parusel <lists@globalrelay.net> writes:
>
>>I've got a mucked up page in my db, and I can't complete a database dump
>>until a particular page is fixed/removed from the table. :(
>
> Zeroing the page is the most painless way.  dd from /dev/zero will get
> it done --- but note that you have to shut down the postmaster meanwhile
> to ensure Postgres will see your change.

ok, I can dd, if=/dev/zero of=base/dbnum/tablenum, but how do I figure
how where and how much to write over?
Is there an easy to see or calculate offset value for a particular page
number? (28393)

from pg_filedump:
Block 28393 ********************************************************
<Header> -----
  Block Offset: 0x0ddd2000         Offsets: Lower      56 (0x0038)
  Block: Size 8192  Version    2            Upper    1064 (0x0428)
  LSN:  logid    242 recoff 0x9387bd78      Special  8192 (0x2000)
  Items:    9                   Free Space: 1008
  Length (including item array): 60

So I could take the block offset, convert it from hex (to 232595456...
oh, /8192 = 28393 :) ), and the block size (which is default: 8192) to do:

dd if=/dev/zero of=base/17760/18804 obs=8192 seek=28393
?

Should I, or do I need to REINDEX after this?

If you could confirm that I answered my own question, that would be
great :)

Thanks,
Eric

pgsql-general by date:

Previous
From: Jay Guerette
Date:
Subject: Re: Copression
Next
From: Scott Marlowe
Date:
Subject: Re: how do I clear a page, or set an item in a page to