forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8728b2c
committed
Fix pg_dump/pg_restore to restore event triggers later.
Previously, event triggers were restored just after regular triggers(and FK constraints, which are basically triggers). This is riskysince an event trigger, once installed, could interfere with subsequentrestore commands. Worse, because event triggers don't have anyparticular dependencies on any post-data objects, a parallel restorewould consider them eligible to be restored the moment the post-dataphase starts, allowing them to also interfere with restoration of awhole bunch of objects that would have been restored before them ina serial restore. There's no way to completely remove the risk of amisguided event trigger breaking the restore, since if nothing elseit could break other event triggers. But we can certainly push themto later in the process to minimize the hazard.To fix, tweak the RestorePass mechanism introduced by commit3eb9a5eso that event triggers are handled as part of the post-ACL processingpass (renaming the "REFRESH" pass to "POST_ACL" to reflect its moregeneral use). This will cause them to restore after everything exceptmatview refreshes, which seems OK since matview refreshes really oughtto run in the post-restore state of the database. In a parallelrestore, event triggers and matview refreshes might be intermixed,but that seems all right as well.Also update the code and comments in pg_dump_sort.c so that its ideaof how things are sorted agrees with what actually happens due tothe RestorePass mechanism. This is mostly cosmetic: it'll affect theorder of objects in a dump's TOC, but not the actual restore order.But not changing that would be quite confusing to somebody readingthe code.Back-patch to all supported branches.Fabrízio de Royes Mello, tweaked a bit by meDiscussion:https://postgr.es/m/CAFcNs+ow1hmFox8P--3GSdtwz-S3Binb6ZmoP6Vk+Xg=K6eZNA@mail.gmail.com1 parent24d8595 commit8728b2c
File tree
3 files changed
+36
-24
lines changed- src/bin/pg_dump
3 files changed
+36
-24
lines changedLines changed: 10 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
670 | 670 |
| |
671 | 671 |
| |
672 | 672 |
| |
673 |
| - | |
674 |
| - | |
| 673 | + | |
| 674 | + | |
675 | 675 |
| |
676 | 676 |
| |
677 |
| - | |
| 677 | + | |
678 | 678 |
| |
679 | 679 |
| |
680 | 680 |
| |
| |||
689 | 689 |
| |
690 | 690 |
| |
691 | 691 |
| |
692 |
| - | |
693 |
| - | |
| 692 | + | |
| 693 | + | |
694 | 694 |
| |
695 | 695 |
| |
696 | 696 |
| |
| |||
705 | 705 |
| |
706 | 706 |
| |
707 | 707 |
| |
708 |
| - | |
| 708 | + | |
709 | 709 |
| |
710 | 710 |
| |
711 | 711 |
| |
712 | 712 |
| |
713 |
| - | |
| 713 | + | |
714 | 714 |
| |
715 | 715 |
| |
716 | 716 |
| |
| |||
3082 | 3082 |
| |
3083 | 3083 |
| |
3084 | 3084 |
| |
3085 |
| - | |
3086 |
| - | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
3087 | 3088 |
| |
3088 | 3089 |
| |
3089 | 3090 |
| |
|
Lines changed: 10 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
212 |
| - | |
213 |
| - | |
214 |
| - | |
215 |
| - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
216 | 220 |
| |
217 | 221 |
| |
218 | 222 |
| |
219 | 223 |
| |
220 | 224 |
| |
221 | 225 |
| |
222 | 226 |
| |
223 |
| - | |
| 227 | + | |
224 | 228 |
| |
225 |
| - | |
| 229 | + | |
226 | 230 |
| |
227 | 231 |
| |
228 | 232 |
| |
|
Lines changed: 16 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 |
| - | |
28 |
| - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 |
| |
30 | 37 |
| |
31 | 38 |
| |
| |||
66 | 73 |
| |
67 | 74 |
| |
68 | 75 |
| |
69 |
| - | |
| 76 | + | |
70 | 77 |
| |
71 | 78 |
| |
72 | 79 |
| |
73 | 80 |
| |
74 | 81 |
| |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
81 | 88 |
| |
82 | 89 |
| |
83 | 90 |
| |
|
0 commit comments
Comments
(0)