Commit 48fe469
committed
fix: write the uploaded etcd snapshot atomically
The etcd snapshot upload truncated the snapshot file in place, and removed it when the upload failed. The etcd recovery reads that same file, and it runs after the bootstrap API has already returned success. This way, an upload repeated during a running recovery cut the snapshot short and left a partial etcd data directory behind, and every bootstrap after that got rejected.
Write the upload to a temporary file next to the snapshot and move it into place only once it is complete. A running recovery keeps reading the snapshot it started with, and a failed upload removes only its own temporary file.
Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>1 parent f25b4a3 commit 48fe469
1 file changed
Lines changed: 8 additions & 1 deletion
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2026 | 2026 | | |
2027 | 2027 | | |
2028 | 2028 | | |
2029 | | - | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
2030 | 2033 | | |
2031 | 2034 | | |
2032 | 2035 | | |
| |||
2067 | 2070 | | |
2068 | 2071 | | |
2069 | 2072 | | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
2070 | 2077 | | |
2071 | 2078 | | |
2072 | 2079 | | |
| |||
0 commit comments