Skip to content

Adding exception handling in IsUnique checks

Aman Verma requested to merge users/amaverma/fixIsUniqueBug into master

All Submissions:


  • [YES/NO] I have added an explanation of what changes in this merge do and why we should include it? YES
  • [YES/NO] Does the MR contain pipeline/ helm chart related changes? NO
  • [YES/NO] I have updated the documentation accordingly. NA
  • [YES/NO/NA] I have added tests to cover my changes. YES
  • [YES/NO/NA] All new and existing tests passed. YES
  • [YES/NO/NA] My code follows the code style of this project. YES
  • [YES/NO/NA] I ran lint checks locally prior to submission. NA

What is the issue or story related to the change?


POST calls to create schemas fail with NullPointerException while creating cosmos client

High level design:

In the IsUnique check, we iterate over each tenant to see whether the schema that we are trying to create is already present there. If the call to cosmos DB fails for one of the tenants, the entire loop crashed down without graceful handling.

Adding proper exception handling for such cases

PS: Why were the cosmos db calls failing?

There were some test tenants in tenantInfo table for which we did not have cosmos end point information populated in partition service. Hence for those test tenants the cosmosCLient generation would fail. This won't repro in all the environments because they might not have these incompletely populated tenants present there. Issue:

Change details:

  • Added a try catch block
  • Added UTs

Test coverage:


88%

Does this introduce a breaking change?


  • [YES/NO] NO

Pending items


Reviewer request


  • Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
  • Block the MR if you feel there is less testing or no details in the MR
  • Please cover the following aspects in the MR -- Coding design: <Reviewer1> -- Backward Compatibility: <Reviewer2> -- Feature Logic: <Logic design> -- <Any other context mention here> OR -- <Component 1>: <Reviewer1> -- <CosmosDB>: <Reviewer2> -- <ServiceBus> <Reviewer3> -- <Mention any other component and owner>

Other information


cc: @harshit283 @osdu/platform/roles/azure-contributors

Merge request reports