rishabhdaim commented on code in PR #2621:
URL: https://github.com/apache/jackrabbit-oak/pull/2621#discussion_r2556070242
##########
oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java:
##########
@@ -513,12 +513,26 @@ public void addMetadataRecord(final InputStream input,
final String name) throws
final ExecutorService executor = Executors.newSingleThreadExecutor();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ final PutObjectRequest.Builder putObjectRequestBuilder =
PutObjectRequest.builder()
+ .bucket(bucket)
+ .contentType("application/octet-stream")
+ .key(addMetaKeyPrefix(name));
+
// Specify `null` for the content length when you don't know the
content length.
- final AsyncRequestBody body =
AsyncRequestBody.fromInputStream(input, null, executor);
+ final AsyncRequestBody body;
+ if (Objects.equals(RemoteStorageMode.S3,
properties.get(S3Constants.MODE))) {
+ body = AsyncRequestBody.fromInputStream(input, null, executor);
+ } else {
+ // for GCP we need to know the length in advance, else it
won't work.
+ byte[] bytes = input.readAllBytes();
Review Comment:
@joerghoh Yes, it might cause OOM, but there is no other option.
GCP doesn't work with unknown-length streams, so we had to find the length.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]