Re: Avoiding unnecessary writes during relation drop and truncate

Поиск
Список
Период
Сортировка
От Qingqing Zhou
Тема Re: Avoiding unnecessary writes during relation drop and truncate
Дата
Msg-id d1laou$2r5m$1@news.hub.org
обсуждение исходный текст
Ответ на Avoiding unnecessary writes during relation drop and truncate  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Avoiding unnecessary writes during relation drop and truncate  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes
> It strikes me that the FlushRelationBuffers call is unnecessary and
> causes useless I/O, namely writing out pages into a file that's
> about to be deleted anyway.  If we simply removed it then any buffers
> belonging to the victim relation would stay in memory until commit;
> then they'd be dropped *without* write by the smgr unlink operation
> (which already calls DropRelFileNodeBuffers).
>

In my understanding, DropRelFileNodeBuffers is done in post-commit stage.
The call sequences are:
...AtEOXact_Inval(true);
smgrDoPendingDeletes(true);...

What if AtEOXact_Inval() fails (though the chance is slim)? Does that mean
that smgrDoPendingDeletes() -> DropRelFileNodeBuffers can never get
executed, which means we can never "dropped without write" the buffers
belonging to the victim relation? So when the BgWrite sweeps, it will write
those buffers to a non-logically-existed file?

Regards,
Qingqing




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

Предыдущее
От: "Qingqing Zhou"
Дата:
Сообщение: Re: what to do with backend flowchart
Следующее
От: Greg Stark
Дата:
Сообщение: [Mail Delivery System ] Warning: message 1DAroW-0002DC-00 delayed 144 hours