Re: Fix race condition in SSI when reading PredXact->SxactGlobalXmin - Mailing list pgsql-hackers

From Mihail Nikalayeu
Subject Re: Fix race condition in SSI when reading PredXact->SxactGlobalXmin
Date
Msg-id CADzfLwUFSdC38uES+dfOTUL=YSHxYnm66upLNUd7Zj29fvS9Lw@mail.gmail.com
Whole thread Raw
In response to Fix race condition in SSI when reading PredXact->SxactGlobalXmin  (Josh Curtis <jcurtis825@gmail.com>)
Responses Re: Fix race condition in SSI when reading PredXact->SxactGlobalXmin
List pgsql-hackers
Hello!

Josh Curtis <jcurtis825@gmail.com>:
> This is definitely a bit more complex. It requires that SetNewSxactGlobalXmin is never called when SxactGlobalXmin is
invalidto prevent readers from seeing an invalid transaction ID when they should see a valid one -- I think this is the
casenow since before SetNewSxactGlobalXmin is called postgres checks that PredXact->SxactGlobalXminCount > 0. I assume
thisentails that SxactGlobalXmin is valid, but I have not checked every place the two variables are modified. 

Such logic feels fragile to me. Maybe add a special flag like
'PredXact->SxactGlobalSkipAllowed' which will be updated to 'true' by
SetNewSxactGlobalXmin, and dropped to 'false' by functions affecting
PredXact->activeList?
But I prefer the first solution anyway.

Best regards,
Mikhail.



pgsql-hackers by date:

Previous
From: Sami Imseih
Date:
Subject: Re: Skip unregistered custom kinds on stats load
Next
From: Fujii Masao
Date:
Subject: Re: Suggestion to add --continue-client-on-abort option to pgbench