forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3d65b05
committed
Fix bogus cache-invalidation logic in logical replication worker.
The code recorded cache invalidation events by zeroing the "localreloid"field of affected cache entries. However, it's possible for an invalevent to occur even while we have the entry open and locked. So anill-timed inval could result in "cache lookup failed for relation 0"errors, if the worker's code tried to use the cleared field. We canfix that by creating a separate bool field to record whether the entryneeds to be revalidated. (In the back branches, cram the bool intowhat had been padding space, to avoid an ABI break in the somewhatunlikely event that any extension is looking at this struct.)Also, rearrange the logic in logicalrep_rel_open so that itdoes the right thing in cases where table_open would fail.We should retry the lookup by name in that case, but we didn't.The real-world impact of this is probably small. In the first place,the error conditions are very low probability, and in the second place,the worker would just exit and get restarted. We only noticed becausein a CLOBBER_CACHE_ALWAYS build, the failure can occur repeatedly,preventing the worker from making progress. Nonetheless, it's clearlya bug, and it impedes a useful type of testing; so back-patch to v10where this code was introduced.Discussion:https://postgr.es/m/1032727.1600096803@sss.pgh.pa.us1 parente568ed0 commit3d65b05
File tree
2 files changed
+53
-29
lines changed- src
- backend/replication/logical
- include/replication
2 files changed
+53
-29
lines changedLines changed: 44 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
80 |
| - | |
| 80 | + | |
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
94 |
| - | |
| 94 | + | |
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
| |||
230 | 230 |
| |
231 | 231 |
| |
232 | 232 |
| |
233 |
| - | |
234 |
| - | |
| 233 | + | |
235 | 234 |
| |
236 | 235 |
| |
237 | 236 |
| |
238 | 237 |
| |
239 | 238 |
| |
240 | 239 |
| |
241 |
| - | |
242 | 240 |
| |
243 | 241 |
| |
244 | 242 |
| |
| |||
254 | 252 |
| |
255 | 253 |
| |
256 | 254 |
| |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
257 | 259 |
| |
258 | 260 |
| |
259 |
| - | |
260 |
| - | |
261 |
| - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
262 | 284 |
| |
263 |
| - | |
| 285 | + | |
264 | 286 |
| |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
265 | 294 |
| |
266 | 295 |
| |
267 | 296 |
| |
| |||
272 | 301 |
| |
273 | 302 |
| |
274 | 303 |
| |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - | |
280 |
| - | |
281 |
| - | |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
286 |
| - | |
287 |
| - | |
288 |
| - | |
289 |
| - | |
| 304 | + | |
290 | 305 |
| |
291 | 306 |
| |
292 | 307 |
| |
| |||
380 | 395 |
| |
381 | 396 |
| |
382 | 397 |
| |
383 |
| - | |
| 398 | + | |
384 | 399 |
| |
385 | 400 |
| |
386 | 401 |
| |
| |||
523 | 538 |
| |
524 | 539 |
| |
525 | 540 |
| |
526 |
| - | |
| 541 | + | |
527 | 542 |
| |
528 | 543 |
| |
529 | 544 |
| |
| |||
537 | 552 |
| |
538 | 553 |
| |
539 | 554 |
| |
540 |
| - | |
| 555 | + | |
541 | 556 |
| |
542 | 557 |
| |
543 | 558 |
| |
| |||
656 | 671 |
| |
657 | 672 |
| |
658 | 673 |
| |
| 674 | + | |
| 675 | + | |
659 | 676 |
| |
660 | 677 |
| |
661 | 678 |
| |
|
Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 |
| |
24 |
| - | |
| 31 | + | |
25 | 32 |
| |
26 | 33 |
| |
27 | 34 |
| |
|
0 commit comments
Comments
(0)