Repository navigation
Datastore - Inconsistent behavior of transactions between Datastore and Firestore in Datastore Mode #3582
Description
Activity
- addedtriage meI really want to be triaged.I really want to be triaged.
on Aug 20, 2018 - addedtype: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.api: firestoreIssues related to the Firestore API.Issues related to the Firestore API.
on Aug 20, 2018 - removedtriage meI really want to be triaged.I really want to be triaged.
on Aug 20, 2018 - added🚨 criticalP0 critical issue. Requires immediate fixP0 critical issue. Requires immediate fix
on Feb 15, 2019 - removed🚨 criticalP0 critical issue. Requires immediate fixP0 critical issue. Requires immediate fixpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.
on Feb 19, 2019 As per the google documentation Firestore in datastore mode has all the existing functionality of google cloud datastore with extra features.Currently you are getting DatastoreException "
The referenced transaction has expired or is no longer valid." just because of the entity that you are using for transactions.For the transaction t2 you change the nature of entity
t2.update(entity)and then commit transaction t2. Transaction t1 also refer same entityt1.get(entity.getKey())and while committing t1 you will get Datastore exception.Could you please check method level comment of get(Key key) method.For the transaction T1 could you please modified your code something like below because it's working fine in both project cloud datastore and firestore in datastore mode.
try { update(entity, datastore); com.google.cloud.datastore.Entity entity2 = t1.get(entity.getKey()); t1.commit(); System.out.println("t1 is committed successfully"); } finally { if (t1.isActive()) { t1.rollback(); } }closing this issue for now due to staleness and if above reply didn't help feel free to reopen it.
- added a commit that references this issue
on Mar 9, 2026
I'm seeing inconsistency in transactions behavior between Cloud Datastore and Cloud Firestore running in Datastore mode. The sample code below runs fine when working with Cloud Datastore, but fails when working with Cloud Firestore running in Datastore mode.
Running this code against good old Datastore completes normally and I get the below printed to the console:
However, running this against a different project_id, which has Firestore running in Datastore mode, produces the below exception, after running for about a minute:
Any idea why this difference? Which one is behaving correctly, Datastore or Firestore in Datastore mode?