Skip to content

Commit

Permalink
Bug fix #1 after rebasing onto ADIOS2 append mode
Browse files Browse the repository at this point in the history
We need RW-mode in some places when re-parsing
  • Loading branch information
franzpoeschel committed Jan 5, 2022
1 parent 96c29b4 commit 83ec128
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,13 +1133,25 @@ Series::readGorVBased( bool do_init )
IOHandler()->enqueue(IOTask(&series.iterations, pOpen));

readAttributes( ReadMode::IgnoreExisting );

auto withRWAccess = [ this ]( auto && functor ) {
auto oldType = IOHandler()->m_frontendAccess;
auto newType = const_cast< Access * >( &IOHandler()->m_frontendAccess );
*newType = Access::READ_WRITE;
std::forward< decltype( functor ) >( functor )();
*newType = oldType;
};

/*
* 'snapshot' changes over steps, so reread that.
*/
series.iterations.readAttributes( ReadMode::OverrideExisting );
withRWAccess( [ &series ]() {
series.iterations.readAttributes( ReadMode::OverrideExisting );
} );

/* obtain all paths inside the basepath (i.e. all iterations) */
Parameter< Operation::LIST_PATHS > pList;
IOHandler()->enqueue(IOTask(&series.iterations, pList));
IOHandler()->enqueue( IOTask( &series.iterations, pList ) );
IOHandler()->flush();

auto readSingleIteration =
Expand All @@ -1160,7 +1172,12 @@ Series::readGorVBased( bool do_init )
{
pOpen.path = path;
IOHandler()->enqueue( IOTask( &i, pOpen ) );
auto oldType = IOHandler()->m_frontendAccess;
auto newType =
const_cast< Access * >( &IOHandler()->m_frontendAccess );
*newType = Access::READ_WRITE;
i.reread( path );
*newType = oldType;
}
}
else
Expand Down Expand Up @@ -1234,7 +1251,7 @@ Series::readGorVBased( bool do_init )
for( auto const & it : *pList.paths )
{
uint64_t index = std::stoull( it );
readSingleIteration( index, it, true );
withRWAccess( [&](){ readSingleIteration( index, it, true ); } );
}
if( currentSteps.has_value() )
{
Expand All @@ -1254,7 +1271,7 @@ Series::readGorVBased( bool do_init )
}
for( auto it : res )
{
readSingleIteration( it, "", false );
withRWAccess( [&](){ readSingleIteration( it, "", false ); } );
}
return res;
}
Expand Down

0 comments on commit 83ec128

Please sign in to comment.