-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-18637:S3A to support upload of files greater than 2 GB using DiskBlocks #5481
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
03a8c8b
BASE COMMIT
768f41b
ADDED TEST
ddde1e6
MORE FIXES
542ffc2
MORE FIXES and Patches
773e03a
MORE FIXES and Patches
58a0453
MORE FIXES
5d3f9d9
MORE FIXES FOR TEST
a2d25f6
Added License Doc
f381b88
Review Fixes
ca725f9
Review Fixes
ea0007f
Review Fixes with the test
1f56e2a
File Fixes
4e922b4
Minor Changes
13fc2d5
Added tests for the committers
1476424
Review Fixes
f18c0cb
Review Fixes for the Path Capabilities on S3
7207fdd
Review Fixes for tests
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
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 |
|---|---|---|
|
|
@@ -124,6 +124,11 @@ public class RequestFactoryImpl implements RequestFactory { | |
| */ | ||
| private final StorageClass storageClass; | ||
|
|
||
| /** | ||
| * Is Multipart Enabled | ||
HarshitGupta11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| private final boolean isMultipartEnabled; | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * @param builder builder with all the configuration. | ||
|
|
@@ -137,6 +142,7 @@ protected RequestFactoryImpl( | |
| this.requestPreparer = builder.requestPreparer; | ||
| this.contentEncoding = builder.contentEncoding; | ||
| this.storageClass = builder.storageClass; | ||
| this.isMultipartEnabled = builder.isMultipartEnabled; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -460,7 +466,10 @@ public AbortMultipartUploadRequest newAbortMultipartUploadRequest( | |
| @Override | ||
| public InitiateMultipartUploadRequest newMultipartUploadRequest( | ||
| final String destKey, | ||
| @Nullable final PutObjectOptions options) { | ||
| @Nullable final PutObjectOptions options) throws IOException { | ||
| if(!isMultipartEnabled){ | ||
HarshitGupta11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| throw new IOException("Multipart uploads are disabled on the given filesystem."); | ||
|
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. make a PathIOException and include destkey. This gives a bit more detail. |
||
| } | ||
| final ObjectMetadata objectMetadata = newObjectMetadata(-1); | ||
| maybeSetMetadata(options, objectMetadata); | ||
| final InitiateMultipartUploadRequest initiateMPURequest = | ||
|
|
@@ -682,6 +691,11 @@ public static final class RequestFactoryBuilder { | |
| */ | ||
| private PrepareRequest requestPreparer; | ||
|
|
||
| /** | ||
| * Is Multipart Enabled on the path. | ||
| */ | ||
| private boolean isMultipartEnabled = true; | ||
|
|
||
| private RequestFactoryBuilder() { | ||
| } | ||
|
|
||
|
|
@@ -767,6 +781,18 @@ public RequestFactoryBuilder withRequestPreparer( | |
| this.requestPreparer = value; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Multipart enabled | ||
HarshitGupta11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| * @param value new value | ||
| * @return the builder | ||
| */ | ||
| public RequestFactoryBuilder withMultipartEnabled( | ||
| final boolean value) { | ||
| this.isMultipartEnabled = value; | ||
| return this; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
||
57 changes: 57 additions & 0 deletions
57
.../src/test/java/org/apache/hadoop/fs/s3a/commit/magic/ITestMagicCommitProtocolFailure.java
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 |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.fs.s3a.commit.magic; | ||
|
|
||
| import org.junit.Test; | ||
|
|
||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hadoop.fs.s3a.AbstractS3ATestBase; | ||
| import org.apache.hadoop.fs.s3a.commit.CommitConstants; | ||
| import org.apache.hadoop.fs.s3a.commit.PathCommitException; | ||
| import org.apache.hadoop.mapreduce.TaskAttemptContext; | ||
| import org.apache.hadoop.mapreduce.TaskAttemptID; | ||
| import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl; | ||
|
|
||
| import static org.apache.hadoop.fs.s3a.Constants.MULTIPART_UPLOADS_ENABLED; | ||
| import static org.apache.hadoop.fs.s3a.commit.CommitConstants.FS_S3A_COMMITTER_NAME; | ||
| import static org.apache.hadoop.fs.s3a.commit.CommitConstants.S3A_COMMITTER_FACTORY_KEY; | ||
|
|
||
| public class ITestMagicCommitProtocolFailure extends AbstractS3ATestBase { | ||
|
|
||
| @Override | ||
| protected Configuration createConfiguration() { | ||
| Configuration conf = super.createConfiguration(); | ||
| conf.setBoolean(MULTIPART_UPLOADS_ENABLED, false); | ||
HarshitGupta11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| conf.set(S3A_COMMITTER_FACTORY_KEY, CommitConstants.S3A_COMMITTER_FACTORY); | ||
| conf.set(FS_S3A_COMMITTER_NAME, CommitConstants.COMMITTER_NAME_MAGIC); | ||
| return conf; | ||
| } | ||
|
|
||
| @Test | ||
| public void testCreateCommitter() { | ||
| TaskAttemptContext tContext = new TaskAttemptContextImpl(getConfiguration(), | ||
| new TaskAttemptID()); | ||
| Path commitPath = getFileSystem().makeQualified( | ||
| new Path(getContract().getTestPath(), "/testpath")); | ||
| LOG.debug("{}", commitPath); | ||
HarshitGupta11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| assertThrows(PathCommitException.class, | ||
HarshitGupta11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| () -> new MagicS3GuardCommitter(commitPath, tContext)); | ||
| } | ||
| } | ||
58 changes: 58 additions & 0 deletions
58
...rg/apache/hadoop/fs/s3a/commit/staging/integration/ITestStagingCommitProtocolFailure.java
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 |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.fs.s3a.commit.staging.integration; | ||
|
|
||
| import org.junit.Test; | ||
|
|
||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hadoop.fs.s3a.AbstractS3ATestBase; | ||
| import org.apache.hadoop.fs.s3a.commit.CommitConstants; | ||
| import org.apache.hadoop.fs.s3a.commit.InternalCommitterConstants; | ||
| import org.apache.hadoop.fs.s3a.commit.PathCommitException; | ||
| import org.apache.hadoop.fs.s3a.commit.staging.StagingCommitter; | ||
| import org.apache.hadoop.mapreduce.TaskAttemptContext; | ||
| import org.apache.hadoop.mapreduce.TaskAttemptID; | ||
| import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl; | ||
|
|
||
| import static org.apache.hadoop.fs.s3a.Constants.MULTIPART_UPLOADS_ENABLED; | ||
| import static org.apache.hadoop.fs.s3a.commit.CommitConstants.FS_S3A_COMMITTER_NAME; | ||
| import static org.apache.hadoop.fs.s3a.commit.CommitConstants.S3A_COMMITTER_FACTORY_KEY; | ||
|
|
||
| public class ITestStagingCommitProtocolFailure extends AbstractS3ATestBase { | ||
| @Override | ||
| protected Configuration createConfiguration() { | ||
| Configuration conf = super.createConfiguration(); | ||
| conf.setBoolean(MULTIPART_UPLOADS_ENABLED, false); | ||
HarshitGupta11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| conf.set(S3A_COMMITTER_FACTORY_KEY, CommitConstants.S3A_COMMITTER_FACTORY); | ||
| conf.set(FS_S3A_COMMITTER_NAME, InternalCommitterConstants.COMMITTER_NAME_STAGING); | ||
| return conf; | ||
| } | ||
|
|
||
| @Test | ||
| public void testCreateCommitter() { | ||
| TaskAttemptContext tContext = new TaskAttemptContextImpl(getConfiguration(), | ||
| new TaskAttemptID()); | ||
| Path commitPath = getFileSystem().makeQualified( | ||
| new Path(getContract().getTestPath(), "/testpath")); | ||
| LOG.debug("{}", commitPath); | ||
| assertThrows(PathCommitException.class, | ||
|
||
| () -> new StagingCommitter(commitPath, tContext)); | ||
| } | ||
| } | ||
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
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.
just add a method validateOutputStreamConfiguration() and throw exception in the implementation only.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is still pending. I don't really mind leaving it as it is but I think my suggestion is consistent with other parts of the code and is more readable.
CC @steveloughran