Skip to content

Atomic save chunked mmap config - #5628

Merged
generall merged 4 commits into
devfrom
atomic-save-chunked-mmap-config
Dec 9, 2024
Merged

generall merged 4 commits into
devfrom
atomic-save-chunked-mmap-config

Conversation

@IvanPleshkov

@IvanPleshkov IvanPleshkov commented Dec 9, 2024 •

Copy link
Copy Markdown
Contributor

Save chunked mmap config atomically.
Just flush is not enough because it doesn't guarantee presence on disk. This situation was caught on a real cluster.

Also, this file can be generated from another config. Do it if loading fails.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Comment on lines +106 to +109
fn load_config(config_file: &Path) -> Option<ChunkedMmapConfig> {
if config_file.exists() {
let file = std::fs::File::open(config_file).ok()?;
let config: ChunkedMmapConfig = serde_json::from_reader(file).ok()?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep & log error in case of failure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHYM about keeping? As I remember, the decision was to create a new file if prev one is corrupted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@IvanPleshkov
IvanPleshkov requested a review from generall December 9, 2024 21:20
@generall
generall merged commit 8490f5c into dev Dec 9, 2024
@generall
generall deleted the atomic-save-chunked-mmap-config branch December 9, 2024 21:24
timvisee pushed a commit that referenced this pull request Jan 8, 2025
* atomic save chunked mmap config

* are you happy clippy

* log error

* review remarks
@timvisee timvisee mentioned this pull request Jan 8, 2025
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.

2 participants