Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ef-tests, storage): do not sync_all static files in state tests #6914

Merged
merged 4 commits into from
Mar 7, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Mar 1, 2024

There's no need to ensure that all in-memory buffers are flushed to disk for tests, because we don't reuse this data anymore after we finish.

Even if the modifications have not made it to disk yet, the OS uses its buffer cache to reflect file modifications and guarantees atomicity level for reads and writes, to ALL processes. So not only your process, but any other process, would be able to see the changes.

source: https://stackoverflow.com/a/8547094


The removal of this sync_all

// First byte of the offset file is the size of one offset in bytes
offsets_file.write_all(&[OFFSET_SIZE_BYTES as u8])?;
offsets_file.sync_all()?;
offsets_file.seek(SeekFrom::End(0))?;
is fine because we do it when actually writing the offsets.

@shekhirin shekhirin added C-test A change that impacts how or what we test A-static-files Related to static files labels Mar 1, 2024
@shekhirin shekhirin changed the title test(ef-tests, storage): do not fsync static files in state tests test(ef-tests, storage): do not sync_all static files in state tests Mar 1, 2024
@shekhirin shekhirin marked this pull request as ready for review March 1, 2024 16:42
@shekhirin
Copy link
Collaborator Author

@joshieDo can you please check if the removal of offsets sync_all is fine?

@shekhirin shekhirin requested a review from joshieDo March 7, 2024 16:14
@shekhirin shekhirin added this pull request to the merge queue Mar 7, 2024
Merged via the queue into main with commit 6557da1 Mar 7, 2024
29 checks passed
@shekhirin shekhirin deleted the alexey/static-file-no-fsync branch March 7, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-static-files Related to static files C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants