Azure / Azure/azure-documentdb-java
Query same collection after delete will fail with `the requested resource is no longer available at the server.`
- Dominant language
- Java
- Stars
- 51
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
When create the database with collection somewhat like /dbs/testdb/colls/testcolls, it will throw following exception of resource unavailable from SDK side.
Consider the pseudo code in below
1. create database and collection, then insert and query.
2. delete the collection
3. create the collection with the same name
4. insert and query.
```
createDatabase();
createCollection();
insertAndQuery();
deleteCollection();
createCollection();
LOGGER.info("Sleep 10 seconds");
Thread.sleep(10000);
LOGGER.info("Sleep 10 seconds finished");
insertAndQuery();
deleteDatabase();
```
```
java.lang.IllegalStateException: com.microsoft.azure.documentdb.DocumentClientException: Message: {"Errors":["The requested resource is no longer available at the server."]}
ActivityId: c93d9967-29f3-4d12-b3b0-630140779e43, Request URI: /apps/c2d19637-ce94-4a48-90d4-9238c827330e/services/107bff02-f7ab-4d80-96ad-b176d75edf85/partitions/4d3066d9-fb56-437f-8439-a51b0e96e987/replicas/131792032246807108s/, RequestStats:
ResponseTime: 2018-08-20T02:51:13.9627192Z, StoreReadResult: StorePhysicalAddress: rntbd://bz6prdapp02-docdb-1.documents.azure.com:14045/apps/c2d19637-ce94-4a48-90d4-9238c827330e/services/107bff02-f7ab-4d80-96ad-b176d75edf85/partitions/4d3066d9-fb56-437f-8439-a51b0e96e987/replicas/131792032246807108s/, LSN: 7, GlobalCommittedLsn: 7, PartitionKeyRangeId: , IsValid: True, StatusCode: 0, IsGone: True, IsNotFound: False, IsInvalidPartition: True, RequestCharge: 0, ItemLSN: -1, ResourceType: Document, OperationType: Query
, SDK: Microsoft.Azure.Documents.Common/2.0.0.0, StatusCode: InvalidPartition
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.next(DefaultQueryExecutionContext.java:83)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.next(DefaultQueryExecutionContext.java:33)
at com.microsoft.azure.documentdb.internal.query.ProxyQueryExecutionContext.(ProxyQueryExecutionContext.java:68)
at com.microsoft.azure.documentdb.internal.query.QueryExecutionContextFactory.createQueryExecutionContext(QueryExecutionContextFactory.java:23)
at com.microsoft.azure.documentdb.QueryIterable.createQueryExecutionContext(QueryIterable.java:70)
at com.microsoft.azure.documentdb.QueryIterable.reset(QueryIterable.java:115)
at com.microsoft.azure.documentdb.QueryIterable.(QueryIterable.java:57)
at com.microsoft.azure.documentdb.DocumentClient.queryDocuments(DocumentClient.java:1184)
at com.microsoft.azure.documentdb.DocumentClient.queryDocuments(DocumentClient.java:1155)
```
Contributor guide
Assessment
This issue has not been assessed yet.