-
Notifications
You must be signed in to change notification settings - Fork 412
feat(storage): Handle large read ranges in bidi read. #15152
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
base: main
Are you sure you want to change the base?
Conversation
@@ -77,7 +79,9 @@ class ObjectDescriptorImpl | |||
return CopyActiveRanges(std::unique_lock<std::mutex>(mu_)); | |||
} | |||
|
|||
auto CurrentStream(std::unique_lock<std::mutex>) const { return stream_; } | |||
auto CurrentStream(std::unique_lock<std::mutex>) const { | |||
return streams_[active_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.
It looks like this is always streams_.back()
, and therefore that active_stream_
is redundant.
@@ -105,6 +109,8 @@ class ObjectDescriptorImpl | |||
|
|||
std::unordered_map<std::int64_t, std::shared_ptr<ReadRange>> active_ranges_; | |||
Options options_; | |||
std::vector<std::shared_ptr<OpenStream>> streams_ = {}; |
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.
Is stream_
(line 104) dead now?
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.
Yeah, it is. Removed it now.
@@ -200,7 +224,7 @@ void ObjectDescriptorImpl::Resume(google::rpc::Status const& proto_status) { | |||
void ObjectDescriptorImpl::OnResume(StatusOr<OpenStreamResult> result) { | |||
if (!result) return OnFinish(std::move(result).status()); | |||
std::unique_lock<std::mutex> lk(mu_); | |||
stream_ = std::move(result->stream); | |||
streams_[0] = std::move(result->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.
I know nothing about this code, but it looks a little weird that this isn't assigning the "active 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.
Thanks for reviewing the PR @devbww
I was trying this code as a POC and yes you're right, I should update the active_stream_ here.
This is still WIP.
This change is