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(spanner): correct handling of PartialResultSet.resume_token #8521

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

devbww
Copy link
Contributor

@devbww devbww commented Mar 9, 2022

Problems:

  • A google::spanner::v1::PartialResultSet may not contain
    a resume_token when it also does not complete a new row,
    so last_resume_token_ should not be updated in that case.
  • When PartialResultSetResume::Read() uses its factory and
    last_resume_token_ to create a new PartialResultSetReader,
    it should inform the PartialResultSetSource so that any
    partly-constructed row can be discarded before processing
    the resumed stream (which will resend that row).

That is, a "resume token" is really a row iterator, and a level
above row fragmentation and value chunking. So fix all of that.

Then expand the ConnectionImplTest.ReadSuccess test case to
exercise the new code paths.


This change is Reviewable

Problems:
- A `google::spanner::v1::PartialResultSet` will not contain
  a `resume_token` when it also does not complete a new row,
  so `last_resume_token_` should not be updated in that case.
- When `PartialResultSetResume::Read()` uses its factory and
  `last_resume_token_` to create a new `PartialResultSetReader`,
  it should inform the `PartialResultSetSource` so that any
  partly-constructed row can be discarded before processing
  the resumed stream (which will resend that row).

That is, a "resume token" is really a row iterator, and a level
above row fragmentation and value chunking. So fix all of that.

Then expand the `ConnectionImplTest.ReadSuccess` test case to
exercise the new code paths.
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Mar 9, 2022
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: bdbeb66a4ea370e5ad70a4e624e96906f3605cf4

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Mar 9, 2022

Codecov Report

Merging #8521 (bdbeb66) into main (05e4524) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8521      +/-   ##
==========================================
- Coverage   93.92%   93.92%   -0.01%     
==========================================
  Files        1452     1452              
  Lines      125854   125883      +29     
==========================================
+ Hits       118211   118235      +24     
- Misses       7643     7648       +5     
Impacted Files Coverage Δ
...cloud/spanner/internal/logging_result_set_reader.h 100.00% <ø> (ø)
...cloud/spanner/internal/partial_result_set_reader.h 100.00% <ø> (ø)
...cloud/spanner/internal/partial_result_set_resume.h 100.00% <ø> (ø)
google/cloud/spanner/internal/connection_impl.cc 95.04% <100.00%> (ø)
...gle/cloud/spanner/internal/connection_impl_test.cc 97.77% <100.00%> (+0.02%) ⬆️
...loud/spanner/internal/logging_result_set_reader.cc 90.47% <100.00%> (+0.47%) ⬆️
...spanner/internal/logging_result_set_reader_test.cc 100.00% <100.00%> (+2.50%) ⬆️
...loud/spanner/internal/partial_result_set_resume.cc 96.00% <100.00%> (+0.76%) ⬆️
...spanner/internal/partial_result_set_resume_test.cc 95.50% <100.00%> (+0.07%) ⬆️
...loud/spanner/internal/partial_result_set_source.cc 95.34% <100.00%> (+0.16%) ⬆️
... and 7 more

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 05e4524...bdbeb66. Read the comment docs.

@devbww devbww marked this pull request as ready for review March 9, 2022 21:36
@devbww devbww requested a review from a team as a code owner March 9, 2022 21:36
@devbww devbww merged commit 25f6b33 into googleapis:main Mar 10, 2022
@devbww devbww deleted the partial-result-set-resume-token branch March 10, 2022 04:05
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants