Commit 2746e5f
committed
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.1 parent 81624db commit 2746e5f
File tree
13 files changed
+928
-39
lines changed- src
- backend
- access/transam
- port
- replication
- storage/ipc
- include
- replication
- storage
- tools/msvc
13 files changed
+928
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27773 | 27773 | | |
27774 | 27774 | | |
27775 | 27775 | | |
| 27776 | + | |
| 27777 | + | |
| 27778 | + | |
| 27779 | + | |
| 27780 | + | |
| 27781 | + | |
| 27782 | + | |
27776 | 27783 | | |
27777 | 27784 | | |
27778 | 27785 | | |
| |||
29098 | 29105 | | |
29099 | 29106 | | |
29100 | 29107 | | |
29101 | | - | |
| 29108 | + | |
29102 | 29109 | | |
29103 | 29110 | | |
29104 | 29111 | | |
| |||
29722 | 29729 | | |
29723 | 29730 | | |
29724 | 29731 | | |
| 29732 | + | |
29725 | 29733 | | |
29726 | 29734 | | |
29727 | 29735 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
1700 | 1700 | | |
1701 | 1701 | | |
1702 | 1702 | | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
1703 | 1710 | | |
1704 | 1711 | | |
1705 | 1712 | | |
| |||
1841 | 1848 | | |
1842 | 1849 | | |
1843 | 1850 | | |
| 1851 | + | |
1844 | 1852 | | |
1845 | 1853 | | |
1846 | 1854 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
1025 | 1026 | | |
1026 | 1027 | | |
1027 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
1028 | 1036 | | |
1029 | 1037 | | |
1030 | 1038 | | |
| |||
2005 | 2013 | | |
2006 | 2014 | | |
2007 | 2015 | | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
2008 | 2023 | | |
2009 | 2024 | | |
2010 | 2025 | | |
| |||
2077 | 2092 | | |
2078 | 2093 | | |
2079 | 2094 | | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
2080 | 2102 | | |
2081 | 2103 | | |
2082 | 2104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
1067 | 1068 | | |
1068 | 1069 | | |
1069 | 1070 | | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1070 | 1078 | | |
1071 | 1079 | | |
1072 | 1080 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
0 commit comments