Skip to content

fix(bootstrap): write init state atomically - #434

Open
fallintoplace wants to merge 1 commit into
ClickHouse:mainfrom
fallintoplace:fix/bootstrap-atomic-state
Open

fix(bootstrap): write init state atomically#434
fallintoplace wants to merge 1 commit into
ClickHouse:mainfrom
fallintoplace:fix/bootstrap-atomic-state

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What changed

The setup wizard checkpoint contains API keys.

Before this, it wrote the file and changed its permissions afterwards. That could leave a partial checkpoint, and a chmod failure could leave it too open.

  • use the shared atomic writer
  • apply 0600 before writing the checkpoint
  • keep the existing best-effort save behavior
  • add regressions for chmod failures and failed replacements

Tests

  • 21 focused tests passed
  • tests/test_bootstrap.py::TestInitStatePersistence
  • tests/test_utils_fs.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant