gargvishesh commented on code in PR #16236:
URL: https://github.com/apache/druid/pull/16236#discussion_r1551178282
##########
extensions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java:
##########
@@ -53,20 +62,34 @@ public class GoogleStorage
* <p>
* See OmniDataSegmentKiller for how DataSegmentKillers are initialized.
*/
- private static final Logger log = new Logger(GoogleStorage.class);
-
private final Supplier<Storage> storage;
- private final HumanReadableBytes DEFAULT_WRITE_CHUNK_SIZE = new
HumanReadableBytes("4MiB");
-
public GoogleStorage(final Supplier<Storage> storage)
{
this.storage = storage;
}
- public void insert(final String bucket, final String path,
AbstractInputStreamContent mediaContent) throws IOException
+ /**
+ * Upload an object. From {@link Storage#createFrom(BlobInfo, InputStream,
int, Storage.BlobWriteOption...)},
+ * "larger buffer sizes might improve the upload performance but require
more memory."
+ *
+ * @param bucket target bucket
+ * @param path target path
+ * @param mediaContent content to upload
+ * @param bufferSize size of upload buffer, or {@link #DEFAULT_BUFFER_SIZE}
+ */
+ public void insert(
+ final String bucket,
+ final String path,
+ final AbstractInputStreamContent mediaContent,
+ final int bufferSize
+ ) throws IOException
{
- storage.get().createFrom(getBlobInfo(bucket, path),
mediaContent.getInputStream());
+ if (bufferSize == DEFAULT_BUFFER_SIZE) {
Review Comment:
We use the term `chunkSize` in the `getObjectOutputStream` API down below,
and the default value as `DEFAULT_WRITE_CHUNK_SIZE`. Uniformity by modifying
either one would be good.
Another uniformity among both can be in the way the default gets picked:
currently one does a null check while another expects the default value.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]