s3: ability to gradually increase chunk size for multipart uploard#205
Closed
ali-gholami-aiven wants to merge 1 commit intomainfrom
Closed
s3: ability to gradually increase chunk size for multipart uploard#205ali-gholami-aiven wants to merge 1 commit intomainfrom
ali-gholami-aiven wants to merge 1 commit intomainfrom
Conversation
Contributor
giacomo-alzetta-aiven
left a comment
There was a problem hiding this comment.
Overall looks good.
I think we should probably add these to other storage backends as well though.
rohmu/object_storage/s3.py
Outdated
| return chunks, chunk_size | ||
|
|
||
| def get_multipart_chunk_size(self, current_chunk_size: int, current_part_number: int) -> int: | ||
| if current_part_number % self.multipart_chunk_size_increase_rate == 0: |
Contributor
There was a problem hiding this comment.
I believe part numbers start at 1, but nevertheless, I'd rather be safe than sorry and add an explicit check for the 0 case to avoid accidental increases on the very first chunk:
Suggested change
| if current_part_number % self.multipart_chunk_size_increase_rate == 0: | |
| if current_part_number > 0 and current_part_number % self.multipart_chunk_size_increase_rate == 0: |
| mp_id = cmu_response["UploadId"] | ||
|
|
||
| while True: | ||
| chunk_size = self.get_multipart_chunk_size(current_chunk_size=chunk_size, current_part_number=part_number) |
Contributor
There was a problem hiding this comment.
I think logging the chunk size change would make sense:
Suggested change
| chunk_size = self.get_multipart_chunk_size(current_chunk_size=chunk_size, current_part_number=part_number) | |
| old_chunk_size = chunk_size | |
| chunk_size = self.get_multipart_chunk_size(current_chunk_size=chunk_size, current_part_number=part_number) | |
| if chunk_size != old_chunk_size: | |
| self.log.info("Updated chunk size from %s to %s at part_number %s", old_chunk_size, chunk_size, part_number) |
| @@ -395,7 +400,7 @@ def test_calculate_chunks_and_chunk_size( | |||
| ) -> None: | |||
Contributor
There was a problem hiding this comment.
Should rename the test here
c50be5e to
588fd2f
Compare
588fd2f to
eca995d
Compare
Contributor
|
Closing this since we added #206 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About this change - What it does
Resolves: #xxxxx
Why this way