Small race in pg_xlogdump --follow - Mailing list pgsql-hackers

From Magnus Hagander
Subject Small race in pg_xlogdump --follow
Date
Msg-id CABUevEyHuA=v+xPsvkXmPSVCbJn86Gz7P-zPfWa6Z1FBieevoA@mail.gmail.com
Whole thread Raw
Responses Re: Small race in pg_xlogdump --follow  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
When using pg_xlogdump in --follow mode, there is what I believe is a small race condition when files are switched.

If pg_xlogdump detects then end of one file (by looking at the record) it will immediately try to open the following file. If that file has not yet been created, it will fail with an error message saying it cannot open the file. But there's a race condition where the server has not had time to put the file in place.

Attached patch puts a retry loop around opening the file that retries for 5 seconds (which is excessive, but should be safe) in case the file is missing (and still fails out for other error messages of course).

Comments?

--
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: VACUUM's ancillary tasks
Next
From: Tom Lane
Date:
Subject: Re: Small race in pg_xlogdump --follow