"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