Skip to content

fix(spanner): context timeout should be wrapped correctly#7744

Merged
rahul2393 merged 4 commits intomainfrom
fix_spanner_error
Apr 17, 2023
Merged

fix(spanner): context timeout should be wrapped correctly#7744
rahul2393 merged 4 commits intomainfrom
fix_spanner_error

Conversation

@rahul2393
Copy link
Copy Markdown
Contributor

Fixes: #7740

@rahul2393 rahul2393 requested review from a team April 13, 2023 03:47
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: spanner Issues related to the Spanner API. labels Apr 13, 2023
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 13, 2023
if err = t.begin(ctx); err != nil {
return spannerErrorf(codes.Internal, "error while BeginTransaction during retrying a ReadWrite transaction: %v", err)
trace.TracePrintf(ctx, nil, "Error while BeginTransaction during retrying a ReadWrite transaction: %v", ToSpannerError(err))
return ToSpannerError(err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we have a test that shows that this actually fixes the problem? I'm a little surprised that the sample code given in the original issue gets into this branch of the code, as it indicates that the transaction should use an explicit BeginTransaction call. It's not clear to me why the example would do that, as it just uses a normal SELECT statement as the first statement in the transaction. That would then normally mean that the BeginTransaction is inlined with the execution of that statement.

Copy link
Copy Markdown
Contributor Author

@rahul2393 rahul2393 Apr 13, 2023

Choose a reason for hiding this comment

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

Added tests, this happend because we do explicit begin transaction if first statement returns error, in this case call to iter.Next() returned cancelled and we returned custom internal error to do explicitBeginTransaction

@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Apr 13, 2023
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 13, 2023
@rahul2393 rahul2393 enabled auto-merge (squash) April 17, 2023 05:29
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 17, 2023
@rahul2393 rahul2393 merged commit f8e22f6 into main Apr 17, 2023
@rahul2393 rahul2393 deleted the fix_spanner_error branch April 17, 2023 05:38
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 Spanner API. kokoro:force-run Add this label to force Kokoro to re-run the tests. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spanner: Error wraped into Internal

3 participants