firestore: bulkwriter loses documents #11418
Labels
api: firestore
Issues related to the Firestore API.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Client
firestore
Environment
go 1.23.4
Code and Dependencies
Here is a simplified example of the code generating the faulty behaviour.
Call the function with a larger slice of objects to persist (several thousands).
go.mod
Expected behavior
All documents passed to a BulkWriter are written to the database. If some documents fail, an error is thrown.
Actual behavior
When adding documents quickly to a bulkWriter, some documents are skipped silently. The bulk operation succeeds but there is no indication that any data is missing.
Possible explanation/work-around
After reading the source code, the following work-around was created to make sure that no documents are skipped.
The faulty code seems to be the silencing of errors coming from the
bundler.Add
function:It's possible that the bundler is throwing an
ErrOverflow
error when the document addition rate to the queue is faster than the Firestore persistence rate.The text was updated successfully, but these errors were encountered: