Search code examples
google-cloud-platformgoogle-cloud-firestoregoogle-cloud-datastore

Firestore Datastore Mode write/read consistency


I have a project created with Cloud Firestore Datastore Mode.

I perform write operation using com.google.cloud.datastore.Datastore.put without transaction, just after performing write I perform read operation for the just written record using com.google.cloud.datastore.Datastore.get. But as far as I see in some cases read operation doesn't return just written value.

This looks like eventual consistency but according to this https://cloud.google.com/datastore/docs/firestore-or-datastore 'Cloud Firestore Datastore Mode' is strongly consistent database.

Is it possible that write operation isn't strong consistent if you perform it without transaction? According to this https://cloud.google.com/datastore/docs/concepts/transactions transactions are optional and I didn't find any information that they are required to make Firestore Datastore strongly consistent.

Is it required to setup something to make strong consistency work?


Solution

  • Because you aren’t using transactions, there is a chance that your read action will execute before your write action finishes. This could happen because of a large volume of traffic or a large write size. Using transactions will prevent this from happening because you can allow a read action to only run after a write action finishes.