Re: drop/truncate table sucks for large values of shared buffers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: drop/truncate table sucks for large values of shared buffers
Date
Msg-id 20856.1435508238@sss.pgh.pa.us
Whole thread Raw
In response to Re: drop/truncate table sucks for large values of shared buffers  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: drop/truncate table sucks for large values of shared buffers  (Amit Kapila <amit.kapila16@gmail.com>)
Re: drop/truncate table sucks for large values of shared buffers  (Robert Haas <robertmhaas@gmail.com>)
Re: drop/truncate table sucks for large values of shared buffers  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On 27 June 2015 at 15:10, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I don't like this too much because it will fail badly if the caller
>> is wrong about the maximum possible page number for the table, which
>> seems not exactly far-fetched.  (For instance, remember those kernel bugs
>> we've seen that cause lseek to lie about the EOF position?)

> If that is true, then our reliance on lseek elsewhere could also cause data
> loss, for example by failing to scan data during a seq scan.

The lseek point was a for-example, not the entire universe of possible
problem sources for this patch.  (Also, underestimating the EOF point in
a seqscan is normally not an issue since any rows in a just-added page
are by definition not visible to the scan's snapshot.  But I digress.)

> The consequences of failure of lseek in this case are nowhere near as dire,
> since by definition the data is being destroyed by the user.

I'm not sure what you consider "dire", but missing a dirty buffer
belonging to the to-be-destroyed table would result in the system being
permanently unable to checkpoint, because attempts to write out the buffer
to the no-longer-extant file would fail.  You could only get out of the
situation via a forced database crash (immediate shutdown), followed by
replaying all the WAL since the time of the problem.  In production
contexts that could be pretty dire.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: drop/truncate table sucks for large values of shared buffers
Next
From: Tatsuo Ishii
Date:
Subject: Re: Refactoring pgbench.c