-
Notifications
You must be signed in to change notification settings - Fork 38
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
Revert datasource state when delete fails #382
Conversation
Signed-off-by: Heemin Kim <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #382 +/- ##
============================================
+ Coverage 88.41% 88.70% +0.28%
- Complexity 751 753 +2
============================================
Files 92 92
Lines 2711 2718 +7
Branches 220 221 +1
============================================
+ Hits 2397 2411 +14
+ Misses 233 228 -5
+ Partials 81 79 -2
|
try { | ||
geoIpDataDao.deleteIp2GeoDataIndex(datasource.getIndices()); | ||
} catch (Exception e) { | ||
if (previousState.equals(datasource.getState()) == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the scenario when datasource has previous state? We're setting it to "deleting" before we call delete method in setDatasourceStateAsDeleting().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We first change the datasource state to "deleting" and run the delete process. So, datasource always has previous state either "available", "create_failed", or "deleting".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got more info on scenario, we need to delete two resources(index and metadata), if we fail to delete metadata, we don’t revert state because index for data is already deleted
Signed-off-by: Heemin Kim <[email protected]> (cherry picked from commit f4514c1)
Signed-off-by: Heemin Kim <[email protected]> (cherry picked from commit f4514c1) Co-authored-by: Heemin Kim <[email protected]>
Description
Revert datasource state when delete fails
Issues Resolved
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.