On Fri, Jul 22, 2011 at 03:54:03PM -0400, Robert Haas wrote:
> On Fri, Jul 22, 2011 at 3:28 PM, Noah Misch <noah@2ndquadrant.com> wrote:
> > This is attractive, and I don't see any problems with it. (In theory, you could
> > hit a case where the load of resetState gives an ancient "false" just as the
> > counters wrap to match. Given that the wrap interval is 1000000x as long as the
> > reset interval, I'm not worried about problems on actual silicon.)
>
> It's actually 262,144 times as long - see MSGNUMWRAPAROUND.
Ah, so it is.
> It would be pretty easy to eliminate even the theoretical possibility
> of a race by getting rid of resetState altogether and using nextMsgNum
> = -1 to mean that. Maybe I should go ahead and do that.
Seems like a nice simplification.
--
Noah Misch http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services