Prev: Bloom filters bloom filters bloom filters
Next: [NOVICE] Python verison for build in config.pl (Win32)
From: Heikki Linnakangas on 20 Jan 2010 13:00 Andres Freund wrote: > On Wednesday 20 January 2010 17:59:36 Tom Lane wrote: >> Andres Freund <andres(a)anarazel.de> 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 want, works >> everywhere, and has the right license; >> (2) what actual gain would we get? We've already done the work. > That there might be some other instructions were interested in? > Like really atomic increment? This reminds me of something I've been pondering for some time: 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) break; /* Not yet. Sleep pg_usleep(100); } For example, startup process polls like that to wait for walreceiver to write & flush new WAL to be replayed. And in master, walsender polls like that for new WAL to be generated, so that it can be sent to standby. 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. That's OK for asynchronous replication, but unacceptable for synchronous mode. It would be nice to have a new synchronization primitive for that. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers |