swamirishi commented on code in PR #7200:
URL: https://github.com/apache/ozone/pull/7200#discussion_r1765676523
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDeletingService.java:
##########
@@ -557,20 +291,20 @@ public void submitSnapshotMoveDeletedKeys(SnapshotInfo
snapInfo,
}
}
- public void submitRequest(OMRequest omRequest) {
+ private void submitRequest(OMRequest omRequest) {
try {
OzoneManagerRatisUtils.submitRequest(ozoneManager, omRequest,
clientId, getRunCount().get());
} catch (ServiceException e) {
- LOG.error("Snapshot Deleting request failed. " +
- "Will retry at next run.", e);
+ LOG.error("Snapshot Deleting request failed. Will retry at next run.",
e);
Review Comment:
done
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java:
##########
@@ -242,4 +242,43 @@ public static String
getOzonePathKeyForFso(OMMetadataManager metadataManager,
final long bucketId = metadataManager.getBucketId(volumeName, bucketName);
return OM_KEY_PREFIX + volumeId + OM_KEY_PREFIX + bucketId + OM_KEY_PREFIX;
}
+
+ /**
+ * Creates merged repeatedKeyInfo entry with the existing deleted entry in
the table.
+ * @param snapshotMoveKeyInfos keyInfos to be added.
+ * @param metadataManager metadataManager for a store.
+ * @return
+ * @throws IOException
+ */
+ public static RepeatedOmKeyInfo
createMergedRepeatedOmKeyInfoFromDeletedTableEntry(
+ OzoneManagerProtocolProtos.SnapshotMoveKeyInfos snapshotMoveKeyInfos,
OMMetadataManager metadataManager) throws
+ IOException {
+ String dbKey = snapshotMoveKeyInfos.getKey();
+ List<OmKeyInfo> keyInfoList = new ArrayList<>();
+ for (OzoneManagerProtocolProtos.KeyInfo info :
snapshotMoveKeyInfos.getKeyInfosList()) {
+ OmKeyInfo fromProtobuf = OmKeyInfo.getFromProtobuf(info);
+ keyInfoList.add(fromProtobuf);
+ }
+ // When older version of keys are moved to the next snapshot's deletedTable
+ // The newer version might also be in the next snapshot's deletedTable and
+ // it might overwrite. This is to avoid that and also avoid having
+ // orphans blocks. Checking the last keyInfoList size omKeyInfo versions,
+ // this is to avoid redundant additions if the last n versions match.
+ RepeatedOmKeyInfo result = metadataManager.getDeletedTable().get(dbKey);
+ if (result == null) {
+ result = new RepeatedOmKeyInfo(keyInfoList);
+ } else if (!isSameAsLatestOmKeyInfo(keyInfoList, result)) {
+ keyInfoList.forEach(result::addOmKeyInfo);
+ }
+ return result;
+ }
+
+ private static boolean isSameAsLatestOmKeyInfo(List<OmKeyInfo> omKeyInfos,
+ RepeatedOmKeyInfo result) {
Review Comment:
done
--
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]