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

fix: mark transaction as invalid if no tx is returned before close #791

Merged
merged 1 commit into from Jan 12, 2021

Conversation

olavloite
Copy link
Contributor

@olavloite olavloite commented Jan 11, 2021

If a query requests the begin of a new transaction, the transaction id is returned by the first call to ResultSet#next(). If the ResultSet is closed by another thread before the first result has been returned, or before that result has been consumed internally to set the transaction id, no transaction id will be set. This will cause any subsequent statement in the same transaction
to timeout while waiting for a transaction to be returned.

…osed

If a query requests the begin of a new transaction, the transaction id is
returned by the first call to ResultSet#next(). If the ResultSet is closed
by another thread before the first result has been returned, or before that
result has been consumed internally to set the transaction id, no transaction
id will be set. This will cause any subsequent statement in the same transaction
to timeout while waiting for a transaction to be returned.
@olavloite olavloite requested a review from thiagotnunes Jan 11, 2021
@olavloite olavloite requested a review from as a code owner Jan 11, 2021
@google-cla google-cla bot added the cla: yes label Jan 11, 2021
@product-auto-label product-auto-label bot added the api: spanner label Jan 11, 2021
@codecov
Copy link

@codecov codecov bot commented Jan 11, 2021

Codecov Report

Merging #791 (9500114) into master (3f28c46) will increase coverage by 0.00%.
The diff coverage is 78.57%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #791   +/-   ##
=========================================
  Coverage     85.01%   85.01%           
- Complexity     2561     2562    +1     
=========================================
  Files           143      143           
  Lines         14005    14015   +10     
  Branches       1337     1341    +4     
=========================================
+ Hits          11906    11915    +9     
  Misses         1537     1537           
- Partials        562      563    +1     
Impacted Files Coverage Δ Complexity Δ
...va/com/google/cloud/spanner/AbstractResultSet.java 83.27% <75.00%> (-0.22%) 28.00 <0.00> (ø)
...om/google/cloud/spanner/TransactionRunnerImpl.java 84.86% <80.00%> (+0.16%) 9.00 <0.00> (ø)
.../com/google/cloud/spanner/AbstractReadContext.java 87.07% <100.00%> (+0.30%) 48.00 <1.00> (+1.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f28c46...9500114. Read the comment docs.

Copy link
Contributor

@thiagotnunes thiagotnunes left a comment

Thanks so much for fixing this!

@thiagotnunes thiagotnunes merged commit e02e5a7 into master Jan 12, 2021
18 of 19 checks passed
@thiagotnunes thiagotnunes deleted the mark-invalid-on-close branch Jan 12, 2021
thiagotnunes pushed a commit that referenced this issue May 6, 2021
…osed (#791)

If a query requests the begin of a new transaction, the transaction id is returned by the first call to ResultSet#next(). If the ResultSet is closed by another thread before the first result has been returned, or before that result has been consumed internally to set the transaction id, no transaction id will be set. This will cause any subsequent statement in the same transaction to timeout while waiting for a transaction to be returned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants