-
Notifications
You must be signed in to change notification settings - Fork 618
HDDS-10553. Add test case for creating file with EC replication config #6405
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0d223a7
HDDS-10553. Add unit test for creating keys/files with EC replication…
YuanbenWang 4a4a7d5
take advice
YuanbenWang c9ef5bd
take advice 2
YuanbenWang d3f131c
Revert "take advice 2"
adoroszlai 6e9ac65
copy input config, close filesystem
YuanbenWang 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,8 @@ | |
| import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.ONE; | ||
| import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED; | ||
| import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_ITERATE_BATCH_SIZE; | ||
| import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION; | ||
| import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION_TYPE; | ||
| import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX; | ||
| import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; | ||
| import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.KEY_NOT_FOUND; | ||
|
|
@@ -165,6 +167,7 @@ abstract class AbstractOzoneFileSystemTest { | |
| private OzoneManagerProtocol writeClient; | ||
| private FileSystem fs; | ||
| private OzoneFileSystem o3fs; | ||
| private OzoneConfiguration conf; | ||
| private OzoneFSStorageStatistics statistics; | ||
| private OzoneBucket ozoneBucket; | ||
| private String volumeName; | ||
|
|
@@ -174,7 +177,8 @@ abstract class AbstractOzoneFileSystemTest { | |
|
|
||
| @BeforeAll | ||
| void init() throws Exception { | ||
| OzoneConfiguration conf = new OzoneConfiguration(); | ||
| conf = new OzoneConfiguration(); | ||
| conf.set("fs.o3fs.impl.disable.cache", "true"); | ||
| conf.setFloat(OMConfigKeys.OZONE_FS_TRASH_INTERVAL_KEY, TRASH_INTERVAL); | ||
| conf.setFloat(FS_TRASH_INTERVAL_KEY, TRASH_INTERVAL); | ||
| conf.setFloat(FS_TRASH_CHECKPOINT_INTERVAL_KEY, TRASH_INTERVAL / 2); | ||
|
|
@@ -426,6 +430,23 @@ public void testCreateDoesNotAddParentDirKeys() throws Exception { | |
| assertTrue(fs.getFileStatus(parent).isDirectory(), "Parent directory does not appear to be a directory"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testCreateKeyWithECReplicationConfig() throws Exception { | ||
| Path root = new Path("/" + volumeName + "/" + bucketName); | ||
| Path testKeyPath = new Path(root, "testKey"); | ||
| conf.set(OZONE_REPLICATION, "rs-3-2-1024k"); | ||
| conf.set(OZONE_REPLICATION_TYPE, "EC"); | ||
| FileSystem fileSystem = FileSystem.get(conf); | ||
| ContractTestUtils.touch(fileSystem, testKeyPath); | ||
|
|
||
| OzoneKeyDetails key = getKey(testKeyPath, false); | ||
| assertEquals(HddsProtos.ReplicationType.EC, | ||
| key.getReplicationConfig().getReplicationType()); | ||
| assertEquals("rs-3-2-1024k", | ||
| key.getReplicationConfig().getReplication()); | ||
| fileSystem.close(); | ||
|
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. Please move the implementation to a new method in |
||
| } | ||
|
|
||
| @Test | ||
| public void testDeleteCreatesFakeParentDir() throws Exception { | ||
| Path grandparent = new Path("/testDeleteCreatesFakeParentDir"); | ||
|
|
@@ -1451,10 +1472,10 @@ public void testCreateKeyShouldUseRefreshedBucketReplicationConfig() | |
| bucket.getVolumeName()); | ||
|
|
||
| // Set the fs.defaultFS and start the filesystem | ||
| Configuration conf = new OzoneConfiguration(cluster.getConf()); | ||
| conf.set(FS_DEFAULT_NAME_KEY, rootPath); | ||
| Configuration configuration = new OzoneConfiguration(cluster.getConf()); | ||
| configuration.set(FS_DEFAULT_NAME_KEY, rootPath); | ||
| // Set the number of keys to be processed during batch operate. | ||
| OzoneFileSystem o3FS = (OzoneFileSystem) FileSystem.get(conf); | ||
| OzoneFileSystem o3FS = (OzoneFileSystem) FileSystem.get(configuration); | ||
|
|
||
| //Let's reset the clock to control the time. | ||
| ((BasicOzoneClientAdapterImpl) (o3FS.getAdapter())).setClock(testClock); | ||
|
|
||
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.
Please disable the cache only in the specific test case that needs new
FileSystemwith changed config, similar to:ozone/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/OzoneFileSystemTests.java
Lines 63 to 65 in 264cbc6