-
Notifications
You must be signed in to change notification settings - Fork 525
feat: close #83; close #84; limit uploading objects due to s3 limits; use pooled bytebuffer; #88
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
Conversation
| long indexBlockPosition = objectTailBuf.getLong(objectTailBuf.readableBytes() - 48); | ||
| int indexBlockSize = objectTailBuf.getInt(objectTailBuf.readableBytes() - 40); | ||
| if (indexBlockPosition + objectTailBuf.readableBytes() < objectSize) { | ||
| if (indexBlockPosition + indexBlockSize + 48 < objectSize) { |
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.
Replace magic value with named const value.
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.
fixed in the next commit.
| if (cachedBuf == null) { | ||
| // Case 1: create cache and add as the first item. | ||
| if (targetSize < minPartSize) { | ||
| cachedBuf = ByteBufAllocator.DEFAULT.compositeBuffer(); |
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.
ByteBufAlloc
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.
fixed in the next commit.
| // cachedBuf not null | ||
| long combinedSize = cachedBufSize + targetSize; | ||
|
|
||
| if (combinedSize <= 2 * minPartSize) { |
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.
Why 2 * minPartSize
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.
It is actually used to limit range reading. More comments will be added to explain this.
| } | ||
|
|
||
| @Override | ||
| public void copyWrite(String sourcePath, long start, long end) { |
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.
Extract write/copyWrite common code.
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.
handled in the next commit.
| if (targetSize < minPartSize) { | ||
| cachedBuf = ByteBufAllocator.DEFAULT.compositeBuffer(); | ||
| cachedBufSize = targetSize; | ||
| cachedBufLastAddCf = CompletableFuture.completedFuture(part).thenAccept(buf -> cachedBuf.addComponent(true, buf)); |
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.
More readable name.
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.
more comments are added for it.
| // Case 5: fill cachedBuf with source until it reaches minPartSize. Upload the cache and the rest of the source. | ||
| cachedBufLastAddCf = cachedBufLastAddCf | ||
| .thenRun(() -> cachedBuf.addComponent(true, part.slice(part.readerIndex(), (int) (minPartSize - cachedBufSize)).retain())); | ||
| handleWriteFuturePart(cachedBufLastAddCf, cachedBuf, System.nanoTime()); |
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.
Why two handleWriteFuturePart
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.
Only one is needed. Fixed in the next commit.
Signed-off-by: Curtis Wan <wcy9988@163.com>
No description provided.