On Tue, Aug 18, 2020 at 3:22 AM Andres Freund <and...@anarazel.de> wrote: > > Hi, > > On 2020-08-17 14:05:37 +0300, Heikki Linnakangas wrote: > > On 14/04/2020 22:04, Teja Mupparti wrote: > > > Thanks Kyotaro and Masahiko for the feedback. I think there is a > > > consensus on the critical-section around truncate, > > > > +1 > > I'm inclined to think that we should do that independent of the far more > complicated fix for other related issues.
+1 If we had a critical section in RelationTruncate(), crash recovery would continue failing until the situation of the underlying file is recovered if a PANIC happens. The current comment in RelationTruncate() says it’s worse than the disease. But considering physical replication, as Andres mentioned, a failure to truncate the file after logging WAL is no longer a harmless failure. Also, the critical section would be necessary even if we reversed the order of truncation and dropping buffers and resolved the issue. So I agree to proceed with the patch that adds a critical section independent of fixing other related things discussed in this thread. If Teja seems not to work on this I’ll write the patch. Regards, -- Masahiko Sawada EnterpriseDB: https://www.enterprisedb.com/