-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-3955. Unable to list intermediate paths on keys created using S3G. #1196
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
24 commits
Select commit
Hold shift + click to select a range
669102e
Add create intermediate dir in key create
bharatviswa504 773bfd2
add config
bharatviswa504 a9489bb
add already file exists
bharatviswa504 e7eae28
fix cs
bharatviswa504 e5d67e7
address leading /
bharatviswa504 d9ebe99
add getFileStatus test
bharatviswa504 afb0f5c
address review comments
bharatviswa504 da4ed94
cs
bharatviswa504 010da1b
filesystem api
bharatviswa504 d916ee4
cs
bharatviswa504 c020f4a
address leading / to follow fs semantics
bharatviswa504 28b7d7e
add disable test
bharatviswa504 8c85c11
cs and fb
bharatviswa504 711343a
fb
bharatviswa504 1e55f1e
some corner case tests address review comments and handle empty keyName
bharatviswa504 edd38aa
add / test
bharatviswa504 8458f67
make empty key normal to key create also
bharatviswa504 75780f0
remove file request code
bharatviswa504 bcd5b78
add validatecheck and add tests
bharatviswa504 5f8e72a
address review comment
bharatviswa504 083c224
cs
bharatviswa504 301b6d0
remove spurious change
bharatviswa504 f0389ac
add test
bharatviswa504 15b9e5c
fix bug during rebase
bharatviswa504 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
132 changes: 132 additions & 0 deletions
132
...ation-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSWithObjectStoreCreate.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,132 @@ | ||
| /** | ||
| * 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 | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * 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.ozone; | ||
|
|
||
| import org.apache.commons.lang3.RandomStringUtils; | ||
| import org.apache.hadoop.fs.FileStatus; | ||
| import org.apache.hadoop.fs.FileSystem; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hadoop.hdds.conf.OzoneConfiguration; | ||
| import org.apache.hadoop.ozone.MiniOzoneCluster; | ||
| import org.apache.hadoop.ozone.TestDataUtil; | ||
| import org.apache.hadoop.ozone.client.OzoneBucket; | ||
| import org.apache.hadoop.ozone.client.OzoneVolume; | ||
| import org.apache.hadoop.ozone.client.io.OzoneOutputStream; | ||
| import org.apache.hadoop.ozone.om.OMConfigKeys; | ||
| import org.junit.Assert; | ||
| import org.junit.Before; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
| import org.junit.rules.Timeout; | ||
|
|
||
| import java.net.URI; | ||
| import java.util.Arrays; | ||
|
|
||
| import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_SCHEME; | ||
|
|
||
| /** | ||
| * Class tests create with object store and getFileStatus. | ||
| */ | ||
| public class TestOzoneFSWithObjectStoreCreate { | ||
|
|
||
| @Rule | ||
| public Timeout timeout = new Timeout(300000); | ||
|
|
||
| private String rootPath; | ||
|
|
||
| private MiniOzoneCluster cluster = null; | ||
|
|
||
| private OzoneFileSystem o3fs; | ||
|
|
||
| private String volumeName; | ||
|
|
||
| private String bucketName; | ||
|
|
||
|
|
||
| @Before | ||
| public void init() throws Exception { | ||
| volumeName = RandomStringUtils.randomAlphabetic(10).toLowerCase(); | ||
| bucketName = RandomStringUtils.randomAlphabetic(10).toLowerCase(); | ||
|
|
||
| OzoneConfiguration conf = new OzoneConfiguration(); | ||
|
|
||
| conf.setBoolean(OMConfigKeys.OZONE_OM_ENABLE_FILESYSTEM_PATHS, true); | ||
| cluster = MiniOzoneCluster.newBuilder(conf) | ||
| .setNumDatanodes(3) | ||
| .build(); | ||
| cluster.waitForClusterToBeReady(); | ||
|
|
||
| // create a volume and a bucket to be used by OzoneFileSystem | ||
| OzoneBucket bucket = | ||
| TestDataUtil.createVolumeAndBucket(cluster, volumeName, bucketName); | ||
|
|
||
| rootPath = String.format("%s://%s.%s/", OZONE_URI_SCHEME, bucketName, | ||
| volumeName); | ||
| o3fs = (OzoneFileSystem) FileSystem.get(new URI(rootPath), conf); | ||
| } | ||
|
|
||
|
|
||
| @Test | ||
| public void test() throws Exception { | ||
|
|
||
| OzoneVolume ozoneVolume = | ||
| cluster.getRpcClient().getObjectStore().getVolume(volumeName); | ||
|
|
||
| OzoneBucket ozoneBucket = ozoneVolume.getBucket(bucketName); | ||
|
|
||
| String key1 = "///dir1/dir2/file1"; | ||
| String key2 = "///dir1/dir2/file2"; | ||
| int length = 10; | ||
| OzoneOutputStream ozoneOutputStream = ozoneBucket.createKey(key1, length); | ||
| byte[] b = new byte[10]; | ||
| Arrays.fill(b, (byte)96); | ||
| ozoneOutputStream.write(b); | ||
| ozoneOutputStream.close(); | ||
|
|
||
| ozoneOutputStream = ozoneBucket.createKey(key2, length); | ||
| ozoneOutputStream.write(b); | ||
| ozoneOutputStream.close(); | ||
|
|
||
| // Adding "/" here otherwise Path will be considered as relative path and | ||
| // workingDir will be added. | ||
| key1 = "///dir1/dir2/file1"; | ||
| Path p = new Path(key1); | ||
| Assert.assertTrue(o3fs.getFileStatus(p).isFile()); | ||
|
|
||
| p = p.getParent(); | ||
| checkAncestors(p); | ||
|
|
||
|
|
||
| key2 = "///dir1/dir2/file2"; | ||
| p = new Path(key2); | ||
| Assert.assertTrue(o3fs.getFileStatus(p).isFile()); | ||
| checkAncestors(p); | ||
|
|
||
| } | ||
|
|
||
| private void checkAncestors(Path p) throws Exception { | ||
| p = p.getParent(); | ||
| while(p.getParent() != null) { | ||
| FileStatus fileStatus = o3fs.getFileStatus(p); | ||
| Assert.assertTrue(fileStatus.isDirectory()); | ||
| p = p.getParent(); | ||
| } | ||
| } | ||
|
|
||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.