RE: Shouldn't flush dirty buffers at shutdown ?

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Shouldn't flush dirty buffers at shutdown ?
Date: 2000-05-09 17:14:43
Message-ID: NDBBIJLOILGIKBGDINDFAEOHCEAA.Inoue@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Tuesday, May 09, 2000 11:50 PM
>
> "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> writes:
> > if heap data wasn't flushed while corresponding indices
> > are written to disk,the indices would point to non-existence
> > heap block. It would be the cause of inconsistency after the
> > restart of postmaster. Shouldn't there be a mechanism to
> > flush dirty buffers at(or before) the shutdown of postmaster ?
>
> Hmm, good point, but that doesn't seem like the right answer.
> Suppose the system crashes before we are able to flush the
> dirty buffers?

You are right but we could hardly expect the completeness
of indexes in case of system crash because indexes are out
of transactional control currently. What surprized me was that
such problems could easily occur even in case of graceful
shutdown of postmaster.

> I think you have identified a problem that needs
> a more general solution: we need to be robust in the case that
> an index entry is on disk that points to a tuple that never made
> it to disk.

Probably an index entry that points to a non-existent heap
block doesn't cause a problem immediately because heap_
fetch() ignores UNUSED heap blocks.
However it will not be long before the heap block is filled with
another tuple. heap_insert/update() could hardly check that
the inserting heap block is already pointed from some index
entry.

There could be another case which I came across while
testing vacuum abort. i.e,index_delete() wasn't flushed while
the corresponding heap block is cleaned(set to UNUSED)
and flushed.

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-05-09 17:20:07 Re: Shouldn't flush dirty buffers at shutdown ?
Previous Message Vince Vielhaber 2000-05-09 17:03:52 MD5