forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf41d846

Amit Kapila
Raise an error while trying to acquire an invalid slot.
Once a replication slot is invalidated, it cannot be altered or used tofetch changes. However, a process could still acquire an invalid slot andfail later.For example, if a process acquires a logical slot that was invalidated dueto wal_removed, it will eventually fail in CreateDecodingContext() whenattempting to access the removed WAL. Similarly, for physical replicationslots, even if the slot is invalidated and invalidation_reason is set towal_removed, the walsender does not currently check for invalidation whenstarting physical replication. Instead, replication starts, and an erroris only reported later while trying to access WAL. Similarly, we prohibitmodifying slot properties for invalid slots but give the error for thesame after acquiring the slot.This patch improves error handling by detecting invalid slots earlier atthe time of slot acquisition which is the first step. This also helped inunifying different ERROR messages at different places and gave aconsistent message for invalid slots. This means that the message forinvalid slots will change to a generic message.This will also be helpful for future patches where we are planning toinvalidate slots due to more reasons like idle_timeout because we don'thave to modify multiple places in such cases and avoid the chances ofmissing out on a particular place.Author: Nisha Moond <nisha.moond412@gmail.com>Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>Reviewed-by: Vignesh C <vignesh21@gmail.com>Reviewed-by: Peter Smith <smithpb2250@gmail.com>Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Discussion:https://postgr.es/m/CABdArM6pBL5hPnSQ+5nEVMANcF4FCH7LQmgskXyiLY75TMnKpw@mail.gmail.com1 parenta632cd3 commitf41d846
File tree
10 files changed
+39
-50
lines changed- src
- backend
- replication
- logical
- utils/adt
- include/replication
- test/recovery/t
10 files changed
+39
-50
lines changedLines changed: 3 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
542 | 542 |
| |
543 | 543 |
| |
544 | 544 |
| |
545 |
| - | |
546 |
| - | |
547 |
| - | |
548 |
| - | |
549 |
| - | |
550 |
| - | |
551 |
| - | |
552 |
| - | |
553 |
| - | |
554 |
| - | |
555 |
| - | |
556 |
| - | |
557 |
| - | |
558 |
| - | |
559 |
| - | |
560 |
| - | |
561 |
| - | |
562 |
| - | |
563 |
| - | |
564 |
| - | |
565 |
| - | |
566 |
| - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
567 | 548 |
| |
568 | 549 |
| |
569 | 550 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
200 |
| - | |
| 200 | + | |
201 | 201 |
| |
202 | 202 |
| |
203 | 203 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
446 | 446 |
| |
447 | 447 |
| |
448 | 448 |
| |
449 |
| - | |
| 449 | + | |
450 | 450 |
| |
451 | 451 |
| |
452 | 452 |
| |
| |||
665 | 665 |
| |
666 | 666 |
| |
667 | 667 |
| |
668 |
| - | |
| 668 | + | |
669 | 669 |
| |
670 | 670 |
| |
671 | 671 |
| |
|
Lines changed: 20 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
535 | 535 |
| |
536 | 536 |
| |
537 | 537 |
| |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
538 | 542 |
| |
539 | 543 |
| |
540 |
| - | |
| 544 | + | |
541 | 545 |
| |
542 | 546 |
| |
543 | 547 |
| |
| |||
561 | 565 |
| |
562 | 566 |
| |
563 | 567 |
| |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
564 | 581 |
| |
565 | 582 |
| |
566 | 583 |
| |
| |||
785 | 802 |
| |
786 | 803 |
| |
787 | 804 |
| |
788 |
| - | |
| 805 | + | |
789 | 806 |
| |
790 | 807 |
| |
791 | 808 |
| |
| |||
812 | 829 |
| |
813 | 830 |
| |
814 | 831 |
| |
815 |
| - | |
| 832 | + | |
816 | 833 |
| |
817 | 834 |
| |
818 | 835 |
| |
819 | 836 |
| |
820 | 837 |
| |
821 | 838 |
| |
822 | 839 |
| |
823 |
| - | |
824 |
| - | |
825 |
| - | |
826 |
| - | |
827 |
| - | |
828 |
| - | |
829 |
| - | |
830 | 840 |
| |
831 | 841 |
| |
832 | 842 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
536 | 536 |
| |
537 | 537 |
| |
538 | 538 |
| |
539 |
| - | |
| 539 | + | |
540 | 540 |
| |
541 | 541 |
| |
542 | 542 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
816 | 816 |
| |
817 | 817 |
| |
818 | 818 |
| |
819 |
| - | |
| 819 | + | |
820 | 820 |
| |
821 | 821 |
| |
822 | 822 |
| |
| |||
1434 | 1434 |
| |
1435 | 1435 |
| |
1436 | 1436 |
| |
1437 |
| - | |
| 1437 | + | |
1438 | 1438 |
| |
1439 | 1439 |
| |
1440 | 1440 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
298 | 298 |
| |
299 | 299 |
| |
300 | 300 |
| |
301 |
| - | |
| 301 | + | |
302 | 302 |
| |
303 | 303 |
| |
304 | 304 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
256 |
| - | |
| 256 | + | |
| 257 | + | |
257 | 258 |
| |
258 | 259 |
| |
259 | 260 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
234 | 234 |
| |
235 | 235 |
| |
236 | 236 |
| |
237 |
| - | |
| 237 | + | |
238 | 238 |
| |
239 | 239 |
| |
240 | 240 |
| |
|
Lines changed: 6 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
533 | 533 |
| |
534 | 534 |
| |
535 | 535 |
| |
536 |
| - | |
| 536 | + | |
537 | 537 |
| |
538 | 538 |
| |
539 | 539 |
| |
| |||
551 | 551 |
| |
552 | 552 |
| |
553 | 553 |
| |
554 |
| - | |
555 |
| - | |
| 554 | + | |
556 | 555 |
| |
557 | 556 |
| |
558 | 557 |
| |
| |||
632 | 631 |
| |
633 | 632 |
| |
634 | 633 |
| |
635 |
| - | |
636 |
| - | |
| 634 | + | |
637 | 635 |
| |
638 | 636 |
| |
639 | 637 |
| |
| |||
668 | 666 |
| |
669 | 667 |
| |
670 | 668 |
| |
671 |
| - | |
| 669 | + | |
672 | 670 |
| |
673 | 671 |
| |
674 | 672 |
| |
| |||
759 | 757 |
| |
760 | 758 |
| |
761 | 759 |
| |
762 |
| - | |
| 760 | + | |
763 | 761 |
| |
764 | 762 |
| |
765 | 763 |
| |
| |||
818 | 816 |
| |
819 | 817 |
| |
820 | 818 |
| |
821 |
| - | |
822 |
| - | |
| 819 | + | |
823 | 820 |
| |
824 | 821 |
| |
825 | 822 |
| |
|
0 commit comments
Comments
(0)