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

storage: adding maximum_chunk_size_gb storage option (PROJQUAY-2679) #2186

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions storage/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,6 @@ def complete_chunked_upload(self, uuid, final_path, storage_metadata, force_clie
for index, chunk in enumerate(updated_chunks):
abs_chunk_path = self._init_path(chunk.path)

part = mpu.Part(index + 1)
part_copy = part.copy_from(
CopySource={"Bucket": self.get_cloud_bucket().name, "Key": abs_chunk_path},
CopySourceRange="bytes=%s-%s"
% (chunk.offset, chunk.length + chunk.offset - 1),
)

part_copy = self._perform_action_with_retry(
mpu.Part(index + 1).copy_from,
CopySource={"Bucket": self.get_cloud_bucket().name, "Key": abs_chunk_path},
Expand Down Expand Up @@ -747,6 +740,7 @@ def __init__(
port=None,
# Boto3 options (Full url including scheme anbd optionally port)
endpoint_url=None,
maximum_chunk_size_gb=None,
):
upload_params = {"ServerSideEncryption": "AES256"}
connect_kwargs = {"config": Config(signature_version="s3v4")}
Expand All @@ -773,8 +767,10 @@ def __init__(
access_key=s3_access_key or None,
secret_key=s3_secret_key or None,
)

self.maximum_chunk_size = 5 * 1024 * 1024 * 1024 # 5GB.
chunk_size = (
maximum_chunk_size_gb if maximum_chunk_size_gb is not None else 5
) # 5gb default
self.maximum_chunk_size = chunk_size * 1024 * 1024 * 1024

def setup(self):
self.get_cloud_bucket().Cors().put(
Expand Down