Skip to content

Commit 83ec128

Browse files
committed
Bug fix #1 after rebasing onto ADIOS2 append mode
We need RW-mode in some places when re-parsing
1 parent 96c29b4 commit 83ec128

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/Series.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,13 +1133,25 @@ Series::readGorVBased( bool do_init )
11331133
IOHandler()->enqueue(IOTask(&series.iterations, pOpen));
11341134

11351135
readAttributes( ReadMode::IgnoreExisting );
1136+
1137+
auto withRWAccess = [ this ]( auto && functor ) {
1138+
auto oldType = IOHandler()->m_frontendAccess;
1139+
auto newType = const_cast< Access * >( &IOHandler()->m_frontendAccess );
1140+
*newType = Access::READ_WRITE;
1141+
std::forward< decltype( functor ) >( functor )();
1142+
*newType = oldType;
1143+
};
1144+
11361145
/*
11371146
* 'snapshot' changes over steps, so reread that.
11381147
*/
1139-
series.iterations.readAttributes( ReadMode::OverrideExisting );
1148+
withRWAccess( [ &series ]() {
1149+
series.iterations.readAttributes( ReadMode::OverrideExisting );
1150+
} );
1151+
11401152
/* obtain all paths inside the basepath (i.e. all iterations) */
11411153
Parameter< Operation::LIST_PATHS > pList;
1142-
IOHandler()->enqueue(IOTask(&series.iterations, pList));
1154+
IOHandler()->enqueue( IOTask( &series.iterations, pList ) );
11431155
IOHandler()->flush();
11441156

11451157
auto readSingleIteration =
@@ -1160,7 +1172,12 @@ Series::readGorVBased( bool do_init )
11601172
{
11611173
pOpen.path = path;
11621174
IOHandler()->enqueue( IOTask( &i, pOpen ) );
1175+
auto oldType = IOHandler()->m_frontendAccess;
1176+
auto newType =
1177+
const_cast< Access * >( &IOHandler()->m_frontendAccess );
1178+
*newType = Access::READ_WRITE;
11631179
i.reread( path );
1180+
*newType = oldType;
11641181
}
11651182
}
11661183
else
@@ -1234,7 +1251,7 @@ Series::readGorVBased( bool do_init )
12341251
for( auto const & it : *pList.paths )
12351252
{
12361253
uint64_t index = std::stoull( it );
1237-
readSingleIteration( index, it, true );
1254+
withRWAccess( [&](){ readSingleIteration( index, it, true ); } );
12381255
}
12391256
if( currentSteps.has_value() )
12401257
{
@@ -1254,7 +1271,7 @@ Series::readGorVBased( bool do_init )
12541271
}
12551272
for( auto it : res )
12561273
{
1257-
readSingleIteration( it, "", false );
1274+
withRWAccess( [&](){ readSingleIteration( it, "", false ); } );
12581275
}
12591276
return res;
12601277
}

0 commit comments

Comments
 (0)