Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Tom Lane
David Fetter writes: > On Wed, Jan 20, 2010 at 09:22:49PM +0200, Heikki Linnakangas wrote: >>> My point is that we should replace such polling loops with something >>> non-polling, using wait/signal or semaphores or something. > Is this a TODO yet? It hardly seems concrete enough for a TODO item

Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread David Fetter
On Wed, Jan 20, 2010 at 09:22:49PM +0200, Heikki Linnakangas wrote: > Tom Lane wrote: > > Heikki Linnakangas writes: > >> My point is that we should replace such polling loops with something > >> non-polling, using wait/signal or semaphores or something. That gets > >> quite a bit more complex. Yo

Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Heikki Linnakangas
Tom Lane wrote: > Heikki Linnakangas writes: >> My point is that we should replace such polling loops with something >> non-polling, using wait/signal or semaphores or something. That gets >> quite a bit more complex. You'd probably still have the loop, but >> instead of pg_usleep() you'd call som

Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Tom Lane
Heikki Linnakangas writes: > My point is that we should replace such polling loops with something > non-polling, using wait/signal or semaphores or something. That gets > quite a bit more complex. You'd probably still have the loop, but > instead of pg_usleep() you'd call some new primitive functi

Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Heikki Linnakangas
Tom Lane wrote: > Heikki Linnakangas writes: >> Streaming Replication introduces a few places with a polling pattern >> like this (in pseudocode): > >> while() >> { >> /* Check if variable in shared has advanced beoynd X */ >> SpinLockAcquire() >> localvar = sharedvar; >> SpinLockRelease(

Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Simon Riggs
On Wed, 2010-01-20 at 20:00 +0200, Heikki Linnakangas wrote: > Hot standby also has a polling loop where it waits for a > transaction a transaction to die, though I'm not sure if that can be > fit into the same model I prefer that in the context of HS because the Startup process is waiting for th

Re: Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Tom Lane
Heikki Linnakangas writes: > Streaming Replication introduces a few places with a polling pattern > like this (in pseudocode): > while() > { > /* Check if variable in shared has advanced beoynd X */ > SpinLockAcquire() > localvar = sharedvar; > SpinLockRelease() > if (localvar > X) >

Synchronization primitives (Was: Re: [HACKERS] An example of bugs for Hot Standby)

2010-01-20 Thread Heikki Linnakangas
Andres Freund wrote: > On Wednesday 20 January 2010 17:59:36 Tom Lane wrote: >> Andres Freund writes: >>> I realize its way too late in the cycle for that, but why dont we start >>> using some library for easy cross platform atomic ops? >> (1) there probably isn't one that does exactly what we wan