[Pgpool-hackers] Concurrent BackendInfo read/write access

Tatsuo Ishii ishii at sraoss.co.jp
Wed Sep 3 09:04:49 UTC 2008


> Hello,
> 
> I'm looking at the source code for PGPool II 2.1. And I have a question
> regarding concurrent read/write access to the BackendInfo structure in
> shared memory. There are calls like VALID_BACKEND(i) or
> BACKEND_INFO(i).backend_status = CON_DOWN, which seem to be called
> concurrently without holding any mutexes. It seems that setting the
> backend_status is ok, since it's an enum and is an atomic operation.
> However, VALID_BACKEND() isn't really an atomic operation, but may still be
> ok:
> 
> ((BACKEND_INFO(backend_id).backend_status == CON_UP) || \
> (BACKEND_INFO(backend_id).backend_status == CON_CONNECT_WAIT))
> A bigger issue seems to be that without the use of mutexes or semaphores,
> how does PGPool guarantee the memory state for the backend status is
> consistent across different processor cores?

Actually semaphores are used. Try to grep pool_semaphore_lock etc.
--
Tatsuo Ishii
SRA OSS, Inc. Japan


More information about the Pgpool-hackers mailing list