-
Notifications
You must be signed in to change notification settings - Fork 0
CSTACKEX-158: if ontap snapshot are already delete from ontap side, d… #82
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,4 +239,23 @@ public static String extractUuidFromOntapJobDescription(String description, Stri | |
| return remainder.isEmpty() ? null : remainder; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true when the exception indicates the ONTAP Object was already removed. | ||
| * Delete workflows treat a missing backend object as idempotent success. | ||
| */ | ||
| public static boolean isOntapObjectNotFoundError(Throwable error) { | ||
| if (error == null) { | ||
| return false; | ||
| } | ||
| String message = error.getMessage(); | ||
| if (message != null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if message is null somehow, I think func run infinitely ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't recurse indefinitely, as we already have a null check at the beginning of the method. My intent here is to ensure that a 404 (Not Found) condition is not missed simply because the exception is wrapped or thrown through multiple nested layers. |
||
| String lower = message.toLowerCase(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is better to check the status code as 404
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep the implementation generic, I chose to rely on the exception message rather than a specific error code. We could certainly check for error codes as well, but that would make the logic more implementation-specific and reduce its reusability across different scenarios. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but for any entity which is not found, we will receive 404 error code,
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these checks are placed at exception handling level. Error code related checks can be handled at feign response level.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The snapshot delete operation is asynchronous and initially returns a job response. As a result, any "snapshot not found" condition would typically be surfaced during job polling rather than as an immediate response to the DELETE request. Therefore, we should not expect a direct 404 from the initial delete call. ONTAP uses its own error codes for these scenarios, which are reported through the asynchronous job status and results. |
||
| if (lower.contains("404") || lower.contains("not found") || lower.contains("does not exist") | ||
| || lower.contains("entry doesn't exist")) { | ||
| return true; | ||
| } | ||
| } | ||
| return isOntapObjectNotFoundError(error.getCause()); | ||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.