-
Notifications
You must be signed in to change notification settings - Fork 293
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
Use put api from s3 instead of multi-part for small objects. #619
Conversation
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.
lg2m, a question or two and some nitpicks.
SnappyOutputStream compress = new SnappyOutputStream(byteArrayOutputStream)) { | ||
byte data[] = new byte[BUFFER]; | ||
int count; | ||
while ((count = inputStream.read(data, 0, data.length)) != -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.
nit: can just do read(data)
@@ -35,6 +36,22 @@ | |||
} | |||
|
|||
@Override | |||
public byte[] compress(InputStream inputStream) throws IOException { | |||
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | |||
SnappyOutputStream compress = new SnappyOutputStream(byteArrayOutputStream)) { |
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: leading space
@@ -35,6 +36,22 @@ | |||
} | |||
|
|||
@Override | |||
public byte[] compress(InputStream inputStream) throws IOException { |
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.
Any reason not to just retrieve the ChunkedStream
from earlier compress
and call next()
until it's done?
|
||
if (logger.isDebugEnabled()) | ||
logger.debug("Successfully uploaded file with putObject: {} and etag: {}", path.getRemotePath(), upload.getETag()); | ||
}catch (Exception e) { |
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: space
} finally { | ||
IOUtils.closeQuietly(in); | ||
} | ||
}else |
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: space and brackets
No description provided.