RE: Shouldn't flush dirty buffers at shutdown ?

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема RE: Shouldn't flush dirty buffers at shutdown ?
Дата
Msg-id NDBBIJLOILGIKBGDINDFAEOHCEAA.Inoue@tpf.co.jp
обсуждение исходный текст
Ответ на Re: Shouldn't flush dirty buffers at shutdown ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Shouldn't flush dirty buffers at shutdown ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Tuesday, May 09, 2000 11:50 PM
> 
> "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?

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@tpf.co.jp 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vince Vielhaber
Дата:
Сообщение: MD5
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Shouldn't flush dirty buffers at shutdown ?