facade: open_swmr reads live only files with the SWMR-write flag
A file opened with open_swmr whose superblock does not have the SWMR-write flag (its writer has closed it) is now read exactly as File::open reads it: bounded by its recorded end of file, through the chunk cache, each operation tried once, and is_swmr_read() is false. Before, every file opened with open_swmr ignored its recorded end of file, so a closed file whose end of file is below its length (h5clear_fsm_persist_less.h5, or the mid-write fixture with its flags cleared) listed and read objects that File::open and libhdf5's plain reader refuse. Opening such a file is not retried once the superblock has been read. libhdf5's SWMR reader is looser than either (it reads the fixture's chunk index past the end of file even with the flags cleared); a test pins what h5py does and docs/design/swmr.md says why we follow the plain reader. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -27,6 +27,10 @@ Design: `docs/design/swmr.md`.
|
||||
would read as fill where the writer has since written). A file open for
|
||||
writing without SWMR is refused with `Error::Locked`, as libhdf5 refuses
|
||||
it.
|
||||
Only a file whose superblock has the SWMR-write flag when it is opened is
|
||||
read this way; any other file (its writer has closed it) reads exactly as
|
||||
`File::open` reads it, bounded by its recorded end of file, and
|
||||
`is_swmr_read()` is `false`.
|
||||
- **`Dataset::refresh()`** reads the dataset's object header again
|
||||
(`H5Drefresh`, h5py `Dataset.refresh()`), so `shape()` and later reads
|
||||
see the writer's appends; a handle keeps its extent until refreshed.
|
||||
|
||||
Reference in New Issue
Block a user