Azure / Azure/azure-sdk-for-java

[BUG]Request fail with 400/1024 when container is re-created with same name

Open
#49,097 0 comments 0 reactions 1 assignee Claimed by @xinlian12 View on GitHub
Client Cosmos cosmos:v4-item
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

Repro steps:
- client is on gateway mode
- create container A, verify the collectionRid
- do some read/write/query operations using the container
- delete the container
- re-create the container with same name
- verify the collectionRid is different than the previous one
- do read/write/query operation, fail with com.azure.cosmos.CosmosException: {"innerErrorMessage":"{\"Errors\":[\"Collection rid provided by the user does not match the existing collection.\"]}, StatusCode: BadRequest"}

Root cause:
TBD, but could be related to the following context not being reset during retry:
request.forceNameCacheRefresh = true;
request.requestContext.resolvedCollectionRid = null;

Tests converge after fix:
- need to make sure container recreate scenario works for direct mode
- need to make sure container recreate scenarios works for gateway mode
- need to make sure container recreate scenarios works for all operation types

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.