forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8e53ae0
committed
Fix a couple of bugs in MultiXactId freezing
Both heap_freeze_tuple() and heap_tuple_needs_freeze() neglected to lookinto a multixact to check the members against cutoff_xid. This meansthat a very old Xid could survive hidden within a multi, possiblyoutliving its CLOG storage. In the distant future, this would causeclog lookup failures:ERROR: could not access status of transaction 3883960912DETAIL: Could not open file "pg_clog/0E78": No such file or directory.This mostly was problematic when the updating transaction aborted, sincein that case the row wouldn't get pruned away earlier in vacuum and themultixact could possibly survive for a long time. In many cases, datathat is inaccessible for this reason way can be brought backheuristically.As a second bug, heap_freeze_tuple() didn't properly handle multixactsthat need to be frozen according to cutoff_multi, but whose updater xidis still alive. Instead of preserving the update Xid, it just set Xmaxinvalid, which leads to both old and new tuple versions becomingvisible. This is pretty rare in practice, but a real threatnonetheless. Existing corrupted rows, unfortunately, cannot be repairedin an automated fashion.Existing physical replicas might have already incorrectly frozen tuplesbecause of different behavior than in master, which might only becomeapparent in the future once pg_multixact/ is truncated; it isrecommended that all clones be rebuilt after upgrading.Following code analysis caused by bug report by J Smith in messageCADFUPgc5bmtv-yg9znxV-vcfkb+JPRqs7m2OesQXaM_4Z1JpdQ@mail.gmail.comand privately by F-Secure.Backpatch to 9.3, where freezing of MultiXactIds was introduced.Analysis and patch by Andres Freund, with some tweaks by Álvaro.1 parent663d2e4 commit8e53ae0
2 files changed
+151
-23
lines changedLines changed: 142 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5247 | 5247 |
| |
5248 | 5248 |
| |
5249 | 5249 |
| |
| 5250 | + | |
| 5251 | + | |
5250 | 5252 |
| |
5251 | 5253 |
| |
5252 | 5254 |
| |
| |||
5262 | 5264 |
| |
5263 | 5265 |
| |
5264 | 5266 |
| |
| 5267 | + | |
| 5268 | + | |
| 5269 | + | |
5265 | 5270 |
| |
5266 | 5271 |
| |
5267 | 5272 |
| |
5268 | 5273 |
| |
5269 | 5274 |
| |
5270 | 5275 |
| |
| 5276 | + | |
5271 | 5277 |
| |
5272 | 5278 |
| |
| 5279 | + | |
5273 | 5280 |
| |
5274 | 5281 |
| |
5275 | 5282 |
| |
| |||
5286 | 5293 |
| |
5287 | 5294 |
| |
5288 | 5295 |
| |
5289 |
| - | |
5290 |
| - | |
5291 |
| - | |
| 5296 | + | |
| 5297 | + | |
| 5298 | + | |
| 5299 | + | |
| 5300 | + | |
| 5301 | + | |
| 5302 | + | |
5292 | 5303 |
| |
5293 | 5304 |
| |
5294 |
| - | |
5295 |
| - | |
5296 |
| - | |
5297 |
| - | |
5298 |
| - | |
| 5305 | + | |
| 5306 | + | |
| 5307 | + | |
| 5308 | + | |
| 5309 | + | |
| 5310 | + | |
| 5311 | + | |
| 5312 | + | |
| 5313 | + | |
| 5314 | + | |
| 5315 | + | |
| 5316 | + | |
| 5317 | + | |
| 5318 | + | |
| 5319 | + | |
| 5320 | + | |
| 5321 | + | |
| 5322 | + | |
| 5323 | + | |
| 5324 | + | |
| 5325 | + | |
| 5326 | + | |
| 5327 | + | |
| 5328 | + | |
| 5329 | + | |
| 5330 | + | |
| 5331 | + | |
| 5332 | + | |
| 5333 | + | |
| 5334 | + | |
| 5335 | + | |
| 5336 | + | |
| 5337 | + | |
| 5338 | + | |
| 5339 | + | |
| 5340 | + | |
| 5341 | + | |
| 5342 | + | |
| 5343 | + | |
| 5344 | + | |
| 5345 | + | |
| 5346 | + | |
| 5347 | + | |
| 5348 | + | |
| 5349 | + | |
| 5350 | + | |
| 5351 | + | |
| 5352 | + | |
| 5353 | + | |
| 5354 | + | |
| 5355 | + | |
| 5356 | + | |
| 5357 | + | |
| 5358 | + | |
| 5359 | + | |
| 5360 | + | |
| 5361 | + | |
| 5362 | + | |
| 5363 | + | |
| 5364 | + | |
| 5365 | + | |
| 5366 | + | |
| 5367 | + | |
| 5368 | + | |
| 5369 | + | |
| 5370 | + | |
| 5371 | + | |
| 5372 | + | |
| 5373 | + | |
| 5374 | + | |
| 5375 | + | |
| 5376 | + | |
| 5377 | + | |
| 5378 | + | |
| 5379 | + | |
| 5380 | + | |
| 5381 | + | |
| 5382 | + | |
| 5383 | + | |
| 5384 | + | |
| 5385 | + | |
| 5386 | + | |
| 5387 | + | |
| 5388 | + | |
| 5389 | + | |
| 5390 | + | |
| 5391 | + | |
| 5392 | + | |
| 5393 | + | |
| 5394 | + | |
| 5395 | + | |
| 5396 | + | |
| 5397 | + | |
| 5398 | + | |
| 5399 | + | |
| 5400 | + | |
| 5401 | + | |
5299 | 5402 |
| |
5300 | 5403 |
| |
5301 | 5404 |
| |
| |||
5615 | 5718 |
| |
5616 | 5719 |
| |
5617 | 5720 |
| |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
5618 | 5724 |
| |
5619 | 5725 |
| |
5620 | 5726 |
| |
| |||
5627 | 5733 |
| |
5628 | 5734 |
| |
5629 | 5735 |
| |
5630 |
| - | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
5631 | 5742 |
| |
5632 |
| - | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
5633 | 5747 |
| |
5634 |
| - | |
5635 |
| - | |
5636 |
| - | |
5637 |
| - | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
5638 | 5757 |
| |
5639 | 5758 |
| |
5640 | 5759 |
| |
5641 |
| - | |
5642 |
| - | |
5643 |
| - | |
5644 |
| - | |
| 5760 | + | |
| 5761 | + | |
5645 | 5762 |
| |
5646 | 5763 |
| |
5647 | 5764 |
| |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
5648 | 5772 |
| |
5649 | 5773 |
| |
5650 | 5774 |
| |
|
Lines changed: 9 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
434 | 434 |
| |
435 | 435 |
| |
436 | 436 |
| |
437 |
| - | |
| 437 | + | |
| 438 | + | |
438 | 439 |
| |
439 |
| - | |
440 |
| - | |
441 |
| - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
442 | 445 |
| |
443 | 446 |
| |
444 | 447 |
| |
| |||
1052 | 1055 |
| |
1053 | 1056 |
| |
1054 | 1057 |
| |
1055 |
| - | |
| 1058 | + | |
| 1059 | + | |
1056 | 1060 |
| |
1057 | 1061 |
| |
1058 | 1062 |
| |
|
0 commit comments
Comments
(0)