Hi all,

I have wondered that md.c handles incomplete block(page)s
correctly.
Am I mistaken ?

1) _mdnblocks() takes the last incomplete block into account

2) mdextend() doesn't care about the existence of incomplete
    block(page)s.

3) In spite of 1)2),mdextend() does nothing when incomplete
    write occurs.

Comments ?

If I am right,I would provide a patch.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp

Tue, 28 Sep 1999 13:52:12 +0900
"Hiroshi Inoue" <Inoue@tpf.co.jp>
Recovery on incomplete write
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> I have wondered that md.c handles incomplete block(page)s
> correctly.
> Am I mistaken ?

I think you are right, and there may be some other trouble spots in that
file too.  I remember thinking that the code depended heavily on never
having a partial block at the end of the file.

But is it worth fixing?  The only way I can see for the file length
to become funny is if we run out of disk space part way through writing
a page, which seems unlikely...

			regards, tom lane

Tue, 28 Sep 1999 10:39:22 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Recovery on incomplete write 
> "Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> > I have wondered that md.c handles incomplete block(page)s
> > correctly.
> > Am I mistaken ?
> 
> I think you are right, and there may be some other trouble spots in that
> file too.  I remember thinking that the code depended heavily on never
> having a partial block at the end of the file.
> 
> But is it worth fixing?  The only way I can see for the file length
> to become funny is if we run out of disk space part way through writing
> a page, which seems unlikely...
> 

That is how he got started, the TODO item about running out of disk
space causing corrupted databases.  I think it needs a fix, if we can.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Tue, 28 Sep 1999 10:54:26 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Recovery on incomplete write

> -----Original Message-----
> From: Bruce Momjian [mailto:maillist@candle.pha.pa.us]
> Sent: Tuesday, September 28, 1999 11:54 PM
> To: Tom Lane
> Cc: Hiroshi Inoue; pgsql-hackers
> Subject: Re: [HACKERS] Recovery on incomplete write
>
>
> > "Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> > > I have wondered that md.c handles incomplete block(page)s
> > > correctly.
> > > Am I mistaken ?
> >
> > I think you are right, and there may be some other trouble spots in that
> > file too.  I remember thinking that the code depended heavily on never
> > having a partial block at the end of the file.
> >
> > But is it worth fixing?  The only way I can see for the file length
> > to become funny is if we run out of disk space part way through writing
> > a page, which seems unlikely...
> >
>
> That is how he got started, the TODO item about running out of disk
> space causing corrupted databases.  I think it needs a fix, if we can.
>

Maybe it isn't so difficult to fix.
I would provide a patch.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp


Wed, 29 Sep 1999 16:20:14 +0900
"Hiroshi Inoue" <Inoue@tpf.co.jp>
RE: [HACKERS] Recovery on incomplete write
Bruce Momjian wrote:

> >
> > I think you are right, and there may be some other trouble spots in that
> > file too.  I remember thinking that the code depended heavily on never
> > having a partial block at the end of the file.
> >
> > But is it worth fixing?  The only way I can see for the file length
> > to become funny is if we run out of disk space part way through writing
> > a page, which seems unlikely...
> >
>
> That is how he got started, the TODO item about running out of disk
> space causing corrupted databases.  I think it needs a fix, if we can.

It does corrupt the database (happened twice to me last week, I'm using the
current CVS version!). You can't even pg_dump the database - it stops in the
middle of a line.
And this happened just because some process went amok and stdout was written
to a file.

Christof



Wed, 29 Sep 1999 10:39:32 +0200
Christof Petig <christof.petig@wtal.de>
Re: [HACKERS] Recovery on incomplete write