{{ message }}
Repository navigation
Commit 8574e6c
* fix: keep source postgres down during pg_upgrade copy
* fix: address review findings in pg_upgrade source-start guard
* test: cover pg_upgrade start guard and harden exit cleanup
* fix: make the pg_upgrade start guard self-expiring
Replace the ExecStartPre=/bin/false drop-in with an ExecCondition guard that
refuses a start only while initiate.sh or pg_upgrade is alive, so a SIGKILLed
initiate.sh no longer leaves the source blocked until a reboot. The guard runs
as root (`+`) because the unit runs as postgres, and a start that gets past it
removes the drop-in via ExecStartPost so Restart=no does not outlive the block.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* test(nix): run pg_upgrade start guard test in flake check
Refs: MPG-1334
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* test(nix): add pg_upgrade start guard VM test
Refs: MPG-1334
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor: split pg_upgrade start guard into start_guard.sh and address review
- Move the start guard functions out of initiate.sh into start_guard.sh,
sourced by initiate.sh and test-start-guard.sh.
- Resolve sh, rm and systemctl with type -P and fail loudly if missing,
instead of hardcoding /bin.
- Remove the guard script only after daemon-reload succeeds, so a failed
reload cannot leave a drop-in pointing at a missing guard.
- Make the pid lock watcher exit when initiate.sh and pg_upgrade are gone.
- Test the generated ExecStartPost line instead of hardcoded paths, add a
watcher-abandoned test, and include start_guard.sh in the nix check.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* test(nix): tidy pg_upgrade start guard VM test
Refs: MPG-1334
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix: ignore non-numeric pids in the start guard and silence SC2016
- The guard now skips pid files that do not hold a number. With bash as sh,
`kill -0 not-a-pid` succeeded, so a garbage pid file refused every start.
- Silence shellcheck SC2016 for the intentional single-quoted bash -c in the
watcher test.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* test: point start guard test shims at the running bash
The Nix build sandbox on Linux has no /usr/bin/env, so the shims failed
with "bad interpreter". Rewrite their shebang to $BASH.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* test(nix): source start_guard.sh in the start guard VM test
Refs: MPG-1334
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* ci: retrigger
* ci: retrigger
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(pg_upgrade): address start guard review comments, ship start_guard.sh
- Fail the upgrade when a postmaster.pid already exists in the old data
directory once the new cluster is up (a postmaster ran during the copy).
- assert_source_stayed_down fails when the lock watcher exited non-zero;
tests poll with kill -0 so the exit status is still available.
- Take the lock atomically via a temp name plus ln, and clean the temp name
up in unblock_postgres_start.
- Deploy start_guard.sh to /etc/adminapi/pg_upgrade_scripts and add it to
the audit baseline; without it initiate.sh cannot source the guard.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Márton Boros <martonboros@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 3d0f24b commit 8574e6c
8 files changed
Lines changed: 919 additions & 12 deletions
File tree
- ansible
- files/admin_api_scripts/pg_upgrade_scripts
- tasks/internal
- audit-specs/baselines
- nix
- docs
- ext/tests
- tests/pg_upgrade
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 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 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
626 | 641 | | |
627 | 642 | | |
628 | 643 | | |
| |||

0 commit comments