Repository navigation
fix(persistence): give the S3 export scratch a private directory - #2951
Open
angela-helios wants to merge 1 commit into
Open
angela-helios wants to merge 1 commit into
angela-helios wants to merge 1 commit into
Conversation
S3OutputStore kept in-flight export parts under the fixed
{temp_dir}/hfs-export-scratch, which another local user could create first
and read from. The default is now a tempfile directory: random name,
owner-only on Unix, removed with the store.
Closes #2950
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2950
Summary
S3OutputStorekept in-flight export parts, patient data included, under the fixed{temp_dir}/hfs-export-scratch. Another local user could create that directory first and read the parts, or plant links among them:create_dir_allaccepts an existing directory whoever owns it.S3OutputStore::newnow creates its default scratch directory withtempfile::Builder::new().prefix("hfs-export-scratch-").tempdir():0700) on Unix;TempDiris held in the store, so the directory is removed when the store is dropped.with_scratch_dirstill sets an operator-chosen directory and releases the private one. If the temp directory is not writable, the store logs a warning and falls back to a random-named path; writing a part then fails as it would have before.Trade-off
A fixed path let a restarted process find the scratch an earlier run had left. A private directory belongs to one process, so after a crash its scratch stays in the temp directory instead of being reused. A graceful shutdown removes it.
Not changed
The bulk-export job database falls back to
{temp_dir}/hfs-bulk-export-{pid}.dbwhen there is no output or data dir (main.rs:2871). It is mentioned in #2950 and left for a separate change.Tests
output_store::tests::the_default_scratch_directory_is_private_to_the_storechecks:{temp}/hfs-export-scratch, and two stores get different directories;With the old fixed path restored, the test fails at the first assertion (
left: "...\Temp\hfs-export-scratch").cargo test -p helios-persistence --features s3 --lib backends::s3::output_store: 6 passed. Clippy onhelios-persistence --features s3 --lib --testsis clean.