HDF5: VFD handles ENOSPC OK at the moment (though FileWriter is still not 100% happy)

This commit is contained in:
2026-05-05 18:31:58 +02:00
parent 3464346f53
commit 8a4cd246eb
4 changed files with 19 additions and 10 deletions
+2
View File
@@ -16,6 +16,8 @@ TEST_CASE("HDF5File_enospc") {
REQUIRE_NOTHROW(file->SaveVector("/large1", large_vector));
REQUIRE_THROWS(file->SaveVector("/large2", large_vector));
REQUIRE_NOTHROW(file.reset());
// No leftover HDF5 objects
REQUIRE (H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0);
}
TEST_CASE("FileWriter_enospc") {
+1 -1
View File
@@ -5,7 +5,7 @@ ADD_LIBRARY(JFJochHDF5Wrappers STATIC
../compression/bitshuffle/bshuf_h5filter.h)
set_target_properties(JFJochHDF5Wrappers PROPERTIES POSITION_INDEPENDENT_CODE ON)
TARGET_LINK_LIBRARIES(JFJochHDF5Wrappers Compression hdf5-static)
TARGET_LINK_LIBRARIES(JFJochHDF5Wrappers JFJochLogger Compression hdf5-static)
ADD_LIBRARY(JFJochWriter STATIC
HDF5DataFile.h HDF5DataFile.cpp
+14 -5
View File
@@ -241,6 +241,9 @@ static herr_t H5FD_poison_sec2_read(
if (file->inner == NULL)
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return H5FDread(file->inner, type, dxpl_id, addr, size, buf);
}
@@ -258,7 +261,7 @@ static herr_t H5FD_poison_sec2_write(
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return 0;
if (H5FDwrite(file->inner, type, dxpl_id, addr, size, buf) < 0)
return H5FD_poison_sec2_mark_poisoned(file, "write");
@@ -281,6 +284,9 @@ static herr_t H5FD_poison_sec2_read_vector(
if (file->inner == NULL)
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return H5FDread_vector(
file->inner,
dxpl_id,
@@ -307,7 +313,7 @@ static herr_t H5FD_poison_sec2_write_vector(
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return 0;
if (H5FDwrite_vector(
file->inner,
@@ -339,6 +345,9 @@ static herr_t H5FD_poison_sec2_read_selection(
if (file->inner == NULL)
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return H5FDread_selection(
file->inner,
type,
@@ -369,7 +378,7 @@ static herr_t H5FD_poison_sec2_write_selection(
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return 0;
if (H5FDwrite_selection(
file->inner,
@@ -398,7 +407,7 @@ static herr_t H5FD_poison_sec2_flush(
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return 0;
if (H5FDflush(file->inner, dxpl_id, closing) < 0)
return H5FD_poison_sec2_mark_poisoned(file, "flush");
@@ -417,7 +426,7 @@ static herr_t H5FD_poison_sec2_truncate(
return -1;
if (H5FD_poison_sec2_fail_fast(file) < 0)
return -1;
return 0;
if (H5FDtruncate(file->inner, dxpl_id, closing) < 0)
return H5FD_poison_sec2_mark_poisoned(file, "truncate");
+2 -4
View File
@@ -3,6 +3,7 @@
#include <cstring>
#include <filesystem>
#include <spdlog/spdlog.h>
#include <bitshuffle/bshuf_h5filter.h>
#include "HDF5Objects.h"
@@ -16,10 +17,7 @@ static void HDF5PoisonCallback(
int error_number,
void *user_data
) {
/*
* Mark writer failed, log, cancel acquisition, etc.
* Avoid throwing from this C callback.
*/
spdlog::info("HDF5 Poison callback triggered: filename={}, operation={}, error_number={}", filename, operation, error_number);
}
hid_t HDF5Id::GetID() const {