jojochuang commented on code in PR #8447:
URL: https://github.com/apache/ozone/pull/8447#discussion_r2093700129
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java:
##########
@@ -140,6 +140,7 @@ private void updateSnapshotInfoAndCache(SnapshotInfo
snapInfo, OmMetadataManager
// current snapshot is deleted. We can potentially
// reclaim more keys in the next snapshot.
snapInfo.setDeepClean(false);
+ snapInfo.setDeepCleanedDeletedDir(false);
Review Comment:
this is part of https://github.com/apache/ozone/pull/8451?
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java:
##########
@@ -191,6 +174,122 @@ private KeyDeletingTask(KeyDeletingService service) {
this.deletingService = service;
}
+ private OzoneManagerProtocolProtos.SetSnapshotPropertyRequest
getSetSnapshotRequestUpdatingExclusiveSize(
+ Map<UUID, Long> exclusiveSizeMap, Map<UUID, Long>
exclusiveReplicatedSizeMap, UUID snapshotID) {
+ OzoneManagerProtocolProtos.SnapshotSize snapshotSize =
OzoneManagerProtocolProtos.SnapshotSize.newBuilder()
+ .setExclusiveSize(
+ exclusiveSizeMap.getOrDefault(snapshotID, 0L))
+ .setExclusiveReplicatedSize(
+ exclusiveReplicatedSizeMap.getOrDefault(
+ snapshotID, 0L))
+ .build();
+ exclusiveSizeMap.remove(snapshotID);
+ exclusiveReplicatedSizeMap.remove(snapshotID);
+
+ return OzoneManagerProtocolProtos.SetSnapshotPropertyRequest.newBuilder()
+ .setSnapshotKey(snapshotChainManager.getTableKey(snapshotID))
+ .setSnapshotSize(snapshotSize)
+ .build();
+ }
+
+ /**
+ *
+ * @param currentSnapshotInfo if null, deleted directories in AOS should
be processed.
+ * @param keyManager KeyManager of the underlying store.
+ */
Review Comment:
/**
* Scans the OM database for keys or rename entries that are eligible
for deletion
* in the given store (either the active store or a specific snapshot).
*
* It collects a batch of eligible keys and/or renamed entries up to the
specified
* remainNum limit, submits deletion requests to SCM, and, on successful
confirmation,
* removes the entries from the metadata store. The method also updates
snapshot
* properties related to reclaimed space and deep cleaning flags as
required.
*
* @param currentSnapshotInfo If non-null, processes deleted keys for a
specific snapshot;
* if null, processes for the active object
store.
* @param keyManager The KeyManager instance for accessing keys
in the underlying store.
* @param remainNum The maximum number of entries to process
in this invocation.
* @return The number of entries remaining to be processed after this
method runs.
* @throws IOException If any error occurs during OM DB or SCM
operations.
*/
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java:
##########
@@ -191,6 +174,122 @@ private KeyDeletingTask(KeyDeletingService service) {
this.deletingService = service;
}
+ private OzoneManagerProtocolProtos.SetSnapshotPropertyRequest
getSetSnapshotRequestUpdatingExclusiveSize(
+ Map<UUID, Long> exclusiveSizeMap, Map<UUID, Long>
exclusiveReplicatedSizeMap, UUID snapshotID) {
+ OzoneManagerProtocolProtos.SnapshotSize snapshotSize =
OzoneManagerProtocolProtos.SnapshotSize.newBuilder()
+ .setExclusiveSize(
+ exclusiveSizeMap.getOrDefault(snapshotID, 0L))
+ .setExclusiveReplicatedSize(
+ exclusiveReplicatedSizeMap.getOrDefault(
+ snapshotID, 0L))
+ .build();
+ exclusiveSizeMap.remove(snapshotID);
+ exclusiveReplicatedSizeMap.remove(snapshotID);
+
+ return OzoneManagerProtocolProtos.SetSnapshotPropertyRequest.newBuilder()
+ .setSnapshotKey(snapshotChainManager.getTableKey(snapshotID))
+ .setSnapshotSize(snapshotSize)
+ .build();
+ }
+
+ /**
+ *
+ * @param currentSnapshotInfo if null, deleted directories in AOS should
be processed.
+ * @param keyManager KeyManager of the underlying store.
+ */
+ private int processDeletedKeysForStore(SnapshotInfo currentSnapshotInfo,
KeyManager keyManager,
Review Comment:
this method appears to be extracted out of the below call(). But why is it
much longer. Can it be broken up into smaller pieces.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/AbstractKeyDeletingService.java:
##########
@@ -658,4 +670,35 @@ public long getMovedFilesCount() {
public BootstrapStateHandler.Lock getBootstrapStateLock() {
return lock;
}
+
+ /**
+ * Submits SetSnapsnapshotPropertyRequest to OM.
+ * @param setSnapshotPropertyRequests request to be sent to OM
+ */
+ protected void submitSetSnapshotRequest(
+ List<OzoneManagerProtocolProtos.SetSnapshotPropertyRequest>
setSnapshotPropertyRequests) {
+ if (setSnapshotPropertyRequests.isEmpty()) {
+ return;
+ }
+ OzoneManagerProtocolProtos.OMRequest omRequest =
OzoneManagerProtocolProtos.OMRequest.newBuilder()
+ .setCmdType(OzoneManagerProtocolProtos.Type.SetSnapshotProperty)
+ .addAllSetSnapshotPropertyRequests(setSnapshotPropertyRequests)
+ .setClientId(clientId.toString())
+ .build();
+ Map<String, SnapshotInfo> val = new HashMap<>();
+ setSnapshotPropertyRequests
+ .forEach(i -> {
+ try {
+ val.put(i.getSnapshotKey(),
Review Comment:
does the hashmap val get used somewhere?
##########
hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto:
##########
@@ -1392,6 +1392,7 @@ message PurgeKeysRequest {
repeated SnapshotMoveKeyInfos keysToUpdate = 3;
// previous snapshotID can also be null & this field would be absent in
older requests.
optional NullableUUID expectedPreviousSnapshotID = 4;
+ repeated string renamedKeys = 5;
Review Comment:
does OMKeyPurgeRequest handler use this field?
--
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]