swamirishi commented on code in PR #9141:
URL: https://github.com/apache/ozone/pull/9141#discussion_r2430671197
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java:
##########
@@ -95,14 +123,102 @@ public void createNewOmSnapshotLocalDataFile(RDBStore
snapshotStore, SnapshotInf
}
public OmSnapshotLocalData getOmSnapshotLocalData(SnapshotInfo snapshotInfo)
throws IOException {
- Path snapshotLocalDataPath =
Paths.get(getSnapshotLocalPropertyYamlPath(snapshotInfo));
- return snapshotLocalDataSerializer.load(snapshotLocalDataPath.toFile());
+ return getOmSnapshotLocalData(snapshotInfo.getSnapshotId());
+ }
+
+ public OmSnapshotLocalData getOmSnapshotLocalData(UUID snapshotId) throws
IOException {
+ Path snapshotLocalDataPath =
Paths.get(getSnapshotLocalPropertyYamlPath(snapshotId));
+ OmSnapshotLocalData snapshotLocalData =
snapshotLocalDataSerializer.load(snapshotLocalDataPath.toFile());
+ if (!Objects.equals(snapshotLocalData.getSnapshotId(), snapshotId)) {
+ throw new IOException("SnapshotId in path : " + snapshotLocalDataPath +
" contains snapshotLocalData " +
+ "corresponding to snapshotId " + snapshotLocalData.getSnapshotId() +
". Expected snapshotId " + snapshotId);
+ }
+ return snapshotLocalData;
}
public OmSnapshotLocalData getOmSnapshotLocalData(File snapshotDataPath)
throws IOException {
return snapshotLocalDataSerializer.load(snapshotDataPath);
}
+ private LocalDataVersionNode getVersionNode(UUID snapshotId, int version) {
+ if (!versionNodeMap.containsKey(snapshotId)) {
+ return null;
+ }
+ return versionNodeMap.get(snapshotId).getVersionNode(version);
+ }
+
+ private boolean addSnapshotVersionMeta(UUID snapshotId, SnapshotVersionsMeta
snapshotVersionsMeta)
+ throws IOException {
+ if (!versionNodeMap.containsKey(snapshotId)) {
Review Comment:
this should not happen the snapshotId won't be there in the map
--
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]