Please sign in to comment.
Introduce latches. A latch is a boolean variable, with the capability to
wait until it is set. Latches can be used to reliably wait until a signal arrives, which is hard otherwise because signals don't interrupt select() on some platforms, and even when they do, there's race conditions. On Unix, latches use the so called self-pipe trick under the covers to implement the sleep until the latch is set, without race conditions. On Windows, Windows events are used. Use the new latch abstraction to sleep in walsender, so that as soon as a transaction finishes, walsender is woken up to immediately send the WAL to the standby. This reduces the latency between master and standby, which is good. Preliminary work by Fujii Masao. The latch implementation is by me, with helpful comments from many people.
- Loading branch information...
Showing with 919 additions and 30 deletions.
- +9 −1 configure
- +8 −0 configure.in
- +22 −0 src/backend/access/transam/twophase.c
- +8 −0 src/backend/access/transam/xact.c
- +1 −1 src/backend/port/Makefile
- +435 −0 src/backend/port/unix_latch.c
- +284 −0 src/backend/port/win32_latch.c
- +75 −28 src/backend/replication/walsender.c
- +3 −0 src/backend/storage/ipc/ipci.c
- +3 −0 src/backend/storage/ipc/procsignal.c
- +8 −0 src/include/replication/walsender.h
- +62 −0 src/include/storage/latch.h
- +1 −0 src/tools/msvc/Mkvcbuild.pm
Oops, something went wrong.