Clarification or Solution for Atomic Operations Post batch() Deprecation
@Hectorhammett is already working on this.
Since Nov 17, 2025.
Assessment
This issue has not been assessed yet.
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.
- Dominant language
- PHP
- Stars
- 1.2k
- Forks
- 464
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 103
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-cloud-php
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
googleapis/google-cloud-php#9730 ·
-
type: feature request
Difficulty 1/5 Under an hour Newbie friendliness 75/100
googleapis/google-cloud-php#9716 · 11 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
googleapis/google-cloud-php#9725 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
googleapis/google-cloud-php#9675 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
googleapis/google-cloud-php#9674 · 1 comment ·
All issues in googleapis/google-cloud-php
Similar issues
-
tooling
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
UX
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
OpenConext/OpenConext-engineblock#2122 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·