Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3405161
D4439.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4439.diff
View Options
diff --git a/native/cpp/CommonCpp/grpc/protos/blob.proto b/native/cpp/CommonCpp/grpc/protos/blob.proto
--- a/native/cpp/CommonCpp/grpc/protos/blob.proto
+++ b/native/cpp/CommonCpp/grpc/protos/blob.proto
@@ -28,6 +28,7 @@
message GetRequest {
string holder = 1;
+ uint32 extraBytesNeeded = 2;
}
message GetResponse {
diff --git a/services/blob/src/Reactors/server/GetReactor.h b/services/blob/src/Reactors/server/GetReactor.h
--- a/services/blob/src/Reactors/server/GetReactor.h
+++ b/services/blob/src/Reactors/server/GetReactor.h
@@ -21,8 +21,8 @@
: public ServerWriteReactorBase<blob::GetRequest, blob::GetResponse> {
size_t offset = 0;
size_t fileSize = 0;
- const size_t chunkSize =
- GRPC_CHUNK_SIZE_LIMIT - GRPC_METADATA_SIZE_PER_MESSAGE;
+ size_t extraBytesNeeded = 0;
+ size_t chunkSize = 0;
database::S3Path s3Path;
Aws::S3::Model::GetObjectRequest getRequest;
@@ -63,6 +63,14 @@
}
void initialize() override {
+ this->extraBytesNeeded = this->request.extrabytesneeded();
+ this->chunkSize = GRPC_CHUNK_SIZE_LIMIT - GRPC_METADATA_SIZE_PER_MESSAGE;
+ if (this->extraBytesNeeded >= this->chunkSize) {
+ throw std::runtime_error(
+ "extra bytes needed (" + std::to_string(this->extraBytesNeeded) +
+ ") cannot exceed the grpc chunk limit (" + std::to_string(this->chunkSize) + ")");
+ }
+ this->chunkSize -= this->extraBytesNeeded;
this->s3Path = tools::findS3Path(this->request.holder());
this->fileSize =
getBucket(s3Path.getBucketName()).getObjectSize(s3Path.getObjectName());
diff --git a/services/commtest/tests/blob/get.rs b/services/commtest/tests/blob/get.rs
--- a/services/commtest/tests/blob/get.rs
+++ b/services/commtest/tests/blob/get.rs
@@ -18,6 +18,7 @@
let response = client
.get(Request::new(GetRequest {
holder: cloned_holder,
+ extra_bytes_needed: 0,
}))
.await?;
let mut inbound = response.into_inner();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 4, 6:52 PM (11 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2614622
Default Alt Text
D4439.diff (1 KB)
Attached To
Mode
D4439: [services] Blob - Add extra bytes needed to get request
Attached
Detach File
Event Timeline
Log In to Comment