Skip to content
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

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

heemin32
Copy link
Collaborator

Description

Revert datasource state when delete fails

Issues Resolved

N/A

Check List

  • Commits are signed per the DCO using --signoff

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.

@heemin32 heemin32 added bug Something isn't working backport 2.x Backport PR to 2.x branch labels Aug 15, 2023
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #382 (885a14e) into main (d8718ad) will increase coverage by 0.28%.
The diff coverage is 87.50%.

@@             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     
Files Changed Coverage Δ
...ip2geo/action/DeleteDatasourceTransportAction.java 86.53% <87.50%> (-0.13%) ⬇️

... and 3 files with indirect coverage changes

try {
geoIpDataDao.deleteIp2GeoDataIndex(datasource.getIndices());
} catch (Exception e) {
if (previousState.equals(datasource.getState()) == false) {
Copy link
Member

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().

Copy link
Collaborator Author

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".

Copy link
Member

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

@heemin32 heemin32 merged commit f4514c1 into opensearch-project:main Aug 16, 2023
@heemin32 heemin32 deleted the patch branch August 16, 2023 02:10
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 16, 2023
Signed-off-by: Heemin Kim <[email protected]>
(cherry picked from commit f4514c1)
heemin32 added a commit that referenced this pull request Aug 17, 2023
Signed-off-by: Heemin Kim <[email protected]>
(cherry picked from commit f4514c1)

Co-authored-by: Heemin Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport PR to 2.x branch bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants