Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification or Solution for Atomic Operations Post batch() Deprecation #8010

Open
haizadvnet opened this issue Jan 13, 2025 · 0 comments
Open

Comments

@haizadvnet
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant