-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-17139 Re-enable optimized copyFromLocal implementation in S3AFileSystem #3101
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
steveloughran
merged 20 commits into
apache:trunk
from
bogthe:s3/HADOOP-17139-enable-copyFromLocal
Jul 30, 2021
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
fe1f321
HADOOP-17139 Re-enable optimized copyFromLocal implementation in S3AF…
cd7e17e
Tracking the copyFromLocalFile PUT Object execution
75fddaa
Checkpoint commit
6b61289
First working implementation
1a14abd
Improvements in directory handling
90adc2b
Adding hadoop-common changes
081d386
Remove old implementation
057db22
Reverting common changes
817acb6
Added executor for copyFromLocal + improvements
dd1644f
Cleaning up and organizing tests
eb4b314
Adding license headers
3577279
Directory to directory copy improvements
0b3b197
Fixing identation and spot bugs error
3ef0e99
Trying to reboot yetus
0b09425
Updating `filesystem.md` documentation
bff3d88
Addressing PR comments
286b7f6
Addressing comments
35b9b08
Heave yetus heave
03c85c5
Updating spec
55d6fc0
Merging with trunk
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
98 changes: 98 additions & 0 deletions
98
...on-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSCopyFromLocal.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,98 @@ | ||
/* | ||
* 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; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.Test; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.contract.AbstractContractCopyFromLocalTest; | ||
import org.apache.hadoop.fs.contract.AbstractFSContract; | ||
import org.apache.hadoop.fs.contract.localfs.LocalFSContract; | ||
|
||
import static org.apache.hadoop.test.LambdaTestUtils.intercept; | ||
|
||
public class TestLocalFSCopyFromLocal extends AbstractContractCopyFromLocalTest { | ||
@Override | ||
protected AbstractFSContract createContract(Configuration conf) { | ||
return new LocalFSContract(conf); | ||
} | ||
|
||
@Test | ||
public void testDestinationFileIsToParentDirectory() throws Throwable { | ||
describe("Source is a file and destination is its own parent directory"); | ||
|
||
File file = createTempFile("local"); | ||
Path dest = new Path(file.getParentFile().toURI()); | ||
Path src = new Path(file.toURI()); | ||
|
||
intercept(PathOperationException.class, | ||
() -> getFileSystem().copyFromLocalFile( true, true, src, dest)); | ||
} | ||
|
||
@Test | ||
public void testDestinationDirectoryToSelf() throws Throwable { | ||
describe("Source is a directory and it is copied into itself with " + | ||
"delSrc flag set, destination must not exist"); | ||
|
||
File source = createTempDirectory("srcDir"); | ||
Path dest = new Path(source.toURI()); | ||
getFileSystem().copyFromLocalFile( true, true, dest, dest); | ||
|
||
assertPathDoesNotExist("Source found", dest); | ||
} | ||
|
||
@Test | ||
public void testSourceIntoDestinationSubDirectoryWithDelSrc() throws Throwable { | ||
describe("Copying a parent folder inside a child folder with" + | ||
" delSrc=TRUE"); | ||
File parent = createTempDirectory("parent"); | ||
File child = createTempDirectory(parent, "child"); | ||
|
||
Path src = new Path(parent.toURI()); | ||
Path dest = new Path(child.toURI()); | ||
getFileSystem().copyFromLocalFile(true, true, src, dest); | ||
|
||
assertPathDoesNotExist("Source found", src); | ||
assertPathDoesNotExist("Destination found", dest); | ||
} | ||
|
||
@Test | ||
public void testSourceIntoDestinationSubDirectory() throws Throwable { | ||
describe("Copying a parent folder inside a child folder with" + | ||
" delSrc=FALSE"); | ||
File parent = createTempDirectory("parent"); | ||
File child = createTempDirectory(parent, "child"); | ||
|
||
Path src = new Path(parent.toURI()); | ||
Path dest = new Path(child.toURI()); | ||
getFileSystem().copyFromLocalFile(false, true, src, dest); | ||
|
||
Path recursiveParent = new Path(dest, parent.getName()); | ||
Path recursiveChild = new Path(recursiveParent, child.getName()); | ||
|
||
// This definitely counts as interesting behaviour which needs documented | ||
// Depending on the underlying system this can recurse 15+ times | ||
recursiveParent = new Path(recursiveChild, parent.getName()); | ||
recursiveChild = new Path(recursiveParent, child.getName()); | ||
assertPathExists("Recursive parent not found", recursiveParent); | ||
assertPathExists("Recursive child not found", recursiveChild); | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.