diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueContainerData.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueContainerData.java index 57b52643313..08899138fb9 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueContainerData.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueContainerData.java @@ -30,11 +30,11 @@ import java.io.IOException; */ public class KeyValueContainerData extends ContainerData { - // Path to Level DB/RocksDB Store. - private String dbPath; + // Path to Container metadata Level DB/RocksDB Store and .container file. + private String metadataPath; - // Path to Physical file system where container and checksum are stored. - private String containerFilePath; + // Path to Physical file system where chunks are stored. + private String chunksPath; //Type of DB used to store key to chunks mapping private String containerDBType; @@ -64,37 +64,37 @@ public class KeyValueContainerData extends ContainerData { this.numPendingDeletionBlocks = 0; } /** - * Returns path. + * Returns container metadata path. * * @return - path */ - public String getDbPath() { - return dbPath; + public String getMetadataPath() { + return metadataPath; } /** - * Sets path. + * Sets container metadata path. * * @param path - String. */ - public void setDbPath(String path) { - this.dbPath = path; + public void setMetadataPath(String path) { + this.metadataPath = path; } /** - * Get container file path. + * Get chunks path. * @return - Physical path where container file and checksum is stored. */ - public String getContainerFilePath() { - return containerFilePath; + public String getChunksPath() { + return chunksPath; } /** - * Set container Path. - * @param containerPath - File path. + * Set chunks Path. + * @param chunkPath - File path. */ - public void setContainerFilePath(String containerPath) { - this.containerFilePath = containerPath; + public void setChunksPath(String chunkPath) { + this.chunksPath = chunkPath; } /** diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueYaml.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueYaml.java index b7ce0d96cbb..d22092c265c 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueYaml.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyValueYaml.java @@ -144,8 +144,8 @@ public final class KeyValueYaml { // When a new field needs to be added, it needs to be added here. if (name.equals("containerType") || name.equals("containerId") || name.equals("layOutVersion") || name.equals("state") || - name.equals("metadata") || name.equals("dbPath") || - name.equals("containerFilePath") || name.equals( + name.equals("metadata") || name.equals("metadataPath") || + name.equals("chunksPath") || name.equals( "containerDBType")) { filtered.add(prop); } @@ -186,8 +186,9 @@ public final class KeyValueYaml { KeyValueContainerData kvData = new KeyValueContainerData(containerType, (long) nodes.get("containerId"), lv); kvData.setContainerDBType((String)nodes.get("containerDBType")); - kvData.setDbPath((String) nodes.get("dbPath")); - kvData.setContainerFilePath((String) nodes.get("containerFilePath")); + kvData.setMetadataPath((String) nodes.get( + "metadataPath")); + kvData.setChunksPath((String) nodes.get("chunksPath")); Map meta = (Map) nodes.get("metadata"); meta.forEach((key, val) -> { try { diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java index e057f6f7cd2..055110cd39a 100644 --- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java +++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java @@ -92,8 +92,8 @@ public class TestKeyValueContainerData { kvData.setState(state); kvData.setContainerDBType(containerDBType); - kvData.setContainerFilePath(path); - kvData.setDbPath(path); + kvData.setChunksPath(path); + kvData.setMetadataPath(path); kvData.incrReadBytes(10); kvData.incrWriteBytes(10); kvData.incrReadCount(); @@ -101,8 +101,8 @@ public class TestKeyValueContainerData { assertEquals(state, kvData.getState()); assertEquals(containerDBType, kvData.getContainerDBType()); - assertEquals(path, kvData.getContainerFilePath()); - assertEquals(path, kvData.getDbPath()); + assertEquals(path, kvData.getChunksPath()); + assertEquals(path, kvData.getMetadataPath()); assertEquals(10, kvData.getReadBytes()); assertEquals(10, kvData.getWriteBytes()); diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestKeyValueYaml.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestKeyValueYaml.java index 06f6f9d799a..8550c4727ec 100644 --- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestKeyValueYaml.java +++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestKeyValueYaml.java @@ -47,8 +47,8 @@ public class TestKeyValueYaml { KeyValueContainerData keyValueContainerData = new KeyValueContainerData( ContainerProtos.ContainerType.KeyValueContainer, Long.MAX_VALUE); keyValueContainerData.setContainerDBType("RocksDB"); - keyValueContainerData.setDbPath(path); - keyValueContainerData.setContainerFilePath(path); + keyValueContainerData.setMetadataPath(path); + keyValueContainerData.setChunksPath(path); File containerFile = new File(filePath, containerPath); @@ -65,8 +65,8 @@ public class TestKeyValueYaml { assertEquals(ContainerProtos.ContainerType.KeyValueContainer, kvData .getContainerType()); assertEquals("RocksDB", kvData.getContainerDBType()); - assertEquals(path, kvData.getContainerFilePath()); - assertEquals(path, kvData.getDbPath()); + assertEquals(path, kvData.getMetadataPath()); + assertEquals(path, kvData.getChunksPath()); assertEquals(ContainerProtos.ContainerLifeCycleState.OPEN, kvData .getState()); assertEquals(1, kvData.getLayOutVersion()); @@ -90,8 +90,8 @@ public class TestKeyValueYaml { assertEquals(ContainerProtos.ContainerType.KeyValueContainer, kvData .getContainerType()); assertEquals("RocksDB", kvData.getContainerDBType()); - assertEquals(path, kvData.getContainerFilePath()); - assertEquals(path, kvData.getDbPath()); + assertEquals(path, kvData.getMetadataPath()); + assertEquals(path, kvData.getChunksPath()); assertEquals(ContainerProtos.ContainerLifeCycleState.CLOSED, kvData .getState()); assertEquals(1, kvData.getLayOutVersion()); @@ -143,9 +143,9 @@ public class TestKeyValueYaml { .getContainerType()); assertEquals(9223372036854775807L, kvData.getContainerId()); assertEquals("/hdds/current/aed-fg4-hji-jkl/containerdir0/1", kvData - .getDbPath()); + .getChunksPath()); assertEquals("/hdds/current/aed-fg4-hji-jkl/containerdir0/1", kvData - .getContainerFilePath()); + .getMetadataPath()); assertEquals(1, kvData.getLayOutVersion()); assertEquals(2, kvData.getMetadata().size()); diff --git a/hadoop-hdds/container-service/src/test/resources/additionalfields.container b/hadoop-hdds/container-service/src/test/resources/additionalfields.container index d0df0fec391..b19ec44dfb8 100644 --- a/hadoop-hdds/container-service/src/test/resources/additionalfields.container +++ b/hadoop-hdds/container-service/src/test/resources/additionalfields.container @@ -1,9 +1,10 @@ ! containerDBType: RocksDB -containerFilePath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 +chunksPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 containerId: 9223372036854775807 containerType: KeyValueContainer -dbPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 +metadataPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 layOutVersion: 1 metadata: {OWNER: ozone, VOLUME: hdfs} -state: CLOSED \ No newline at end of file +state: CLOSED +aclEnabled: true \ No newline at end of file diff --git a/hadoop-hdds/container-service/src/test/resources/incorrect.container b/hadoop-hdds/container-service/src/test/resources/incorrect.container index d56702377c2..0d2bfd1897f 100644 --- a/hadoop-hdds/container-service/src/test/resources/incorrect.container +++ b/hadoop-hdds/container-service/src/test/resources/incorrect.container @@ -1,10 +1,9 @@ ! containerDBType: RocksDB -containerFilePath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 +chunksPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 containerId: 9223372036854775807 containerType: KeyValueContainer -dbPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 +metadataPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 layOutVersion: 1 metadata: {OWNER: ozone, VOLUME: hdfs} -state: INVALID -aclEnabled: true \ No newline at end of file +state: INVALID \ No newline at end of file