Azure / Azure/azure-documentdb-java

Query same collection after delete will fail with `the requested resource is no longer available at the server.`

未关闭
#118 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
51
派生
52
PR 合并指标
30 天内没有已合并 PR

描述

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)
```

贡献指南

打开贡献指南

调研方向

从 stack trace 开始,在 DocumentClient.queryDocuments 处启动,并依次跟踪 QueryIterable、QueryExecutionContextFactory、ProxyQueryExecutionContext 和 DefaultQueryExecutionContext,重现 create、delete、recreate、insert 和 query 序列。只要对重新创建的 collection 进行查询时未出现 InvalidPartition 或 resource-unavailable 异常并成功,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, java
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。