Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TableQuerySegment ContinuationToken never gets null.

felipsant opened this issue · comments

Which service(blob, file, queue, table) does this issue concern?

table

Which version of the SDK was used?

1.0.8

Which platform are you using? (ex: .NET Core 2.1)

.Net Core 3.1

What problem was encountered?

I have a really huge table in Azure Storage, and I filter by the TimeStamp only, but My continuationtoken is never null, even with 0 results, so I have a infinite loop.

How can we reproduce the problem in the simplest way?

Create a really huge data table, with over 10.000 records by minutes. Run an Query filtering by the timestamp only.

var query = TableQuery.CombineFilters(
TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.LessThan, startDate.AddMinutes(15)),
TableOperators.And,
TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.GreaterThanOrEqual, startDate));
return new TableQuery().Where(query).Select(new List { "PartitionKey", "RowKey", "Timestamp" });

TableContinuationToken dataToken = null;
do
{
TableQuerySegment querySegment = await table.ExecuteQuerySegmentedAsync(query, dataToken);
total += querySegment.Results.Count;
dataToken = querySegment.ContinuationToken;
}
while (dataToken != null);

Have you found a mitigation/solution?

breaking the loop if the returned count is 0.

Table support has moved to the CosmosDB NuGet package. Please follow up there.

https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table