Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions hadoop-hdds/docs/content/feature/ErasureCoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ the configuration keys `ozone.server.default.replication.type` and `ozone.server
<name>ozone.server.default.replication.type</name>
<value>EC</value>
</property>
```

```XML
<property>
<name>ozone.server.default.replication</name>
<value>RS-6-3-1024k</value>
Expand Down Expand Up @@ -208,6 +210,22 @@ We can pass the EC Replication Config while creating the keys irrespective of bu
ozone sh key put <Ozone Key Object Path> <Local File> --type EC --replication rs-6-3-1024k
```

When using ofs/o3fs, we can pass the EC Replication Config by setting the configuration keys `ozone.replication.type` and `ozone.replication`.

```XML
<property>
<name>ozone.replication.type</name>
<value>EC</value>
</property>
```

```XML
<property>
<name>ozone.replication</name>
<value>rs-3-2-1024k</value>
</property>
```

In the case bucket already has default EC Replication Config, there is no need of passing EC Replication Config while creating key.

### Enable Intel ISA-L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
import static org.apache.hadoop.fs.contract.ContractTestUtils.assertHasPathCapabilities;
import static org.apache.hadoop.fs.ozone.Constants.LISTING_PAGE_SIZE;
import static org.apache.hadoop.fs.ozone.Constants.OZONE_DEFAULT_USER;
import static org.apache.hadoop.fs.ozone.OzoneFileSystemTests.createKeyWithECReplicationConfiguration;
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;
Expand Down Expand Up @@ -426,6 +427,19 @@ 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");
createKeyWithECReplicationConfiguration(cluster.getConf(), testKeyPath);

OzoneKeyDetails key = getKey(testKeyPath, false);
assertEquals(HddsProtos.ReplicationType.EC,
key.getReplicationConfig().getReplicationType());
assertEquals("rs-3-2-1024k",
key.getReplicationConfig().getReplication());
}

@Test
public void testDeleteCreatesFakeParentDir() throws Exception {
Path grandparent = new Path("/testDeleteCreatesFakeParentDir");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
import static org.apache.hadoop.fs.FileSystem.TRASH_PREFIX;
import static org.apache.hadoop.fs.contract.ContractTestUtils.assertHasPathCapabilities;
import static org.apache.hadoop.fs.ozone.Constants.LISTING_PAGE_SIZE;
import static org.apache.hadoop.fs.ozone.OzoneFileSystemTests.createKeyWithECReplicationConfiguration;
import static org.apache.hadoop.hdds.client.ECReplicationConfig.EcCodec.RS;
import static org.apache.hadoop.ozone.OzoneAcl.AclScope.ACCESS;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_ITERATE_BATCH_SIZE;
Expand Down Expand Up @@ -325,6 +326,19 @@ void testCreateDoesNotAddParentDirKeys() throws Exception {
fs.delete(grandparent, true);
}

@Test
public void testCreateKeyWithECReplicationConfig() throws Exception {
String testKeyName = "testKey";
Path testKeyPath = new Path(bucketPath, testKeyName);
createKeyWithECReplicationConfiguration(cluster.getConf(), testKeyPath);

OzoneKeyDetails key = getKey(testKeyPath, false);
assertEquals(HddsProtos.ReplicationType.EC,
key.getReplicationConfig().getReplicationType());
assertEquals("rs-3-2-1024k",
key.getReplicationConfig().getReplication());
}

@Test
void testListStatusWithIntermediateDirWithECEnabled()
throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RemoteIterator;
import org.apache.hadoop.fs.contract.ContractTestUtils;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;

import java.io.IOException;
Expand All @@ -30,6 +31,8 @@
import java.util.TreeSet;

import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_LISTING_PAGE_SIZE;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION_TYPE;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down Expand Up @@ -95,4 +98,17 @@ private static void listStatusIterator(FileSystem subject,

assertEquals(total, iCount);
}

static void createKeyWithECReplicationConfiguration(OzoneConfiguration inputConf, Path keyPath)
throws IOException {
OzoneConfiguration conf = new OzoneConfiguration(inputConf);
conf.set(OZONE_REPLICATION, "rs-3-2-1024k");
conf.set(OZONE_REPLICATION_TYPE, "EC");
URI uri = FileSystem.getDefaultUri(conf);
conf.setBoolean(
String.format("fs.%s.impl.disable.cache", uri.getScheme()), true);
try (FileSystem fileSystem = FileSystem.get(uri, conf)) {
ContractTestUtils.touch(fileSystem, keyPath);
}
}
}