Re: Shouldn't flush dirty buffers at shutdown ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Shouldn't flush dirty buffers at shutdown ?
Date
Msg-id 12124.957883771@sss.pgh.pa.us
Whole thread Raw
In response to Shouldn't flush dirty buffers at shutdown ?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Responses RE: Shouldn't flush dirty buffers at shutdown ?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
List pgsql-hackers
"Hiroshi Inoue" <Inoue@tpf.co.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?  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.  We can legitimately assume that the tuple is uncommitted
and ignore the index entry --- we just have to not fail ;-)

Not sure how to do it offhand; maybe some additional checking in the
index fetch code will do?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Hiroshi Inoue"
Date:
Subject: Shouldn't flush dirty buffers at shutdown ?
Next
From: Tom Lane
Date:
Subject: Re: Commercializing PostgreSQL: What do you thing?