Skip to content
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

Merged
merged 3 commits into from
Nov 2, 2017

Conversation

arunagrawal84
Copy link
Contributor

No description provided.

Copy link
Contributor

@jolynch jolynch left a 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) {
Copy link
Contributor

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)) {
Copy link
Contributor

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 {
Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space and brackets

@arunagrawal84 arunagrawal84 merged commit 88b9d86 into Netflix:3.x Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants