Skip to content
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

HDDS-4743. [FSO] Add FSO variant of ITestOzoneContractDistcp. #2980

Merged
merged 4 commits into from Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,65 @@
/**
* 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.contract;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.tools.contract.AbstractContractDistCpTest;

import org.junit.AfterClass;
import org.junit.BeforeClass;

import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup;


/**
* Contract test suite covering S3A integration with DistCp.
* Uses the block output stream, buffered to disk. This is the
* recommended output mechanism for DistCP due to its scalability.
* This test suite runs the server in File System Optimized mode.
* <p>
* Note: It isn't possible to convert this into a parameterized test due to
* unrelated failures occurring while trying to handle directories with names
* containing '[' and ']' characters.
*/
public class ITestOzoneContractDistCpWithFSO
extends AbstractContractDistCpTest {

@BeforeClass
public static void createCluster() throws IOException {
OzoneContract.createCluster(true);
}

@AfterClass
public static void teardownCluster() throws IOException {
OzoneContract.destroyCluster();
}

@Override
protected OzoneContract createContract(Configuration conf) {
return new OzoneContract(conf);
}

@Override
protected void deleteTestDirInTeardown() throws IOException {
super.deleteTestDirInTeardown();
cleanup("TEARDOWN", getLocalFS(), getLocalDir());
}
}
Expand Up @@ -70,6 +70,12 @@ public static void initOzoneConfiguration(boolean fsoServer){
fsOptimizedServer = fsoServer;
}

public static void createCluster(boolean fsoServer) throws IOException {
// Set the flag to enable/disable FSO on server.
initOzoneConfiguration(fsoServer);
createCluster();
}

public static void createCluster() throws IOException {
OzoneConfiguration conf = new OzoneConfiguration();
DatanodeRatisServerConfig ratisServerConfig =
Expand All @@ -87,11 +93,15 @@ public static void createCluster() throws IOException {
conf.addResource(CONTRACT_XML);

if (fsOptimizedServer){
conf.setBoolean(OMConfigKeys.OZONE_OM_ENABLE_FILESYSTEM_PATHS,
true);
// Default bucket layout is set to FSO in case of FSO server.
conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT,
OMConfigKeys.OZONE_BUCKET_LAYOUT_FILE_SYSTEM_OPTIMIZED);
} else {
// Default bucket layout is set to LEGACY to support Hadoop compatible
// FS operations that are incompatible with OBS (default config value).
conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT,
BucketLayout.LEGACY.name());
}
conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT,
BucketLayout.LEGACY.name());

cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(5).build();
try {
Expand Down