ExecuteNextAsync不起作用 [英] ExecuteNextAsync Not Working

查看:64
本文介绍了ExecuteNextAsync不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Azure DocumentDB.我正在查看ExecuteNextAsync操作.我看到的是ExecuteNextAsync不返回任何重排.我使用的是我在网上找到的示例,并且不会产生任何结果.如果我对初始查询调用枚举操作,则返回结果.有没有显示使用ExecuteNextAsync的完整配置的示例?

I am working with Azure DocumentDB. I am looking at the ExecuteNextAsync operation. What I am seeing is the the ExecuteNextAsync returns no resluts. I am using examples I have found on line and don't generate any results. If I call an enumeration operation on the initial query results are returned. Is there an example showing the complete configuration for using ExecuteNextAsync?

更新 更明确地说,我实际上没有得到任何结果.该调用似乎只是在运行,并且没有错误生成.

Update To be more explicit I am not actually getting any results. The call seems to just run and no error is generated.

玩弄集合的定义,我发现当我将集合大小设置为250GB时,就会发生这种情况.我测试了10GB的存储集,并且确实工作了一段时间.最新测试表明该操作现在再次挂起.

Playing around with the collection defintion, I found that when I set the collection size to 250GB that this occurred. I tested with the collection to 10GB and it did work, for a while. Latest testing shows that the operation is now hanging again.

我生成了两个集合.第一个集合似乎正常工作.第二个似乎无法执行此操作.

I have two collections generated. The first collection appears to work properly. The second one appears to fail on this operation.

推荐答案

ExecuteNextAsync的单个调用可能返回0个结果,但是当您通过调用直到HasMoreResults为false来运行查询以完成查询时,您将始终得到完整的结果.

Individual calls to ExecuteNextAsync may return 0 results, but when you run the query to completion by calling it until HasMoreResults is false, you will always get the complete results.

几乎总是一次调用ExecuteNextAsync会返回结果,但是由于以下两个原因,您通常可以得到0个结果:

Almost always, a single call to ExecuteNextAsync will return results, but you may get 0 results commonly due to two reasons:

  • 如果查询是扫描,则DocumentDB将根据可用吞吐量进行部分处理.此处不会返回任何结果,但是会返回基于最新进度的新延续令牌以恢复执行.
  • 如果是跨分区查询,则每个调用都针对单个分区执行.在这种情况下,如果该分区没有与查询匹配的文档,则该调用将不返回任何结果.

如果希望查询确定性地返回结果,则必须使用SELECT TOP而不是使用延续令牌/ExecuteNextAsync作为分页机制.通过将FeedOptions.MaxDegreeOfParallelism更改为-1,您还可以跨多个分区并行读取查询结果.

If you want queries to deterministically return results, you must use SELECT TOP vs. using the continuation token/ExecuteNextAsync as a mechanism for paging. You can also read query results in parallel across multiple partitions by changing FeedOptions.MaxDegreeOfParallelism to -1.

这篇关于ExecuteNextAsync不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆