zeppelin
zeppelin copied to clipboard
[ZEPPELIN-6269] Handle remove failures in NotebookRepoSync to prevent data inconsistency
What is this PR for?
If an IOException occurs while trying to remove a note from one of the repositories, the for loop would terminate immediately. This leaves the note in an inconsistent state where it is deleted from some repositories but not from others, leading to data inconsistency.
Approach
- The method will now attempt to remove the note from all configured repositories, even if an error occurs with one of them.
- Any repository that fails to remove the note is added to a
failedReposlist. - After iterating through all repositories, the method checks the
failedReposlist. If the list is not empty, it throws a singleIOExceptionthat includes information about all the repositories where the removal failed.
What type of PR is it?
Refactoring
Todos
- [x] - Refactor remove method
- [x] - Add test for modified method
What is the Jira issue?
How should this be tested?
- Added simple integration test in
NotebookRepoSyncTest.
Screenshots (if appropriate)
Questions:
- Does the license files need to update? - No
- Is there breaking changes for older versions? - No
- Does this needs documentation? - No
@jongyoul It would be a nicer approach. Let me show you a draft. :)
@jongyoul I just pushed modified version. How about this approach? if it fails, we can raise exception immediately, so we can avoid out-of-sync status.