1

Recently I am encountering an issue that my CosmosDBTrigger Azure Function would only capture my last update record when it's restarting, or sometimes it's not even getting the chance to trigger from restarting if there is document change during the restarting period.

Function 1 is used to update my item (A, B and C) price from collection through the HttpTrigger.

Function 2 is going to track the update event and log them into database through the CosmosDBTrigger with lease document of course.

If my Function 2 stopped, while during the restarting period, there are 3 Http calls to my Function 1 which update couple of my items' price of total 3 times, e.g

A price $1 --(1st update)--> $2 --(2nd update)--> $3 --(3rd update)--> $4
B price $2 --(1st update)--> $4 --(2nd update)--> $6 --(3rd update)--> $8
C price $3 --(1st update)--> $6 --(2nd update)--> $9 --(3rd update)--> $12

After my Function 2 restarted, two issues I found:

  1. Sometime my Function 2 won't trigger, meaning it lost all the updates, and it happened randomly...(I assume lease collection will store the checkpoints for each DB update, and CosmosDBTrigger will look at lease document for each checkpoint to recapture from last time it stops, correct?)
  2. Whenever my Function 2 is able to trigger after restarting, I assume it would be able to capture all my 3 updates to my items A, B and C, However it didn't capture my first 2 updates but only capture the very last update which is
A price $4
B price $8
C price $12

For No.1, why would the CosmosDBTrigger sometimes could capture my previous change but sometimes fail? W're really concerned about this as first it happened randomly, second we might lost our data due to unexplained reason...

Is there any time period for storing the update temporarily like 30s, 60s? Or would the lease collection override my previous update at checkpoint? So inside the lease collection, what does each item represents?

For No.2, Was this scenario by design, or is there something I did incorrectly , or any setting could help me track/persist all update changes (in a history) so that later on I can capture all updates then pass through CosmosDBTrigger function?

Drex
  • 3,346
  • 9
  • 33
  • 58
  • Have you found the reason for this? I would also like to know what causes this and how to fix it – Animesh Nov 15 '19 at 09:41

0 Answers0