Azure / azure-cosmosdb-bulkexecutor-dotnet-getting-started

Bulk Executor Utility for Azure Cosmos DB .NET SQL API
MIT License
66 stars 41 forks source link

BulkUpdateAsync with SetUpdateOperation never updates all the items #50

Open andremaree opened 5 years ago

andremaree commented 5 years ago

I have been testing BulkUpdateAsync() with 6225 updates in the list. It never updates all the items that it is supposed to, there are always 15-20 items that do not get updated. This issue is present in v1.5.1 and 2.3.0-preview:

List updateOperations = new List(); SetUpdateOperation nUpdate = new SetUpdateOperation("NValue", id.NValue); updateOperations.Add(nUpdate); updateItems.Add(new UpdateItem(id.id, id.PartitionKey, updateOperations)); } BulkUpdateResponse bulkUpdateResponse = await bulkExecutor.BulkUpdateAsync( updateItems: updateItems, maxConcurrencyPerPartitionKeyRange: null, maxInMemorySortingBatchSize: null, cancellationToken: token);

andremaree commented 5 years ago

This is happening when the RUs are low, with 5000 RUs it seems to update all that it should. But on 2000 RUs it constantly neglects to update 16 docs.

When this bug occurs the response states that all docs were updated but this is not the truth, some docs were not updated. The workaround for this will be to update a date and then the code will have to query again on the date to get the docs that were not updated and then to do the bulkUpdate again.

countincognito commented 5 years ago

I am having the same problem using 2.3.0-preview2.

The response comes back as having updated all the documents, but a quick sanity check reveals that not all were updated. Like @andremaree I am having to run the update twice just to have a reasonable chance of ensuring the update was successful.

What's strange is that the bulk import call doesn't seem to have this problem - as far as I can tell, that is always successful.

andremaree commented 5 years ago

I am having the same problem using 2.3.0-preview2.

The response comes back as having updated all the documents, but a quick sanity check reveals that not all were updated. Like @andremaree I am having to run the update twice just to have a reasonable chance of ensuring the update was successful.

What's strange is that the bulk import call doesn't seem to have this problem - as far as I can tell, that is always successful.

I have seen this bug with insert as well, but it happens much less seldom than update.

Joehannus commented 5 years ago

I had this issue too. And I had hoped that I might have found information about the items that were not updated in the FailedUpdates property of the UpdateResponse class. But unfortunately this property, which is described in the documentation, is not implemented in version 2.3.0-preview2.

See:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkupdate.bulkupdateresponse.failedupdates?view=azure-dotnet#Microsoft_Azure_CosmosDB_BulkExecutor_BulkUpdate_BulkUpdateResponse_FailedUpdates