Storage createOrUpdateRecord api fails with 500 if too many versions of the same recordId are created
We've been observing this issue where users try to create too many versions of the same recordId. The versions are stored as part of the record metadata in CosmosDb (StorageRecord table). When the metadata reaches a size limit (around 2MB), adding more versions to the list fails.
This failure in CosmosDb operation is returned as an internal server error (500) from Storage. This should rather be a 4xx (413 Request too large) exception.
- Catch RequestEntityTooLargeException explicitly in core-lib-azure https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/blob/master/src/main/java/org/opengroup/osdu/azure/cosmosdb/CosmosStore.java#L522
- Gracefully handle the exception from core-lib-azure in Storage, instead of always throwing a 500 https://community.opengroup.org/osdu/platform/system/storage/-/blob/master/storage-core/src/main/java/org/opengroup/osdu/storage/service/PersistenceServiceImpl.java#L132