Bug fix: move data after adding new variables#199
Merged
Conversation
This handles the case when file header extent does not grow after adding new variable. In addition, the case when adding new record variables does not grow the starting offset of record variable section.
…ection
The setting is based on the followings.
Each time ncmpi__enddef() is called, use env variable and MPI info
object to recalculate ncp->v_align and ncp->r_align, which are later
used to calculate the file starting offsets for fix-sized variable
section and record variable section.
if (env variable of v_align is set)
ncp->v_align = env value
else if (MPI info hint of v_align is set)
ncp->v_align = hint value
else if (v_align passed to ncmpi__enddef() > 0)
ncp->v_align = v_align + 4 - v_align % 4;
else /* Not set by user, <= 0 */
ncp->v_align = 0;
if has fix-sized variables
if ncp->v_align > 0 /* v_align is set by users */
use it
else
ncp->v_align = default 512
* use ncp->v_align to set ncp->begin_var
if ncp->r_align > 0 /* r_align is set by users */
use it
else
ncp->r_align = default 4
* use ncp->r_align to set ncp->begin_rec
else
discard ncp->v_align
discard ncp->v_minfree
if ncp->r_align > 0 /* r_align is set by users */
use it
else
ncp->r_align = default 512
* use ncp->r_align to set ncp->begin_rec
* set ncp->begin_var == ncp->begin_rec
Do not reuse ncp->v_align or ncp->r_align in next ncmpi_enddef() !
0a86faa to
68b7f20
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This handles the case when file header extent does not grow after adding new variable. In addition, the case when adding new record variables does not grow the starting offset of record variable section.