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

Make it possible to use read-only transactions #1245

Closed
dgay42 opened this issue Jun 26, 2020 · 3 comments · Fixed by #1541
Closed

Make it possible to use read-only transactions #1245

dgay42 opened this issue Jun 26, 2020 · 3 comments · Fixed by #1541
Assignees
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@dgay42
Copy link

dgay42 commented Jun 26, 2020

The runTransaction call creates a read-write transaction that acquires locks on the data. This is a problem when the transaction is both long-lived (so would hold locks for a long time) and reads a lot of data (or data which is frequently written), as it will delay concurrent writes.

The Firestore API offers read-only transactions as an alternative. These do not acquire locks and do not impact writes.

A plausible way to add these is to add a 'read-only' option to runTransaction, or to add a runReadOnlyTransaction call.

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Jun 26, 2020
@schmidt-sebastian schmidt-sebastian added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Jun 26, 2020
@schmidt-sebastian
Copy link
Contributor

@dgay42 Thanks for this feature request. We just added read-only transaction to the Java client. I don't know if we have bandwidth to add it to the Node client anytime soon, but we would be willing to accept contributions.

@manwithsteelnerves
Copy link

Can someone explain how read-only transactions are different from batchGetDocuments?

@schmidt-sebastian
Copy link
Contributor

There are three differences:

  • You can use queries.
  • You can issue multiple requests, e.g. fetch some documents and then based on that data fetch more documents.
  • You can set a readTime that is in the past (up to 60s). This is also supported by BatchGetDocumnents, but not exposed via the SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants