sumitagrawl commented on code in PR #7934:
URL: https://github.com/apache/ozone/pull/7934#discussion_r1972872807
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/TarContainerPacker.java:
##########
@@ -95,9 +101,19 @@ public byte[]
unpackContainerData(Container<KeyValueContainerData> container,
Files.createDirectories(destContainerDir);
}
if (FileUtils.isEmptyDirectory(destContainerDir.toFile())) {
+ // Before the atomic move, the destination dir is empty and doesn't have
a metadata directory.
+ // Writing the .container file will fail as the metadata dir doesn't
exist
+ Path containerMetadataPath =
Paths.get(container.getContainerData().getMetadataPath());
Review Comment:
I was going to flow of import by seeing this code,
1. Untar the container pack (excluding container yaml file) to temp
2. move the container dir to active path
3. create the <containerId>.container file having container metadata in
KeyValueContainer.importContainerData()
4. update the DB content
So we can set RECOVERING state before step "3" and call normal create as
"3". But will record original state
And after step 4, reupdate the state to original and write it again the same
container file using
```
containerData.setState(orignialState);
File containerFile = getContainerFile();
// update the new container data to .container File
updateContainerFile(containerFile);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]