Open johnnyoshika opened 2 years ago
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
Issue updated with all sections completed
Thanks for the thorough report. We'll take a look.
I filed an internal b/211321190 to track this.
@weixifan were you able to reproduce it?
[REQUIRED] Environment info
firebase-tools: 9.16.0
Platform: Windows
[REQUIRED] Test case
Example script to demonstrate the bug:
[REQUIRED] Steps to reproduce
Execute the script above and while the process is sleeping, change the document
count
field to10
using the Firestore Emulator Console. Here's a diagram of the steps:[REQUIRED] Expected behavior
The expected behavior is that it behaves exactly the same as Firestore in the cloud. In other words, the expected behavior is that the transaction holds a pessimistic lock on the document. When running the same script against Firestore in the cloud, if the document
count
field is set to10
while the script is sleeping, it gets blocked and waits until the transaction completes. So in other words, the order of operation is:The final result is
count == 10
.[REQUIRED] Actual behavior
When using the emulator, the transaction does NOT hold a pessimistic lock on the document. Instead, it operates optimistically and reruns the transaction on concurrent edit. In other words, the order of operation is:
The final result is
count == 11
.