- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitd65485b

Amit Kapila
Fix xmin advancement during fast_forward decoding.
During logical decoding, we advance catalog_xmin of logical too early infast_forward mode, resulting in required catalog data being removed byvacuum. This mode is normally used to advance the slot without processingthe changes, but we still can't let the slot's xmin to advance to anincorrect value.Commitf49a80c fixed a similar issue where the logical slot'scatalog_xmin was getting advanced prematurely during non-fast-forwardmode. During xl_running_xacts processing, instead of directly advancingthe slot's xmin to the oldest running xid in the record, it allowed thexmin to be held back for snapshots that can be used fornot-yet-replayed transactions, as those might consider older txns asrunning too. However, it missed the fact that the same problem can happenduring fast_forward mode decoding, as we won't build a base snapshot inthat mode, and the future call to get_changes from the same slot can missseeing the required catalog changes leading to incorrect reslts.This commit allows building the base snapshot even in fast_forward mode toprevent the early advancement of xmin.Reported-by: Amit Kapila <amit.kapila16@gmail.com>Author: Zhijie Hou <houzj.fnst@fujitsu.com>Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>Reviewed-by: shveta malik <shveta.malik@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Backpatch-through: 13Discussion:https://postgr.es/m/CAA4eK1LqWncUOqKijiafe+Ypt1gQAQRjctKLMY953J79xDBgAg@mail.gmail.comDiscussion:https://postgr.es/m/OS0PR01MB57163087F86621D44D9A72BF94BB2@OS0PR01MB5716.jpnprd01.prod.outlook.com1 parent4164d69 commitd65485b
File tree
3 files changed
+71
-13
lines changed- contrib/test_decoding
- expected
- specs
- src/backend/replication/logical
3 files changed
+71
-13
lines changedLines changed: 41 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + |
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
| |||
40 | 41 |
| |
41 | 42 |
| |
42 | 43 |
| |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + |
Lines changed: 25 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
362 | 362 |
| |
363 | 363 |
| |
364 | 364 |
| |
365 |
| - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
366 | 370 |
| |
367 |
| - | |
368 |
| - | |
| 371 | + | |
369 | 372 |
| |
370 | 373 |
| |
371 | 374 |
| |
372 | 375 |
| |
373 | 376 |
| |
374 |
| - | |
375 |
| - | |
| 377 | + | |
| 378 | + | |
376 | 379 |
| |
377 | 380 |
| |
378 | 381 |
| |
| 382 | + | |
379 | 383 |
| |
380 | 384 |
| |
381 | 385 |
| |
| |||
422 | 426 |
| |
423 | 427 |
| |
424 | 428 |
| |
425 |
| - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
426 | 434 |
| |
427 |
| - | |
428 |
| - | |
| 435 | + | |
429 | 436 |
| |
430 | 437 |
| |
431 | 438 |
| |
432 | 439 |
| |
433 | 440 |
| |
434 |
| - | |
| 441 | + | |
| 442 | + | |
435 | 443 |
| |
436 | 444 |
| |
437 | 445 |
| |
| |||
442 | 450 |
| |
443 | 451 |
| |
444 | 452 |
| |
445 |
| - | |
| 453 | + | |
| 454 | + | |
446 | 455 |
| |
447 | 456 |
| |
448 | 457 |
| |
449 | 458 |
| |
450 |
| - | |
| 459 | + | |
| 460 | + | |
451 | 461 |
| |
452 | 462 |
| |
453 | 463 |
| |
454 | 464 |
| |
455 |
| - | |
| 465 | + | |
| 466 | + | |
456 | 467 |
| |
457 | 468 |
| |
458 | 469 |
| |
| |||
480 | 491 |
| |
481 | 492 |
| |
482 | 493 |
| |
483 |
| - | |
| 494 | + | |
| 495 | + | |
484 | 496 |
| |
485 | 497 |
| |
486 | 498 |
| |
|
0 commit comments
Comments
(0)