Skip to content

Commit 9301dba

Browse files
committed
Bug fix #1 after rebasing onto ADIOS2 append mode
We need RW-mode in some places when re-parsing
1 parent 115242f commit 9301dba

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/Series.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,22 @@ std::optional<std::deque<uint64_t> > 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;
11421154
IOHandler()->enqueue(IOTask(&series.iterations, pList));
@@ -1160,7 +1172,12 @@ std::optional<std::deque<uint64_t> > 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
@@ -1229,7 +1246,7 @@ std::optional<std::deque<uint64_t> > Series::readGorVBased(bool do_init)
12291246
for (auto const &it : *pList.paths)
12301247
{
12311248
uint64_t index = std::stoull(it);
1232-
readSingleIteration(index, it, true);
1249+
withRWAccess([&]() { readSingleIteration(index, it, true); });
12331250
}
12341251
if (currentSteps.has_value())
12351252
{
@@ -1249,7 +1266,7 @@ std::optional<std::deque<uint64_t> > Series::readGorVBased(bool do_init)
12491266
}
12501267
for (auto it : res)
12511268
{
1252-
readSingleIteration(it, "", false);
1269+
withRWAccess([&]() { readSingleIteration(it, "", false); });
12531270
}
12541271
return res;
12551272
}

0 commit comments

Comments
 (0)