1

As it said there https://msdn.microsoft.com/en-us/library/azure/dd135718.aspx

"It is possible for a query to return no results but to still return a continuation header."

So my question is - what then should the behaviour of caller be?

  1. Retry again after some time?
  2. Consider it as end of the results set?
  3. Make new query without cont. token updating filters based on the last data retrieved?

It is also said, "A query against the Table service may return a maximum of 1,000 items at one time and may execute for a maximum of five seconds. If the result set contains more than 1,000 items, if the query did not complete within five seconds, or if the query crosses the partition boundary, the response includes headers which provide the developer with continuation tokens to use in order to resume the query at the next item in the result set. Continuation token headers may be returned for a Query Tables operation or a Query Entities operation."

So it looks like the retry strategy can lead us into infinite loop when empty results with continuation token is always returned...

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • I seem to be running into an infinite loop (or near infinite loop that exits seemingly arbitrarily since each result set is always empty). You assumptions about the retry logic appear to be correct, but I would love clarity into what the best programming pattern really should be. – bojingo May 18 '16 at 00:25

1 Answers1

1

You should immediately build and use the next query and pass the continuation token in it. As described here: Query Timeout and Pagination. The table storage will be searched beginning from the position where the previous request ended. You got an empty result because the table storage didn´t find any matching data within the five seconds, but there are still data left to search.

After you have retrieved the continuation tokens, use their values to construct a query to return the next page of results.

If you use .NET and the assembly Microsoft.WindowsAzure.Storage there is a BeginExecuteQuerySegmented method which builds all the requests for you. Example: https://stackoverflow.com/a/13428086/1051244

Community
  • 1
  • 1
huha
  • 4,053
  • 2
  • 29
  • 47