Skip to content

Commit

Permalink
Merge pull request #61466 from vitlibar/fix-finishing-failed-restore
Browse files Browse the repository at this point in the history
Fix finishing a failed RESTORE
  • Loading branch information
alexey-milovidov authored Mar 16, 2024
2 parents 32fb532 + 9bb697e commit f31beb9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Backups/RestorerFromBackup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ RestorerFromBackup::RestorerFromBackup(

RestorerFromBackup::~RestorerFromBackup()
{
if (!futures.empty())
/// If an exception occurs we can come here to the destructor having some tasks still unfinished.
/// We have to wait until they finish.
if (getNumFutures() > 0)
{
LOG_ERROR(log, "RestorerFromBackup must not be destroyed while {} tasks are still running", futures.size());
chassert(false && "RestorerFromBackup must not be destroyed while some tasks are still running");
LOG_INFO(log, "Waiting for {} tasks to finish", getNumFutures());
waitFutures();
}
}

Expand Down

0 comments on commit f31beb9

Please sign in to comment.