Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the fix for #350 included in #1119 #1521

Merged

Commits on Nov 13, 2019

  1. Improve the fix for Unidata#350 included in Unidata#1119

    1) We have to use H5Tequal() to compare HDF5 type IDs.
    2) When checking if we can re-use an NC_CHAR attribute it is enough to
       compare data types (H5Tequal() takes care of the size comparison).
    3) This commit adds missing code (reuse_att was set but not used).
    
    Now an attribute in a NetCDF-4 file can be modified as many times as
    necessary, as long its type and length remain the same.
    
    Modifications changing either type or length of an attribute require
    deleting and re-creating an attribute which increments the attribute
    order creation index. Once this index reaches 65535 all attribute
    modifications (for a particular group or variable) will fail.
    
    For reference:
    
    Issue 350 title: NetCDF-4 limits the number of times an attribute can
    be modified
    
    Pull request 1119 title: Fix checking for HDF5 max dims, no longer
    re-create atts if not needed, confirm behavior for HDF5 cyclical
    files, allow user to set mpiexec
    ckhroulev committed Nov 13, 2019
    Configuration menu
    Copy the full SHA
    dd181de View commit details
    Browse the repository at this point in the history
  2. Modify the condition used to check if an attribute can be re-used

    This should make the code a bit cleaner.
    ckhroulev committed Nov 13, 2019
    Configuration menu
    Copy the full SHA
    098f2c1 View commit details
    Browse the repository at this point in the history
  3. Whitespace changes

    ckhroulev committed Nov 13, 2019
    Configuration menu
    Copy the full SHA
    6abbf8d View commit details
    Browse the repository at this point in the history
  4. Add regression tests modifying attributes 2^16 times

    This commit adds three new tests:
    
    - a test documenting the limitation originally reported in Unidata#350 (in
      general modifying an attribute about 2^16 times makes it impossible
      to modify this file in ways requiring nc_redef() and nc_enddef() calls).
    - a test ensuring that a scalar attribute can be modified 2^16 times
      as long as its type and size remain the same
    - a test ensuring that a text attribute can be modified 2^16 times as
      long as its size remains the same
    
    This version uses the nc_redef(), nc_put_att_...(), nc_enddef()
    sequence. One could also use nc_open(), nc_put_att_...(), nc_close()
    but that would make these tests significantly slower.
    ckhroulev committed Nov 13, 2019
    Configuration menu
    Copy the full SHA
    bb45db4 View commit details
    Browse the repository at this point in the history