Commit 6ddbdeb
authored
PMM-15316 Stage SEP secret files before renaming
publish() interleaved the write and the rename per file, so a write that
died part-way through the set - a full volume being the realistic cause -
left SEP some files rotated and the rest stale. Verified against the
previous revision: a failure on the third password file rotated two of
them and left the third behind.
Split it into stage() and commit_staged(). Every fallible step now runs
before the first rename, so the same failure leaves the previous complete
set in place and the script still exits nonzero. The temporary is recorded
for cleanup immediately after mktemp rather than after the write, since
errexit abandons the rest of stage() on a failed write and an unrecorded
temporary is one the EXIT trap cannot find.
This narrows rather than closes the gap: the set is still four renames, so
a failure between them leaves the earlier files updated. Closing that needs
a directory swap the mountpoint contract rules out.
Signed-off-by: Yan Orestes <yan.orestes@percona.com>1 parent bde170b commit 6ddbdeb
1 file changed
Lines changed: 42 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
43 | 55 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 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 | + | |
52 | 81 | | |
53 | 82 | | |
54 | 83 | | |
| |||
143 | 172 | | |
144 | 173 | | |
145 | 174 | | |
146 | | - | |
| 175 | + | |
147 | 176 | | |
148 | 177 | | |
149 | | - | |
| 178 | + | |
150 | 179 | | |
151 | 180 | | |
| 181 | + | |
| 182 | + | |
152 | 183 | | |
0 commit comments