带有 ORDER BY 的 Documentdb SDK 导致 ServiceUnavailableException
Document DB SDK with ORDER BY caused ServiceUnvailableException
我正在使用 DocumentDB。给定索引策略:
messageType: 字符串 - 精度 -1
deviceId: 字符串 - 精度 -1
查询 1:
SELECT * FROM c WHERE c._ts >= 1563721200 AND c._ts < 1563807600 AND c.messageType = 'attack' AND c.deviceId >= 'A' AND c.deviceId < 'Z'
查询 2:
SELECT * FROM c WHERE c._ts >= 1563721200 AND c._ts < 1563807600 AND c.messageType = 'attack' AND c.deviceId >= 'A' AND c.deviceId < 'Z' ORDER BY c._ts DESC
执行代码:
var query = dbClientSource.CreateDocumentQuery<Document(UriFactory.CreateDocumentCollectionUri(db, collection),
sql,
new FeedOptions { MaxItemCount = 100, EnableCrossPartitionQuery = true })
.AsDocumentQuery();
while (query.HasMoreResults)
var result = await query.ExecuteNextAsync<Telemetry>();
查询 1 有效,但查询 2 抛出异常:
{
"code": "ServiceUnavailable",
"message": "The request failed because the client was unable to establish connections to 1 endpoints across 1 regions. The client CPU was overloaded during the attempted request.
}
不同的是"ORDER BY"命令。
有什么解决办法吗?
我在门户中测试了查询 2,它非常有效。
因此,在应用程序中,我将 ConnectionPolicy 更改为:
网关 - Https
现在应用程序正在运行。
这个问题看起来与 Document DB SDK 有关,以确保我会继续测试并报告给 Github 存储库。
我正在使用 DocumentDB。给定索引策略:
messageType: 字符串 - 精度 -1
deviceId: 字符串 - 精度 -1
查询 1:
SELECT * FROM c WHERE c._ts >= 1563721200 AND c._ts < 1563807600 AND c.messageType = 'attack' AND c.deviceId >= 'A' AND c.deviceId < 'Z'
查询 2:
SELECT * FROM c WHERE c._ts >= 1563721200 AND c._ts < 1563807600 AND c.messageType = 'attack' AND c.deviceId >= 'A' AND c.deviceId < 'Z' ORDER BY c._ts DESC
执行代码:
var query = dbClientSource.CreateDocumentQuery<Document(UriFactory.CreateDocumentCollectionUri(db, collection),
sql,
new FeedOptions { MaxItemCount = 100, EnableCrossPartitionQuery = true })
.AsDocumentQuery();
while (query.HasMoreResults)
var result = await query.ExecuteNextAsync<Telemetry>();
查询 1 有效,但查询 2 抛出异常:
{
"code": "ServiceUnavailable",
"message": "The request failed because the client was unable to establish connections to 1 endpoints across 1 regions. The client CPU was overloaded during the attempted request.
}
不同的是"ORDER BY"命令。 有什么解决办法吗?
我在门户中测试了查询 2,它非常有效。 因此,在应用程序中,我将 ConnectionPolicy 更改为:
网关 - Https
现在应用程序正在运行。 这个问题看起来与 Document DB SDK 有关,以确保我会继续测试并报告给 Github 存储库。