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

cleanup(storage)!: session-less resumable uploads #8806

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Apr 26, 2022

Fixes #8621. Fixes #7282. Fixes #6713. Fixes #7880


This change is Reviewable

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 141c67d2b32148291d03a999b328d84acd5f5349

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

@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #8806 (c406c5f) into main (039f9e4) will decrease coverage by 1.76%.
The diff coverage is 98.09%.

@@            Coverage Diff             @@
##             main    #8806      +/-   ##
==========================================
- Coverage   93.35%   91.58%   -1.77%     
==========================================
  Files        1470     1132     -338     
  Lines      125324    89435   -35889     
==========================================
- Hits       117001    81913   -35088     
+ Misses       8323     7522     -801     
Impacted Files Coverage Δ
google/cloud/storage/internal/curl_client.h 100.00% <ø> (ø)
google/cloud/storage/internal/grpc_client.cc 80.90% <ø> (-10.07%) ⬇️
google/cloud/storage/internal/grpc_client.h 100.00% <ø> (ø)
google/cloud/storage/internal/hybrid_client.h 100.00% <ø> (ø)
google/cloud/storage/internal/raw_client.h 100.00% <ø> (ø)
google/cloud/storage/internal/rest_client.h 100.00% <ø> (+50.00%) ⬆️
google/cloud/storage/testing/mock_client.h 90.62% <ø> (-6.68%) ⬇️
google/cloud/storage/internal/hybrid_client.cc 86.84% <33.33%> (+1.49%) ⬆️
...ud/storage/internal/object_write_streambuf_test.cc 99.24% <98.61%> (-0.76%) ⬇️
google/cloud/storage/client.cc 86.07% <100.00%> (+0.13%) ⬆️
... and 374 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 039f9e4...c406c5f. Read the comment docs.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: c2dd610af5ccd97969daf3424f436fe6da365fdf

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

@coryan coryan force-pushed the cleanup-storage-remove-resumable-upload-session-pr-final branch from c2dd610 to 2efc5d4 Compare April 26, 2022 23:52
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 2efc5d426c74d2ece2bd9f3e2d4cd2764a40bca9

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

@coryan coryan force-pushed the cleanup-storage-remove-resumable-upload-session-pr-final branch from 2efc5d4 to 674a865 Compare April 27, 2022 18:28
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 674a8650a5dd1ce7b1f0edcd7a06f5c01e8b948e

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

@coryan coryan force-pushed the cleanup-storage-remove-resumable-upload-session-pr-final branch from 674a865 to d1ce2fc Compare April 27, 2022 19:08
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: d1ce2fc620816c78475e8705a252577ad0133134

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

@coryan coryan force-pushed the cleanup-storage-remove-resumable-upload-session-pr-final branch from d1ce2fc to 8ad959a Compare April 28, 2022 15:28
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 8ad959a471c3e25fa16e77a11a58652356d26927

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

@coryan coryan marked this pull request as ready for review April 28, 2022 15:58
@coryan coryan requested a review from a team as a code owner April 28, 2022 15:58
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 5e0cc81c94a297626f238f89bdd964dfd06166e8

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

@coryan
Copy link
Contributor Author

coryan commented Apr 28, 2022

/FYI: @Jseph

@coryan coryan force-pushed the cleanup-storage-remove-resumable-upload-session-pr-final branch from 5e0cc81 to 29652e0 Compare April 28, 2022 22:13
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 29652e063fe3753517b581529719971ac4fb08a5

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

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 042f898e8d19c5b0adcc1f59480fc4923a56ebe4

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

Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

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

nits only, most of which predated the PR

@@ -125,30 +112,30 @@ TEST(ObjectWriteStreambufTest, SmallStream) {
/// @test Verify that uploading a stream which ends on a upload chunk quantum
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/a upload/an upload/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

/// expected byte jumps.
TEST(ObjectWriteStreambufTest, NextExpectedByteJumpsAhead) {
auto mock = absl::make_unique<testing::MockResumableUploadSession>();
/// @test verify that the upload steam transitions to a bad state if the
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/steam/stream/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -341,25 +314,22 @@ TEST(ObjectWriteStreambufTest, NextExpectedByteJumpsAhead) {

/// @test verify that the upload steam transitions to a bad state if the next
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/steam/stream/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -369,21 +339,18 @@ TEST(ObjectWriteStreambufTest, NextExpectedByteDecreases) {
/// @test verify that the upload steam transitions to a bad state on a partial
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/steam/stream/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

std::string const payload_2("trailer");
size_t next_byte = 0;
std::string const p0(3 * quantum, '*');
std::string const p1("trailer");
{
Copy link
Member

Choose a reason for hiding this comment

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

nit: are the braces necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, fixed.

Comment on lines 489 to 492
// When using X-Upload-Content-Length GCS finalizes the upload when
// enough data is sent, regardless of whether we use UploadChunk() or
// UploadFinalChunk(). Furthermore, the response does not have a
// committed size.
Copy link
Member

Choose a reason for hiding this comment

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

the bit about UploadFinalChunk() is stale

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

error_stream.setstate(std::ios::badbit | std::ios::eofbit);
error_stream.Close();
return error_stream;
}
auto const buffer_size = request.GetOption<UploadBufferSize>().value_or(
raw_client_->client_options().upload_buffer_size());
return ObjectWriteStream(absl::make_unique<internal::ObjectWriteStreambuf>(
std::move(create->session), std::move(create->state), buffer_size,
raw_client_, request, std::move(std::move(response->upload_id)),
Copy link
Member

Choose a reason for hiding this comment

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

I do not think std::move(std::move(x)) is a thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed 😞

EXPECT_CALL(*mock, UploadChunk)
.WillOnce(Return(
QueryResumableUploadResponse{/*committed_size=*/absl::nullopt,
/*object_metadata=*/expected_metadata}));

Copy link
Member

Choose a reason for hiding this comment

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

When I said "the flow seems nicer now", that was an understatement. It is way better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

using ::testing::AtMost;
EXPECT_CALL(*mock_, UploadChunk(Property(
&UploadChunkRequest::upload_session_url, id)))
.Times(AtMost(1))
Copy link
Member

Choose a reason for hiding this comment

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

I guess this isn't a WillOnce(...) case?

For some reason, I thought .Times(0).WillRepeatedly(...) didn't work. Which makes me think that .Times(AtMost(1)) is really .Times(1).... but idk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somehow I had convinced myself that this could be called one or zero times. Changed to .WillOnce().

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: c406c5f642094498a48fc75775a25ade29570b47

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

@coryan coryan enabled auto-merge (squash) April 29, 2022 12:43
@coryan coryan merged commit 301676d into googleapis:main Apr 29, 2022
@coryan coryan deleted the cleanup-storage-remove-resumable-upload-session-pr-final branch April 29, 2022 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants