GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Datastore - Inconsistent behavior of transactions between Datastore and Firestore in Datastore Mode · Issue #3582 · googleapis/google-cloud-java Closed Labels api: datastoreIssues related to the Datastore API.api: firestoreIssues related to the Firestore API.type: questionRequest for information or clarification. Not an issue. DescriptionI'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. import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.DatastoreOptions; import com.google.cloud.datastore.FullEntity; import com.google.cloud.datastore.IncompleteKey; import com.google.cloud.datastore.Transaction; public class TransactionTest { public static void main(String[] args) { //change it to a project ID that has plain old Datastore and then try again //with a different project that has Firestore running in Datastore mode. final String projectId = "xxx-xxx"; Datastore datastore = DatastoreOptions.newBuilder().setProjectId(projectId).build() .getService(); IncompleteKey incompleteKey = datastore.newKeyFactory().setKind("TransactionTest").newKey(); FullEntity<IncompleteKey> fullEntity = FullEntity.newBuilder().setKey(incompleteKey) .set("name", "Bob").build(); com.google.cloud.datastore.Entity entity = datastore.add(fullEntity); Transaction t1 = datastore.newTransaction(); try { com.google.cloud.datastore.Entity entity2 = t1.get(entity.getKey()); update(entity, datastore); t1.commit(); System.out.println("t1 is committed successfully"); } finally { if (t1.isActive()) { t1.rollback(); } } } private static void update(com.google.cloud.datastore.Entity entity, Datastore datastore) { Transaction t2 = datastore.newTransaction(); try { t2.update(entity); t2.commit(); System.out.println("t2 is committed successfully"); } finally { if (t2.isActive()) { t2.rollback(); } } } } 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? Activity
MetadataMetadataAssigneesLabelsapi: datastoreIssues related to the Datastore API.api: firestoreIssues related to the Firestore API.type: questionRequest for information or clarification. Not an issue. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |