Closed ejmeitz closed 11 months ago
Patch coverage: 15.11%
and project coverage change: -8.90%
:warning:
Comparison is base (
0198f19
) 86.06% compared to head (1e99703
) 77.16%. Report is 1 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Makes sense, that shouldn't be too hard to remedy.
Well the code definitely makes a new handle every time if parallel_read
is true but I am still clueless as to how I can test this does what I think it does.
Why the BigInt tests fails on two of the architectures in the CI (passes locally for me) Don't worry about this one. It happens sporadically. I'm not sure why.
Thank you for making the changes!
That is fine - I don't think we can properly test this through CI. I'll have a final close look at the code and test it locally.
Looking at the code now, I don't think I like the "OPEN_PARALLEL_FILES" list. I think we're better off without it.
Also, you (probably accidentally) committed a manifest and a .jld2
file.
OPEN_PARALLEL_FILES
to check that case you mentioned of someone trying to open the same file elsewhere with parallel_read
set to false and then writing to that file.
- I'll try and test it out as well. I have some of the banned use cases in tests but not actual parallel reads.
:+1:
* I left the `OPEN_PARALLEL_FILES` to check that case you mentioned of someone trying to open the same file elsewhere with `parallel_read` set to false and then writing to that file.
I understand and appreciate the intention. I'd also support it if it were that simple. Imagine the following test-case.
fp = jldopen(testfile; parallel_read=true)
close(fp) # probably (already) fails because it can't be deleted from the OPEN_FILES Dict
fs = jldopen(testfile; parallel_read=false) # fails because OPEN_PARALLEL_FILES has an entry (that may be WeakRef(nothing))
Even harder to fix:
fp1 = jldopen(testfile; parallel_read=true)
fp2 = jldopen(testfile; parallel_read=true) # overwrites reference tot fp1
close(fp2)
# If you fix the case above, JLD2 would now still think that there is no open parallel file handle.
fs = jldopen(tesfile; parallel_read=false) # should fail according to current logic but doesn't
Since this is quite a bit of work (Would need to keep a full list of ALL open file handles and also check whether they are still open) I would prefer removing this safety check and add a warning in the docs instead.
* Yeah the manifest is from running the tests locally oops. It won't let me delete the test.jld2 file I committed for some reason.
That's fine. I can fix that in the end.
Hi @ejmeitz,
thanks for helping out! I had a few minutes to spare and took the liberty to finish this up real quick.
I relaxed the open conditions. (parallel and serial read is fine) Will merge and release once tests pass.
This PR aims to add support for multi-threaded read-only access to JLD2 files. I created a new global tracker
OPEN_PARALLEL_FILES
which keeps track of the files flagged as open for multi-threaded access. The flag for multi-threaded access was added to thejldopen
function asparallel_read
with a default of false. If the user changes this flag to true the program will check that the file is opened with in moder
and that it is not already present in theOPEN_FILES
list. If these checks are satisfiedjldopen
proceeds as normal. TheOPEN_FILES_LOCK
is not invoked whenparallel_read
is true.This is in reference to #403. Still need to add tests, but the existing tests pass locally.
Things I am unsure of: