Interrupt backup from event listeners #1559
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request is about giving the ability to interrupt the backup from the listeners of the following events:
DumpingDatabase
BackupManifestWasCreated
BackupZipWasCreated
Those events can be used to execute last-minute processes e.g. files can be added to the backup with the BackupManifestWasCreated listener. These processes could generate errors, making the backup invalid.
Thanks to this PR, a
BackupJobStepStatus
object is added to those 3 events and it comes with theinterruptBackupBecauseOfError
method which will cause the interruption of the backup if called.The previous situation was that any error occuring in one of the handlers of
BackupManifestWasCreated
orBackupZipWasCreated
(when notifications were enabled for the latter) were ignored and the backup was continuing anyway, and was eventually marked as successful.It is to be noted that exceptions thrown in the handler of
DumpingDatabase
would have caused the backup to be interrupted, but for the sake of coherence I've added the same interruption mechanism into it.This PR is linked to this discussion: #1550