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

Enable setting multipart to true/false by defining it as a custom client context parameter #4903

Merged
merged 8 commits into from
Feb 12, 2024

Conversation

anirudh9391
Copy link
Contributor

Multipart upload can be set as a client configuration parameter and is accessible at the time of instantiation. This allows classes that instantiate the S3AsyncClient to validate this parameter.

Modifications

1)Incorporated multiPartEnabled as a custom client configuration parameter by defining it in customization.config. The codegen module generates getter and setter methods for this parameter.
2) By default, set multipartEnabled = true in the S3AsyncClient
3) Removed code that sets multiPart Enabled on the client directly

Testing

Unit Tests to validate that

  1. Disabling multiPart code path logs warnings
  2. Default S3AsyncClient has multiPartEnabled = true by default.
  3. Setting MultiPartEnabled = true does not log warnings

Screenshots (if appropriate)

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • [ x] I have read the CONTRIBUTING document
  • [ x] Local run of mvn install succeeds
  • [ x] My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • [x ] I have added tests to cover my changes
  • [ x] All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • [ x] I confirm that this pull request can be released under the Apache 2 license

@anirudh9391 anirudh9391 requested a review from a team as a code owner February 8, 2024 20:56
@@ -271,6 +270,10 @@
"CrossRegionAccessEnabled":{
"documentation":"Enables cross-region bucket access for this client",
"type":"boolean"
},
"multipartEnabled":{
Copy link
Contributor

Choose a reason for hiding this comment

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

This also adds the multipart-enable config and method to the sync version of the client, as it adds the method the S3BaseClientBuilder interface which is used by both the sync and async builders:

S3Client client = S3Client.builder()
    .multipartEnabled(true) // <--- should not be available on sync builder
    .build();

I think we should avoid being able to define this config on the sync client and keep it on the async client only

+ ".MultipartS3AsyncClient")) {
log.debug(() -> "The provided S3AsyncClient is neither an instance of S3CrtAsyncClient or MultipartS3AsyncClient, " +
"and thus multipart upload/download feature may not be enabled and resumable file upload may not " +
"be supported.\n" + "To benefit from maximum throughput, consider using S3AsyncClient.crtBuilder().build() " +
Copy link
Contributor

Choose a reason for hiding this comment

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

very nit-picky: I'd avoid \n in logs

@L-Applin
Copy link
Contributor

There seems to still be a checkstyle violation:

2024-02-12T18:43:35.7470507Z [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (checkstyle) on project s3-transfer-manager: Failed during checkstyle execution: There is 1 error reported by Checkstyle 8.42 with software/amazon/awssdk/checkstyle.xml ruleset. -> [Help 1]

Copy link

sonarcloud bot commented Feb 12, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

idea Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

@anirudh9391 anirudh9391 merged commit b247de9 into feature/master/s3mpu Feb 12, 2024
15 of 16 checks passed
@zoewangg zoewangg mentioned this pull request Feb 21, 2024
12 tasks
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.

3 participants