-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Remove maxResultsSize config property from S3OutputConfig #14101
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0aebb48
remove maxResultsSize from the config, have a default chunk size
LakshSingla d238b62
Merge branch 'master' into s3-better-chunking-error
LakshSingla 52593b1
update documentation, remove unused fields
LakshSingla 6c812d0
Update docs/multi-stage-query/reference.md
LakshSingla c4b9c44
fix static check, spellcheck should pass
LakshSingla 9e8ff2a
add 100MiB to known words
LakshSingla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,9 +34,6 @@ public class S3OutputConfig | |
| { | ||
| public static final long S3_MULTIPART_UPLOAD_MIN_PART_SIZE_BYTES = 5L * 1024 * 1024; | ||
| public static final long S3_MULTIPART_UPLOAD_MAX_PART_SIZE_BYTES = 5L * 1024 * 1024 * 1024L; | ||
| private static final int S3_MULTIPART_UPLOAD_MAX_NUM_PARTS = 10_000; | ||
| public static final long S3_MULTIPART_UPLOAD_MIN_OBJECT_SIZE_BYTES = 5L * 1024 * 1024; | ||
| public static final long S3_MULTIPART_UPLOAD_MAX_OBJECT_SIZE_BYTES = 5L * 1024 * 1024 * 1024 * 1024; | ||
|
|
||
| @JsonProperty | ||
| private String bucket; | ||
|
|
@@ -48,10 +45,7 @@ public class S3OutputConfig | |
|
|
||
| @Nullable | ||
| @JsonProperty | ||
| private HumanReadableBytes chunkSize; | ||
|
|
||
| @JsonProperty | ||
| private HumanReadableBytes maxResultsSize = new HumanReadableBytes("100MiB"); | ||
| private HumanReadableBytes chunkSize = new HumanReadableBytes("100MiB"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need : |
||
|
|
||
| /** | ||
| * Max number of tries for each upload. | ||
|
|
@@ -65,11 +59,10 @@ public S3OutputConfig( | |
| @JsonProperty(value = "prefix", required = true) String prefix, | ||
| @JsonProperty(value = "tempDir", required = true) File tempDir, | ||
| @JsonProperty("chunkSize") HumanReadableBytes chunkSize, | ||
| @JsonProperty("maxResultsSize") HumanReadableBytes maxResultsSize, | ||
| @JsonProperty("maxRetry") Integer maxRetry | ||
| ) | ||
| { | ||
| this(bucket, prefix, tempDir, chunkSize, maxResultsSize, maxRetry, true); | ||
| this(bucket, prefix, tempDir, chunkSize, maxRetry, true); | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
|
|
@@ -80,8 +73,6 @@ protected S3OutputConfig( | |
| @Nullable | ||
| HumanReadableBytes chunkSize, | ||
| @Nullable | ||
| HumanReadableBytes maxResultsSize, | ||
| @Nullable | ||
| Integer maxRetry, | ||
| boolean validation | ||
| ) | ||
|
|
@@ -92,9 +83,6 @@ protected S3OutputConfig( | |
| if (chunkSize != null) { | ||
| this.chunkSize = chunkSize; | ||
| } | ||
| if (maxResultsSize != null) { | ||
| this.maxResultsSize = maxResultsSize; | ||
| } | ||
| if (maxRetry != null) { | ||
| this.maxRetry = maxRetry; | ||
| } | ||
|
|
@@ -116,21 +104,9 @@ private void validateFields() | |
| ); | ||
| } | ||
|
|
||
| // check result size which relies on the s3 multipart upload limits. | ||
| // See https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html for more details. | ||
| if (maxResultsSize.getBytes() < S3_MULTIPART_UPLOAD_MIN_OBJECT_SIZE_BYTES | ||
| || maxResultsSize.getBytes() > S3_MULTIPART_UPLOAD_MAX_OBJECT_SIZE_BYTES) { | ||
| throw new IAE( | ||
| "maxResultsSize[%d] should be >= [%d] and <= [%d] bytes", | ||
| maxResultsSize.getBytes(), | ||
| S3_MULTIPART_UPLOAD_MIN_OBJECT_SIZE_BYTES, | ||
| S3_MULTIPART_UPLOAD_MAX_OBJECT_SIZE_BYTES | ||
| ); | ||
| } | ||
|
|
||
| //check results size and chunk size are compatible. | ||
| if (chunkSize != null) { | ||
| validateChunkSize(maxResultsSize.getBytes(), chunkSize.getBytes()); | ||
| validateChunkSize(chunkSize.getBytes()); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -151,38 +127,16 @@ public File getTempDir() | |
|
|
||
| public Long getChunkSize() | ||
| { | ||
| return chunkSize == null ? computeMinChunkSize(getMaxResultsSize()) : chunkSize.getBytes(); | ||
| } | ||
|
|
||
| public long getMaxResultsSize() | ||
| { | ||
| return maxResultsSize.getBytes(); | ||
| return chunkSize.getBytes(); | ||
| } | ||
|
|
||
| public int getMaxRetry() | ||
| { | ||
| return maxRetry; | ||
| } | ||
|
|
||
|
|
||
| public static long computeMinChunkSize(long maxResultsSize) | ||
| { | ||
| return Math.max( | ||
| (long) Math.ceil(maxResultsSize / (double) S3_MULTIPART_UPLOAD_MAX_NUM_PARTS), | ||
| S3_MULTIPART_UPLOAD_MIN_PART_SIZE_BYTES | ||
| ); | ||
| } | ||
|
|
||
| private static void validateChunkSize(long maxResultsSize, long chunkSize) | ||
| private static void validateChunkSize(long chunkSize) | ||
| { | ||
| if (S3OutputConfig.computeMinChunkSize(maxResultsSize) > chunkSize) { | ||
| throw new IAE( | ||
| "chunkSize[%d] is too small for maxResultsSize[%d]. chunkSize should be at least [%d]", | ||
| chunkSize, | ||
| maxResultsSize, | ||
| S3OutputConfig.computeMinChunkSize(maxResultsSize) | ||
| ); | ||
| } | ||
| if (S3_MULTIPART_UPLOAD_MAX_PART_SIZE_BYTES < chunkSize) { | ||
| throw new IAE( | ||
| "chunkSize[%d] should be smaller than [%d]", | ||
|
|
@@ -206,14 +160,13 @@ public boolean equals(Object o) | |
| && bucket.equals(that.bucket) | ||
| && prefix.equals(that.prefix) | ||
| && tempDir.equals(that.tempDir) | ||
| && Objects.equals(chunkSize, that.chunkSize) | ||
| && maxResultsSize.equals(that.maxResultsSize); | ||
| && Objects.equals(chunkSize, that.chunkSize); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() | ||
| { | ||
| return Objects.hash(bucket, prefix, tempDir, chunkSize, maxResultsSize, maxRetry); | ||
| return Objects.hash(bucket, prefix, tempDir, chunkSize, maxRetry); | ||
| } | ||
|
|
||
| } | ||
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
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
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
Oops, something went wrong.
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.
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.
Please update the documentation also.
The release notes should mention that the defaults have changed and the value is removed.