0
votes

I'm using Java to query Azure Table and I'd like to retrieve all entities with a given partitionid using the following code. However as there are the following restriction in Azure Table, I'd like to know how they should be resolved. The restrictions I'm concerned are:

1) As Azure Table has paging mechanism in place, if a partition contains more a certain number of entities (I believe it's 1000), it return the first 1000 entities. How can I get all the records in m code.

2) As the entries per second for each partition is 2000, what happens if the partition contains more than 2000 entries and multiple instances of my application queries the same partition at the same time?

String partitionFilter = TableQuery.generateFilterCondition(
       "PartitionKey", 
       QueryComparisons.EQUAL,
       term);


   TableQuery<AzureTableDFEntity> partitionQuery =
       TableQuery.from(AzureTableDFEntity.class)
       .where(partitionFilter);

    // Loop through the results
  int count = 0;
  for (AzureTableDFEntity entity : cloudTableIDF.execute(partitionQuery)) {
        count++;                            
   }
1

1 Answers

3
votes

1) Using execute will automatically and lazily follow the continuation tokens from page to page of results. executeSegmented will not. So, the code you have should work just fine for paging.

2) You could get throttled if you pass the limit or have spikes. For example, 0 to 2000 very quickly will get throttled as the system load balances. The library has a retry policy mechanism in place by default (exponential) which will retry throttled requests a few times. You can change the retry policy settings or use a custom retry policy as well. See the TableRequestOptions class and the Retry*Retry classes for more info.