Re: Avoiding unnecessary writes during relation drop and truncate - Mailing list pgsql-hackers

From Qingqing Zhou
Subject Re: Avoiding unnecessary writes during relation drop and truncate
Date
Msg-id d1laou$2r5m$1@news.hub.org
Whole thread Raw
In response to Avoiding unnecessary writes during relation drop and truncate  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Avoiding unnecessary writes during relation drop and truncate
List 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 by date:

Previous
From: "Qingqing Zhou"
Date:
Subject: Re: what to do with backend flowchart
Next
From: Greg Stark
Date:
Subject: [Mail Delivery System ] Warning: message 1DAroW-0002DC-00 delayed 144 hours