HDDS-136:Rename dbPath,containerFilePath. Contributed by Bharat Viswanadham

This commit is contained in:
Bharat Viswanadham 2018-06-11 13:14:03 -07:00
parent 0e437f9b17
commit 7e228e54c5
6 changed files with 41 additions and 40 deletions

View File

@ -30,11 +30,11 @@
*/ */
public class KeyValueContainerData extends ContainerData { public class KeyValueContainerData extends ContainerData {
// Path to Level DB/RocksDB Store. // Path to Container metadata Level DB/RocksDB Store and .container file.
private String dbPath; private String metadataPath;
// Path to Physical file system where container and checksum are stored. // Path to Physical file system where chunks are stored.
private String containerFilePath; private String chunksPath;
//Type of DB used to store key to chunks mapping //Type of DB used to store key to chunks mapping
private String containerDBType; private String containerDBType;
@ -64,37 +64,37 @@ public KeyValueContainerData(ContainerProtos.ContainerType type, long id,
this.numPendingDeletionBlocks = 0; this.numPendingDeletionBlocks = 0;
} }
/** /**
* Returns path. * Returns container metadata path.
* *
* @return - path * @return - path
*/ */
public String getDbPath() { public String getMetadataPath() {
return dbPath; return metadataPath;
} }
/** /**
* Sets path. * Sets container metadata path.
* *
* @param path - String. * @param path - String.
*/ */
public void setDbPath(String path) { public void setMetadataPath(String path) {
this.dbPath = path; this.metadataPath = path;
} }
/** /**
* Get container file path. * Get chunks path.
* @return - Physical path where container file and checksum is stored. * @return - Physical path where container file and checksum is stored.
*/ */
public String getContainerFilePath() { public String getChunksPath() {
return containerFilePath; return chunksPath;
} }
/** /**
* Set container Path. * Set chunks Path.
* @param containerPath - File path. * @param chunkPath - File path.
*/ */
public void setContainerFilePath(String containerPath) { public void setChunksPath(String chunkPath) {
this.containerFilePath = containerPath; this.chunksPath = chunkPath;
} }
/** /**

View File

@ -144,8 +144,8 @@ protected Set<Property> getProperties(Class<? extends Object> type)
// When a new field needs to be added, it needs to be added here. // When a new field needs to be added, it needs to be added here.
if (name.equals("containerType") || name.equals("containerId") || if (name.equals("containerType") || name.equals("containerId") ||
name.equals("layOutVersion") || name.equals("state") || name.equals("layOutVersion") || name.equals("state") ||
name.equals("metadata") || name.equals("dbPath") || name.equals("metadata") || name.equals("metadataPath") ||
name.equals("containerFilePath") || name.equals( name.equals("chunksPath") || name.equals(
"containerDBType")) { "containerDBType")) {
filtered.add(prop); filtered.add(prop);
} }
@ -186,8 +186,9 @@ public Object construct(Node node) {
KeyValueContainerData kvData = new KeyValueContainerData(containerType, KeyValueContainerData kvData = new KeyValueContainerData(containerType,
(long) nodes.get("containerId"), lv); (long) nodes.get("containerId"), lv);
kvData.setContainerDBType((String)nodes.get("containerDBType")); kvData.setContainerDBType((String)nodes.get("containerDBType"));
kvData.setDbPath((String) nodes.get("dbPath")); kvData.setMetadataPath((String) nodes.get(
kvData.setContainerFilePath((String) nodes.get("containerFilePath")); "metadataPath"));
kvData.setChunksPath((String) nodes.get("chunksPath"));
Map<String, String> meta = (Map) nodes.get("metadata"); Map<String, String> meta = (Map) nodes.get("metadata");
meta.forEach((key, val) -> { meta.forEach((key, val) -> {
try { try {

View File

@ -92,8 +92,8 @@ public void testKeyValueData() {
kvData.setState(state); kvData.setState(state);
kvData.setContainerDBType(containerDBType); kvData.setContainerDBType(containerDBType);
kvData.setContainerFilePath(path); kvData.setChunksPath(path);
kvData.setDbPath(path); kvData.setMetadataPath(path);
kvData.incrReadBytes(10); kvData.incrReadBytes(10);
kvData.incrWriteBytes(10); kvData.incrWriteBytes(10);
kvData.incrReadCount(); kvData.incrReadCount();
@ -101,8 +101,8 @@ public void testKeyValueData() {
assertEquals(state, kvData.getState()); assertEquals(state, kvData.getState());
assertEquals(containerDBType, kvData.getContainerDBType()); assertEquals(containerDBType, kvData.getContainerDBType());
assertEquals(path, kvData.getContainerFilePath()); assertEquals(path, kvData.getChunksPath());
assertEquals(path, kvData.getDbPath()); assertEquals(path, kvData.getMetadataPath());
assertEquals(10, kvData.getReadBytes()); assertEquals(10, kvData.getReadBytes());
assertEquals(10, kvData.getWriteBytes()); assertEquals(10, kvData.getWriteBytes());

View File

@ -47,8 +47,8 @@ public void testCreateContainerFile() throws IOException {
KeyValueContainerData keyValueContainerData = new KeyValueContainerData( KeyValueContainerData keyValueContainerData = new KeyValueContainerData(
ContainerProtos.ContainerType.KeyValueContainer, Long.MAX_VALUE); ContainerProtos.ContainerType.KeyValueContainer, Long.MAX_VALUE);
keyValueContainerData.setContainerDBType("RocksDB"); keyValueContainerData.setContainerDBType("RocksDB");
keyValueContainerData.setDbPath(path); keyValueContainerData.setMetadataPath(path);
keyValueContainerData.setContainerFilePath(path); keyValueContainerData.setChunksPath(path);
File containerFile = new File(filePath, containerPath); File containerFile = new File(filePath, containerPath);
@ -65,8 +65,8 @@ public void testCreateContainerFile() throws IOException {
assertEquals(ContainerProtos.ContainerType.KeyValueContainer, kvData assertEquals(ContainerProtos.ContainerType.KeyValueContainer, kvData
.getContainerType()); .getContainerType());
assertEquals("RocksDB", kvData.getContainerDBType()); assertEquals("RocksDB", kvData.getContainerDBType());
assertEquals(path, kvData.getContainerFilePath()); assertEquals(path, kvData.getMetadataPath());
assertEquals(path, kvData.getDbPath()); assertEquals(path, kvData.getChunksPath());
assertEquals(ContainerProtos.ContainerLifeCycleState.OPEN, kvData assertEquals(ContainerProtos.ContainerLifeCycleState.OPEN, kvData
.getState()); .getState());
assertEquals(1, kvData.getLayOutVersion()); assertEquals(1, kvData.getLayOutVersion());
@ -90,8 +90,8 @@ public void testCreateContainerFile() throws IOException {
assertEquals(ContainerProtos.ContainerType.KeyValueContainer, kvData assertEquals(ContainerProtos.ContainerType.KeyValueContainer, kvData
.getContainerType()); .getContainerType());
assertEquals("RocksDB", kvData.getContainerDBType()); assertEquals("RocksDB", kvData.getContainerDBType());
assertEquals(path, kvData.getContainerFilePath()); assertEquals(path, kvData.getMetadataPath());
assertEquals(path, kvData.getDbPath()); assertEquals(path, kvData.getChunksPath());
assertEquals(ContainerProtos.ContainerLifeCycleState.CLOSED, kvData assertEquals(ContainerProtos.ContainerLifeCycleState.CLOSED, kvData
.getState()); .getState());
assertEquals(1, kvData.getLayOutVersion()); assertEquals(1, kvData.getLayOutVersion());
@ -143,9 +143,9 @@ public void testCheckBackWardCompatabilityOfContainerFile() throws
.getContainerType()); .getContainerType());
assertEquals(9223372036854775807L, kvData.getContainerId()); assertEquals(9223372036854775807L, kvData.getContainerId());
assertEquals("/hdds/current/aed-fg4-hji-jkl/containerdir0/1", kvData assertEquals("/hdds/current/aed-fg4-hji-jkl/containerdir0/1", kvData
.getDbPath()); .getChunksPath());
assertEquals("/hdds/current/aed-fg4-hji-jkl/containerdir0/1", kvData assertEquals("/hdds/current/aed-fg4-hji-jkl/containerdir0/1", kvData
.getContainerFilePath()); .getMetadataPath());
assertEquals(1, kvData.getLayOutVersion()); assertEquals(1, kvData.getLayOutVersion());
assertEquals(2, kvData.getMetadata().size()); assertEquals(2, kvData.getMetadata().size());

View File

@ -1,9 +1,10 @@
!<KeyValueContainerData> !<KeyValueContainerData>
containerDBType: RocksDB containerDBType: RocksDB
containerFilePath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 chunksPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1
containerId: 9223372036854775807 containerId: 9223372036854775807
containerType: KeyValueContainer containerType: KeyValueContainer
dbPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 metadataPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1
layOutVersion: 1 layOutVersion: 1
metadata: {OWNER: ozone, VOLUME: hdfs} metadata: {OWNER: ozone, VOLUME: hdfs}
state: CLOSED state: CLOSED
aclEnabled: true

View File

@ -1,10 +1,9 @@
!<KeyValueContainerData> !<KeyValueContainerData>
containerDBType: RocksDB containerDBType: RocksDB
containerFilePath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 chunksPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1
containerId: 9223372036854775807 containerId: 9223372036854775807
containerType: KeyValueContainer containerType: KeyValueContainer
dbPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1 metadataPath: /hdds/current/aed-fg4-hji-jkl/containerdir0/1
layOutVersion: 1 layOutVersion: 1
metadata: {OWNER: ozone, VOLUME: hdfs} metadata: {OWNER: ozone, VOLUME: hdfs}
state: INVALID state: INVALID
aclEnabled: true