(1) that mutex also protects something else and the existing comment is wrong, or
(2) the mutex should have been removed but the patch neglected to do so, or
(3) the mutex is still needed for some reason, in which case either (3a) the patch isn't actually safe or (3b) the patch needs comments to explain what the new synchronization model is.
Yes, you're absolutely right. And my first intention was to remove this mutex completely.
But in TransactionIdLimitedForOldSnapshots these variable is using conjointly. So, I'm not
sure, is it completely safe to remove mutex. Actually, removing mutex and switch to atomics
was my first choice. I've run all the tests and no problems were found. But, at that time I choose
to be more conservative. Anyway, here is the new variant.