Re: [PATCH] Fix Proposal - Deadlock Issue in Single User Mode When IOFailure Occurs - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [PATCH] Fix Proposal - Deadlock Issue in Single User Mode When IOFailure Occurs
Date
Msg-id CAA4eK1Liy7pPkeMu8m7wvztCq4aC+CfHRe3e0c8iz1W4cJLCBw@mail.gmail.com
Whole thread Raw
In response to [PATCH] Fix Proposal - Deadlock Issue in Single User Mode When IOFailure Occurs  (Chengchao Yu <chengyu@microsoft.com>)
Responses Re: [PATCH] Fix Proposal - Deadlock Issue in Single User Mode When IOFailure Occurs  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
On Sat, Dec 1, 2018 at 2:30 AM Chengchao Yu <chengyu@microsoft.com> wrote:
>
>
> Recently, we hit a few occurrences of deadlock when IO failure (including disk full, random remote disk IO failures)
happensin single user mode. We found the issue exists on both Linux and Windows in multiple postgres versions. 
>
>
> 3.       Because the unable to write relation data scenario is difficult to hit naturally even reserved space is
turnedoff, I have prepared a small patch (see attachment “emulate-error.patch”) to force an error when PG tries to
writedata to relation files. We can just apply the patch and there is no need to put efforts flooding data to disk any
more.
>
>

I have one question related to the way you have tried to emulate the error.

@@ -840,6 +840,10 @@ mdwrite(SMgrRelation reln, ForkNumber forknum,
BlockNumber blocknum,
nbytes,
BLCKSZ);
+ ereport(ERROR,
+ (errcode(ERRCODE_INTERNAL_ERROR),
+ errmsg("Emulate exception in mdwrite() when writing to disk")));
+

We generally reserve the space in a relation before attempting to
write, so not sure how you are able to hit the disk full situation via
mdwrite.  If you see the description of the function, that also
indicates same.

/*
 * mdwrite() -- Write the supplied block at the appropriate location.
 *
 * This is to be used only for updating already-existing blocks of a
 * relation (ie, those before the current EOF).  To extend a relation,
 * use mdextend().
 */

I am not telling that mdwrite can never lead to error, but just trying
to understand the issue you actually faced.  I haven't read your
proposed solution yet, let's first try to establish the problem you
are facing.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: jsonpath
Next
From: Andrew Gierth
Date:
Subject: Re: pg_stat_statements vs. SELECT FOR UPDATE