- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit228c370
Amit Kapila
Preserve conflict-relevant data during logical replication.
Logical replication requires reliable conflict detection to maintain dataconsistency across nodes. To achieve this, we must prevent prematureremoval of tuples deleted by other origins and their associated commit_tsdata by VACUUM, which could otherwise lead to incorrect conflict reportingand resolution.This patch introduces a mechanism to retain deleted tuples on thesubscriber during the application of concurrent transactions from remotenodes. Retaining these tuples allows us to correctly ignore concurrentupdates to the same tuple. Without this, an UPDATE might be misinterpretedas an INSERT during resolutions due to the absence of the original tuple.Additionally, we ensure that origin metadata is not prematurely removed byvacuum freeze, which is essential for detecting update_origin_differs anddelete_origin_differs conflicts.To support this, a new replication slot named pg_conflict_detection iscreated and maintained by the launcher on the subscriber. Each applyworker tracks its own non-removable transaction ID, which the launcheraggregates to determine the appropriate xmin for the slot, therebyretaining necessary tuples.Conflict information retention (deleted tuples and commit_ts) can beenabled per subscription via the retain_conflict_info option. This isdisabled by default to avoid unnecessary overhead for configurations thatdo not require conflict resolution or logging.During upgrades, if any subscription on the old cluster hasretain_conflict_info enabled, a conflict detection slot will be created toprotect relevant tuples from deletion when the new cluster starts.This is a foundational work to correctly detect update_deleted conflictwhich will be done in a follow-up patch.Author: Zhijie Hou <houzj.fnst@fujitsu.com>Reviewed-by: shveta malik <shveta.malik@gmail.com>Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Discussion:https://postgr.es/m/OS0PR01MB5716BE80DAEB0EE2A6A5D1F5949D2@OS0PR01MB5716.jpnprd01.prod.outlook.com1 parent039f7ee commit228c370
File tree
45 files changed
+2233
-220
lines changed- doc/src/sgml
- ref
- src
- backend
- access/transam
- catalog
- commands
- replication
- logical
- storage/ipc
- utils/adt
- bin
- pg_dump
- pg_upgrade
- t
- psql
- include
- catalog
- commands
- replication
- storage
- test
- regress
- expected
- sql
- subscription/t
- tools/pgindent
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
45 files changed
+2233
-220
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8082 | 8082 | | |
8083 | 8083 | | |
8084 | 8084 | | |
| 8085 | + | |
| 8086 | + | |
| 8087 | + | |
| 8088 | + | |
| 8089 | + | |
| 8090 | + | |
| 8091 | + | |
| 8092 | + | |
| 8093 | + | |
| 8094 | + | |
| 8095 | + | |
8085 | 8096 | | |
8086 | 8097 | | |
8087 | 8098 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4965 | 4965 | | |
4966 | 4966 | | |
4967 | 4967 | | |
| 4968 | + | |
| 4969 | + | |
4968 | 4970 | | |
4969 | 4971 | | |
4970 | 4972 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29592 | 29592 | | |
29593 | 29593 | | |
29594 | 29594 | | |
29595 | | - | |
| 29595 | + | |
| 29596 | + | |
| 29597 | + | |
29596 | 29598 | | |
29597 | 29599 | | |
29598 | 29600 | | |
| |||
29636 | 29638 | | |
29637 | 29639 | | |
29638 | 29640 | | |
29639 | | - | |
| 29641 | + | |
| 29642 | + | |
| 29643 | + | |
29640 | 29644 | | |
29641 | 29645 | | |
29642 | 29646 | | |
| |||
29666 | 29670 | | |
29667 | 29671 | | |
29668 | 29672 | | |
| 29673 | + | |
| 29674 | + | |
29669 | 29675 | | |
29670 | 29676 | | |
29671 | 29677 | | |
| |||
29688 | 29694 | | |
29689 | 29695 | | |
29690 | 29696 | | |
29691 | | - | |
29692 | | - | |
| 29697 | + | |
| 29698 | + | |
| 29699 | + | |
| 29700 | + | |
29693 | 29701 | | |
29694 | 29702 | | |
29695 | 29703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2396 | 2396 | | |
2397 | 2397 | | |
2398 | 2398 | | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
2399 | 2405 | | |
2400 | 2406 | | |
2401 | 2407 | | |
| |||
2532 | 2538 | | |
2533 | 2539 | | |
2534 | 2540 | | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
2535 | 2557 | | |
2536 | 2558 | | |
2537 | 2559 | | |
| |||
2563 | 2585 | | |
2564 | 2586 | | |
2565 | 2587 | | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
2566 | 2598 | | |
2567 | 2599 | | |
2568 | 2600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2235 | 2235 | | |
2236 | 2236 | | |
2237 | 2237 | | |
| 2238 | + | |
| 2239 | + | |
2238 | 2240 | | |
2239 | 2241 | | |
2240 | 2242 | | |
| |||
2653 | 2655 | | |
2654 | 2656 | | |
2655 | 2657 | | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
2656 | 2717 | | |
2657 | 2718 | | |
2658 | 2719 | | |
| |||
2797 | 2858 | | |
2798 | 2859 | | |
2799 | 2860 | | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
2800 | 2888 | | |
2801 | 2889 | | |
2802 | 2890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
264 | | - | |
265 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
| |||
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
288 | 298 | | |
289 | 299 | | |
290 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| |||
435 | 437 | | |
436 | 438 | | |
437 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
438 | 523 | | |
439 | 524 | | |
440 | 525 | | |
| |||
0 commit comments
Comments
(0)