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

Use bidirectional streaming RPCs in DistributedTransactionService #228

Merged
merged 6 commits into from
Jul 5, 2021

Conversation

brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented Jul 1, 2021

This PR changes DistributedTransactionService to use bidirectional streaming RPCs in gRPC.

After it's merged, I will work on changing DistributedStorageService to use bidirectional streaming RPCs for scan operations, as well.

Please take a look!

@brfrn169 brfrn169 requested a review from feeblefakie July 1, 2021 12:53
@brfrn169 brfrn169 self-assigned this Jul 1, 2021
Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

Thank you! It's way more clean than I assumed! Great work 🎉
It looks pretty good but I want to check it again to understand it better.
Left one clarifying question.

return new GrpcTransaction(
response.getTransactionId(), stub, metadataManager, namespace, tableName);
});
GrpcTransactionService service = new GrpcTransactionService(stub, metadataManager);
Copy link
Contributor

@feeblefakie feeblefakie Jul 2, 2021

Choose a reason for hiding this comment

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

I'm wondering if it should create GrpcTransactionService object in every start.
If GrpcTransactionManager object singleton is shared (, which is most of the cases,) it seems not really effective?
Or, should GrpcTransactionManager be created for each transaction?

Ah, probably, it's created for managing finished and the latch separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for reviewing this!

Ah, probably, it's created for managing finished and the latch separately?

Yes, GrpcTransactionService indicates things like a transaction session (assigned to a gRPC bidirectional stream), so we need to instantiate it per transaction. Maybe, the name (GrpcTransactionService) is not good. I will try to rename it to a better one. Thanks!

@brfrn169 brfrn169 requested a review from feeblefakie July 2, 2021 04:58
@brfrn169 brfrn169 force-pushed the use-bidirectional-streaming-in-transaction branch from fd7472e to 5839fae Compare July 3, 2021 08:38
feeblefakie
feeblefakie previously approved these changes Jul 5, 2021
Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!
Left a minor naming suggestion.

import javax.annotation.concurrent.NotThreadSafe;

@NotThreadSafe
public class GrpcTransactionBidirectionalStream implements StreamObserver<TransactionResponse> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public class GrpcTransactionBidirectionalStream implements StreamObserver<TransactionResponse> {
public class GrpcTransactionOnBidirectionalStream implements StreamObserver<TransactionResponse> {

maybe?

@brfrn169 brfrn169 force-pushed the use-bidirectional-streaming-in-transaction branch from 5839fae to 2af57be Compare July 5, 2021 05:49
@brfrn169 brfrn169 requested a review from feeblefakie July 5, 2021 05:49
@feeblefakie feeblefakie merged commit 2789562 into master Jul 5, 2021
@feeblefakie feeblefakie deleted the use-bidirectional-streaming-in-transaction branch July 5, 2021 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants