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

chore(spanner): add R/W multiplexed session support #3381

Merged
merged 14 commits into from
Oct 14, 2024

Conversation

harshachinta
Copy link
Contributor

@harshachinta harshachinta commented Oct 4, 2024

This PR introduces support for using multiplexed sessions in R/W transactions for the following methods:

  1. write
  2. writeWithOptions
  3. readWriteTransaction
  4. transactionManager
  5. runAsync
  6. transactionManagerAsync

@harshachinta harshachinta requested a review from a team as a code owner October 4, 2024 10:47
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/java-spanner API. labels Oct 4, 2024
@harshachinta harshachinta marked this pull request as draft October 4, 2024 10:47
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Oct 7, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Oct 7, 2024
@harshachinta harshachinta marked this pull request as ready for review October 8, 2024 04:41

@Override
public TransactionContextFuture beginAsync() {
return getAsyncTransactionManager().beginAsync();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as above: Preferably, these methods should be non-blocking if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying this to be non-blocking would require the method signature to be modified, which makes it impossible here. Should we just accept this as it is which means this will be blocking until a multiplexed session is available.

Please let me know if there are any other ways to handle this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why the signature would need to change. The return value is a TransactionContextFuture (so something that extends Future). That being said; If it requires a lot of work or refactoring, then it is certainly not worth it, so I'm fine with leaving this as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to use ApiFutures.transformAsync to make beginAsync() to be non-blocking. However, the return type of transacformAsync is a ApiFuture<O> which does not conform to the return type of this method which is TransactionContextFuture. So I am assuming the signature need to be changed to ApiFuture<TransactionContextFuture>.

However, since TransactionContextFuture extends Future, just typecasting could be sufficient.
That said, let me pick up this analysis in a seperate PR to get the rest of PRs unblocking.


@Override
public TransactionContextFuture beginAsync() {
return getAsyncTransactionManager().beginAsync();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why the signature would need to change. The return value is a TransactionContextFuture (so something that extends Future). That being said; If it requires a lot of work or refactoring, then it is certainly not worth it, so I'm fine with leaving this as is.

@harshachinta harshachinta added the automerge Merge the pull request once unit tests and other checks pass. label Oct 14, 2024
@gcf-merge-on-green gcf-merge-on-green bot merged commit 1f53d38 into googleapis:main Oct 14, 2024
31 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants