-
Notifications
You must be signed in to change notification settings - Fork 382
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
cleanup(storage)!: session-less resumable uploads #8806
Conversation
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
c2dd610
to
2efc5d4
Compare
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
2efc5d4
to
674a865
Compare
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
674a865
to
d1ce2fc
Compare
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
d1ce2fc
to
8ad959a
Compare
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
/FYI: @Jseph |
5e0cc81
to
29652e0
Compare
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/steam/stream/
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/steam/stream/
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/steam/stream/
There was a problem hiding this comment.
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"); | ||
{ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, fixed.
// 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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
google/cloud/storage/client.cc
Outdated
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)), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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})); | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Fixes #8621. Fixes #7282. Fixes #6713. Fixes #7880
This change is