I think this patch needs to be revisited in the light of the work I just did to make pgstats correctly track the effects of aborted transactions. It seems fairly likely to me that most of the problem you were seeing was actually due to that stupidity, and not to race conditions between VACUUM and concurrent transactions. So maybe we no longer need to do anything.
It might be worth fixing things so that a VACUUM sets n_dead_tuples to the number of deleted-but-not-removable tuples it saw, rather than always setting to zero as is presently done. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend