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

Amit Kapila
Fix invalid memory access during the shutdown of the parallel apply worker.
The callback function pa_shutdown() accesses MyLogicalRepWorker which maynot be initialized if there is an error during the initialization of theparallel apply worker. The other problem is that by the time it is invokedeven after the initialization of the worker, the MyLogicalRepWorker willbe reset by another callback logicalrep_worker_onexit. So, it won't havethe required information.To fix this, register the shutdown callback after we are attached to theworker slot.After this fix, we observed another issue which is that sometimes theleader apply worker tries to receive the message from the error queue thatmight already be detached by the parallel apply worker leading to anerror. To prevent such an error, we ensure that the leader apply workerdetaches from the parallel apply worker's error queue before stopping it.Reported-by: Sawada MasahikoAuthor: Hou ZhijieReviewed-by: Sawada Masahiko, Amit KapilaDiscussion:https://postgr.es/m/CAD21AoDo+yUwNq6nTrvE2h9bB2vZfcag=jxWc7QxuWCmkDAqcA@mail.gmail.com1 parent455f948 commit3d144c6
File tree
3 files changed
+38
-18
lines changed- src
- backend/replication/logical
- include/replication
3 files changed
+38
-18
lines changedLines changed: 16 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
577 | 577 |
| |
578 | 578 |
| |
579 | 579 |
| |
580 |
| - | |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
| 580 | + | |
590 | 581 |
| |
591 | 582 |
| |
592 | 583 |
| |
| |||
636 | 627 |
| |
637 | 628 |
| |
638 | 629 |
| |
639 |
| - | |
640 |
| - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
641 | 635 |
| |
642 | 636 |
| |
643 | 637 |
| |
| |||
845 | 839 |
| |
846 | 840 |
| |
847 | 841 |
| |
| 842 | + | |
| 843 | + | |
| 844 | + | |
848 | 845 |
| |
849 | 846 |
| |
850 | 847 |
| |
| |||
901 | 898 |
| |
902 | 899 |
| |
903 | 900 |
| |
904 |
| - | |
905 |
| - | |
906 | 901 |
| |
907 | 902 |
| |
908 | 903 |
| |
| |||
921 | 916 |
| |
922 | 917 |
| |
923 | 918 |
| |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
924 | 926 |
| |
925 | 927 |
| |
926 | 928 |
| |
|
Lines changed: 21 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
609 | 609 |
| |
610 | 610 |
| |
611 | 611 |
| |
612 |
| - | |
613 |
| - | |
| 612 | + | |
614 | 613 |
| |
615 | 614 |
| |
616 | 615 |
| |
617 | 616 |
| |
618 | 617 |
| |
619 |
| - | |
| 618 | + | |
620 | 619 |
| |
| 620 | + | |
| 621 | + | |
621 | 622 |
| |
622 | 623 |
| |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
623 | 629 |
| |
624 | 630 |
| |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
625 | 643 |
| |
626 | 644 |
| |
627 | 645 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
235 | 235 |
| |
236 | 236 |
| |
237 | 237 |
| |
238 |
| - | |
| 238 | + | |
239 | 239 |
| |
240 | 240 |
| |
241 | 241 |
| |
|
0 commit comments
Comments
(0)