Commit c6ff84b
committed
Emit invalidations to standby for transactions without xid.
So far, when a transaction with pending invalidations, but without an
assigned xid, committed, we simply ignored those invalidation
messages. That's problematic, because those are actually sent for a
reason.
Known symptoms of this include that existing sessions on a hot-standby
replica sometimes fail to notice new concurrently built indexes and
visibility map updates.
The solution is to WAL log such invalidations in transactions without an
xid. We considered to alternatively force-assign an xid, but that'd be
problematic for vacuum, which might be run in systems with few xids.
Important: This adds a new WAL record, but as the patch has to be
back-patched, we can't bump the WAL page magic. This means that standbys
have to be updated before primaries; otherwise
"PANIC: standby_redo: unknown op code 32" errors can be encountered.
XXX:
Reported-By: Васильев Дмитрий, Masahiko Sawada
Discussion:
CAB-SwXY6oH=9twBkXJtgR4UC1NqT-vpYAtxCseME62ADwyK5OA@mail.gmail.com
CAD21AoDpZ6Xjg=gFrGPnSn4oTRRcwK1EBrWCq9OqOHuAcMMC=w@mail.gmail.com1 parent 2ac3be2 commit c6ff84bCopy full SHA for c6ff84b
File tree
Expand file treeCollapse file tree
10 files changed
+181
-48
lines changedOpen diff view settings
Filter options
- src
- backend
- access
- rmgrdesc
- transam
- replication/logical
- storage/ipc
- utils/cache
- include
- replication
- storage
Expand file treeCollapse file tree
10 files changed
+181
-48
lines changedOpen diff view settings
Collapse file
src/backend/access/rmgrdesc/standbydesc.c
Copy file name to clipboardExpand all lines: src/backend/access/rmgrdesc/standbydesc.c+54Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
58 | 58 | |
59 | 59 | |
60 | 60 | |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
61 | 69 | |
62 | 70 | |
63 | 71 | |
| ||
73 | 81 | |
74 | 82 | |
75 | 83 | |
| 84 | + |
| 85 | + |
| 86 | + |
76 | 87 | |
77 | 88 | |
78 | 89 | |
79 | 90 | |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
Collapse file
src/backend/access/rmgrdesc/xactdesc.c
Copy file name to clipboardExpand all lines: src/backend/access/rmgrdesc/xactdesc.c+4-26Lines changed: 4 additions & 26 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
| 21 | + |
21 | 22 | |
22 | 23 | |
23 | 24 | |
| ||
203 | 204 | |
204 | 205 | |
205 | 206 | |
206 | | - |
207 | | - |
208 | | - |
209 | | - |
210 | | - |
211 | | - |
212 | | - |
213 | | - |
214 | | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
| 207 | + |
| 208 | + |
| 209 | + |
232 | 210 | |
233 | 211 | |
234 | 212 | |
|
Collapse file
src/backend/access/transam/xact.c
Copy file name to clipboardExpand all lines: src/backend/access/transam/xact.c+18Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1163 | 1163 | |
1164 | 1164 | |
1165 | 1165 | |
| 1166 | + |
| 1167 | + |
| 1168 | + |
| 1169 | + |
| 1170 | + |
| 1171 | + |
| 1172 | + |
| 1173 | + |
| 1174 | + |
| 1175 | + |
| 1176 | + |
| 1177 | + |
| 1178 | + |
| 1179 | + |
| 1180 | + |
| 1181 | + |
| 1182 | + |
| 1183 | + |
1166 | 1184 | |
1167 | 1185 | |
1168 | 1186 | |
|
Collapse file
src/backend/replication/logical/decode.c
Copy file name to clipboardExpand all lines: src/backend/replication/logical/decode.c+9Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
327 | 327 | |
328 | 328 | |
329 | 329 | |
| 330 | + |
| 331 | + |
| 332 | + |
| 333 | + |
| 334 | + |
| 335 | + |
| 336 | + |
| 337 | + |
| 338 | + |
330 | 339 | |
331 | 340 | |
332 | 341 | |
|
Collapse file
src/backend/replication/logical/reorderbuffer.c
Copy file name to clipboardExpand all lines: src/backend/replication/logical/reorderbuffer.c+33-20Lines changed: 33 additions & 20 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1810 | 1810 | |
1811 | 1811 | |
1812 | 1812 | |
1813 | | - |
1814 | | - |
1815 | | - |
1816 | | - |
1817 | | - |
1818 | | - |
1819 | | - |
1820 | | - |
1821 | | - |
1822 | | - |
1823 | | - |
1824 | | - |
1825 | | - |
1826 | | - |
1827 | | - |
1828 | | - |
1829 | | - |
1830 | | - |
1831 | | - |
1832 | | - |
| 1813 | + |
| 1814 | + |
1833 | 1815 | |
1834 | 1816 | |
1835 | 1817 | |
1836 | 1818 | |
1837 | 1819 | |
1838 | 1820 | |
1839 | 1821 | |
| 1822 | + |
| 1823 | + |
| 1824 | + |
| 1825 | + |
| 1826 | + |
| 1827 | + |
| 1828 | + |
| 1829 | + |
| 1830 | + |
| 1831 | + |
| 1832 | + |
| 1833 | + |
| 1834 | + |
| 1835 | + |
| 1836 | + |
| 1837 | + |
| 1838 | + |
| 1839 | + |
| 1840 | + |
| 1841 | + |
| 1842 | + |
| 1843 | + |
| 1844 | + |
| 1845 | + |
| 1846 | + |
| 1847 | + |
| 1848 | + |
| 1849 | + |
| 1850 | + |
| 1851 | + |
| 1852 | + |
1840 | 1853 | |
1841 | 1854 | |
1842 | 1855 | |
|
Collapse file
src/backend/storage/ipc/standby.c
Copy file name to clipboardExpand all lines: src/backend/storage/ipc/standby.c+35Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
825 | 825 | |
826 | 826 | |
827 | 827 | |
| 828 | + |
| 829 | + |
| 830 | + |
| 831 | + |
| 832 | + |
| 833 | + |
| 834 | + |
| 835 | + |
| 836 | + |
| 837 | + |
828 | 838 | |
829 | 839 | |
830 | 840 | |
| ||
1068 | 1078 | |
1069 | 1079 | |
1070 | 1080 | |
| 1081 | + |
| 1082 | + |
| 1083 | + |
| 1084 | + |
| 1085 | + |
| 1086 | + |
| 1087 | + |
| 1088 | + |
| 1089 | + |
| 1090 | + |
| 1091 | + |
| 1092 | + |
| 1093 | + |
| 1094 | + |
| 1095 | + |
| 1096 | + |
| 1097 | + |
| 1098 | + |
| 1099 | + |
| 1100 | + |
| 1101 | + |
| 1102 | + |
| 1103 | + |
| 1104 | + |
| 1105 | + |
Collapse file
src/backend/utils/cache/inval.c
Copy file name to clipboardExpand all lines: src/backend/utils/cache/inval.c+3-2Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
842 | 842 | |
843 | 843 | |
844 | 844 | |
845 | | - |
846 | | - |
| 845 | + |
| 846 | + |
| 847 | + |
847 | 848 | |
848 | 849 | |
849 | 850 | |
|
Collapse file
src/include/replication/reorderbuffer.h
Copy file name to clipboardExpand all lines: src/include/replication/reorderbuffer.h+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
391 | 391 | |
392 | 392 | |
393 | 393 | |
| 394 | + |
| 395 | + |
394 | 396 | |
395 | 397 | |
396 | 398 | |
|
Collapse file
src/include/storage/standby.h
Copy file name to clipboardExpand all lines: src/include/storage/standby.h+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
85 | 85 | |
86 | 86 | |
87 | 87 | |
| 88 | + |
| 89 | + |
88 | 90 | |
89 | 91 | |
Collapse file
src/include/storage/standbydefs.h
Copy file name to clipboardExpand all lines: src/include/storage/standbydefs.h+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
17 | 17 | |
18 | 18 | |
19 | 19 | |
| 20 | + |
20 | 21 | |
21 | 22 | |
22 | 23 | |
23 | 24 | |
24 | 25 | |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
25 | 30 | |
26 | 31 | |
27 | 32 | |
28 | 33 | |
29 | 34 | |
30 | 35 | |
| 36 | + |
31 | 37 | |
32 | 38 | |
33 | 39 | |
| ||
50 | 56 | |
51 | 57 | |
52 | 58 | |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
53 | 74 | |
0 commit comments