-
Notifications
You must be signed in to change notification settings - Fork 519
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
Add support for partial delete success #3781
Conversation
|
||
namespace Microsoft.Health.Fhir.Core.Exceptions | ||
{ | ||
public class PartialDeleteSuccessException : MicrosoftHealthException |
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.
In the context of an exception, I still prefer the terminology of "Incomplete" over "PartialSuccess" 🤔
I'd also argue this is a form of RequestTooCostlyException
.
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.
I like the name better, but I'm hesitant on Request Too Costly. We currently handle those with a 401, and I think 429 is the correct response for this. The request isn't bad, we just are unable to make it work in one pass.
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.
Switched and changed it to use code 413, request too large.
public class PartialDeleteSuccessException : MicrosoftHealthException | ||
{ | ||
public PartialDeleteSuccessException(int numberOfResourceVersionsDeleted) | ||
: base(Resources.PartialDeleteSuccess.Replace("{0}", numberOfResourceVersionsDeleted.ToString(), StringComparison.Ordinal)) |
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.
Should this be using string.Format?
Description
If Cosmos DB runs out of RUs while performing a delete operation it will roll back the transaction. This can lead to a situation where it is impossible to delete a resource because it has too much history to delete in one pass. This PR add the ability to optionally support partial delete success. This allows for the service to delete as much of a resource as it can, and leave the rest for a later delete operation. By rerunning the delete operation eventually the resource will be deleted.
Related issues
Addresses AB#118312
Testing
Manually tested. Working on unit tests. E2E tests aren't possible as the scenario is hard to manufacture.
FHIR Team Checklist
Semver Change (docs)
Patch