HDFGroup / HDFGroup/hdf5

Attributes are not stored in dense storage

Open
#3,815 1 comment 0 reactions 1 assignee Claimed by @fortnern View on GitHub
Component - C Library
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

**Describe the bug**
The attributes are not stored in the dense storage if the header version is less than `H5O_VERSION_2`, which it is by default. Creating the large attribute will cause an error, even if the dense storage was chosen. This is the minimal example to reproduce the bug.
```c
#include "hdf5.h"

int main(void)
{
hid_t props, file, space, attr;
hsize_t dims[1] = {1000000ul};

props = H5Pcreate(H5P_FILE_CREATE);

H5Pset_attr_phase_change(props, 0, 0);

file = H5Fcreate("test.h5", H5F_ACC_TRUNC, props, H5P_DEFAULT);

space = H5Screate_simple(1, dims, NULL);

attr = H5Acreate2(file, "test", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT);

return 0;
}
```

To workaround this bug and force the header version to `H5O_VERSION_2`, one could enable creation order tracking by calling
```c
H5Pset_attr_creation_order(props, H5P_CRT_ORDER_TRACKED);
```
but this behaviour is undocumented and unintuitive.

**Expected behavior**
Attribute should be written to the dense storage even without creation order tracking.

**Platform (please complete the following information)**
- HDF5 version *1.12.1*, but also tested with upstream *562c53c*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.