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

2010-01-20 Thread Tom Lane
Heikki Linnakangas heikki.linnakan...@enterprisedb.com 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;

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

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

2010-01-20 Thread Heikki Linnakangas
Tom Lane wrote: Heikki Linnakangas heikki.linnakan...@enterprisedb.com 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;

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

2010-01-20 Thread Tom Lane
Heikki Linnakangas heikki.linnakan...@enterprisedb.com 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()

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

2010-01-20 Thread Heikki Linnakangas
Tom Lane wrote: Heikki Linnakangas heikki.linnakan...@enterprisedb.com 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

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 heikki.linnakan...@enterprisedb.com writes: My point is that we should replace such polling loops with something non-polling, using wait/signal or semaphores or something. That gets

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

2010-01-20 Thread Tom Lane
David Fetter da...@fetter.org 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