On 2014-07-20 19:37:15 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2014-07-20 19:11:40 -0400, Tom Lane wrote:
> >> I wonder whether we should change vac_update_relstats so that it only
> >> applies the "relminxid mustn't go backwards" rule as long as relminxid
> >> is sane, ie, not in the future. If it is in the future, forcibly update
> >> it to the cutoff we actually used. Likewise for relminmxid. And I guess
> >> we'd need a similar rule for updating datmin(m)xid.
>
> > I'm wondering the same. How would we do that from a concurreny POV for
> > the pg_database rows? I think we could just accept the race condition
> > that two xacts move dbform->datminmxid backwards to different values
> > since both have to be 'somewhat' correct?
>
> Seems no worse than it is today.
Well, right now it can only advance, never go backwards. I think. But it
don't see how it could matter - all the possible minimum values better
be correct.
> Is it even possible for two xacts to be trying to update that at the
> same time?
At least I don't see anything prohibiting it. vac_update_datfrozenxid()(
is called straight from vacuum()/do_autovacuum(). The only thing that'll
serialize that I can see is the buffer lock for the heap_inplace_update().
Seems odd from a concurrency perspective. Worth a look someday not too
far away.
> > I think this is out of the remit for 9.3.5. At least I don't have the
> > mental capacity to do this properly till tomorrow afternoon.
>
> Doesn't sound that hard to me (and I'm still reasonably awake, which
> I bet you're not).
I'm most definitely not awake, right ;). Especially as it's 32 °C in my
flat - at 2 in the morning...
> Will take a look.
Cool. Will take a look at the result tomorrow.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services