-
Notifications
You must be signed in to change notification settings - Fork 451
Description
With the deprecation of the batch() method in the Firestore PHP SDK, I noticed that BulkWriter is being recommended as an alternative for performing multiple writes. However, it's unclear whether BulkWriter supports atomic write operations, where all writes either succeed or fail as a single unit.
Previously, the batch() method allowed for atomic operations using Google\Cloud\Firestore\WriteBatch. This feature was crucial for maintaining data consistency in scenarios where multiple writes needed to be applied together.
I came across this detailed comparison of Batched Writes vs. BulkWriter, which indicates that only Batched Writes support atomicity. While this aligns with the current understanding, I would like to confirm directly with the Google Cloud PHP development team whether BulkWriter provides a way to perform atomic writes or if there is another recommended alternative post-batch() deprecation.
Observation
I recently noticed an issue where duplicate increments occurred on a value in a Firestore collection. Unfortunately, I don’t have proper logs to confirm the root cause, but I suspect it might be related to BulkWriter retrying failed writes. This raised concerns about whether BulkWriter can guarantee atomicity or if retries might lead to inconsistent results in certain scenarios.