xBis7 commented on code in PR #3741:
URL: https://github.com/apache/ozone/pull/3741#discussion_r1121775624
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java:
##########
@@ -350,6 +368,63 @@ public void createDbStore(MutableVolumeSet dbVolumeSet)
throws IOException {
}
}
+ /**
+ * Ensure that volume is initialized properly with
+ * cleanup path. Should disk be re-inserted into
+ * cluster, cleanup path should already be on
+ * disk. This method syncs the HddsVolume
+ * with the path on disk.
+ *
+ * @param id clusterId or scmId
+ */
+ public void checkTmpDirPaths(String id) {
+ Path tmpPath = createTmpPath(id);
+ deleteServiceDirPath = tmpPath.resolve(TMP_DELETE_SERVICE_DIR);
+ }
+
+ private Path createTmpPath(String id) {
+
+ // HddsVolume root directory path
+ String hddsRoot = getHddsRootDir().toString();
+
+ // HddsVolume path
+ String vol = HddsVolumeUtil.getHddsRoot(hddsRoot);
+
+ Path volPath = Paths.get(vol);
+ Path idPath = Paths.get(id);
Review Comment:
I've been looking at all the usage and
[this](https://github.com/apache/ozone/blob/f291058fa8974fe3a2844df5d27ec444e9826742/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/StorageVolumeUtil.java#L241-L265)
seems the only case where clusterID might not be available and we need to set
it.
For calling `VersionDatanodeFeatures.ScmHA.chooseContainerPathID` we need to
know clusterId which might not be available in the corner case we are trying to
cover here.
It makes more sense to me to overload `checkTmpDirPaths()` and have a
separate `checkTmpDirPaths(String id)` where we choose the id in
StorageVolumeUtil and pass it as a parameter.
@neils-dev What do you think?
--
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]