Skip to content

Fix error when reading in linear mode from file-based Series #1748

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,9 +1288,16 @@ void Series::flushFileBased(
bool flushIOHandler)
{
auto &series = get();
if (end == begin)
/*
* Iterations might have been present, but have been closed and deleted from
* internal structures. In this case, previous flushes were successful and
* the Series is now in written() state.
*/
if (end == begin && !written())
{
throw std::runtime_error(
"fileBased output can not be written with no iterations.");
}

switch (IOHandler()->m_frontendAccess)
{
Expand Down
2 changes: 2 additions & 0 deletions src/snapshots/StatefulIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ std::optional<StatefulIterator *> StatefulIterator::loopBody(Seek const &seek)
else if (
series.IOHandler()->m_frontendAccess == Access::READ_LINEAR)
{
std::cout << "Closing Iteration " << *maybe_current_iteration
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove this bit again
just as a reminder for myself where this error is caused

<< std::endl;
data.series.iterations.container().erase(
*maybe_current_iteration);
}
Expand Down
Loading