This is an automated email from the ASF dual-hosted git repository.
swamirishi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 3fee4c21bd5 HDDS-13799. Revert "HDDS-12982. Reduce log level for
snapshot validation failure (#8851)" (#9162)
3fee4c21bd5 is described below
commit 3fee4c21bd5c7a876ce72716c15f4487429f8391
Author: Wei-Chiu Chuang <[email protected]>
AuthorDate: Fri Oct 17 19:18:19 2025 -0700
HDDS-13799. Revert "HDDS-12982. Reduce log level for snapshot validation
failure (#8851)" (#9162)
---
.../hadoop/ozone/om/request/key/OMKeyPurgeRequest.java | 7 ++-----
.../org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java | 12 +++++++-----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyPurgeRequest.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyPurgeRequest.java
index 5fe932c4a09..d4da86ef090 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyPurgeRequest.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyPurgeRequest.java
@@ -97,11 +97,8 @@ public OMClientResponse validateAndUpdateCache(OzoneManager
ozoneManager, Execut
// redundant tombstone entry in the deletedTable. It is better to skip
the transaction.
UUID expectedPreviousSnapshotId =
purgeKeysRequest.getExpectedPreviousSnapshotID().hasUuid()
?
fromProtobuf(purgeKeysRequest.getExpectedPreviousSnapshotID().getUuid()) : null;
- if (!validatePreviousSnapshotId(fromSnapshotInfo,
omMetadataManager.getSnapshotChainManager(),
- expectedPreviousSnapshotId)) {
- return new OMKeyPurgeResponse(createErrorOMResponse(omResponse,
- new OMException("Snapshot validation failed",
OMException.ResultCodes.INVALID_REQUEST)));
- }
+ validatePreviousSnapshotId(fromSnapshotInfo,
omMetadataManager.getSnapshotChainManager(),
+ expectedPreviousSnapshotId);
}
} catch (IOException e) {
LOG.error("Error occurred while performing OmKeyPurge. ", e);
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java
index ea6d88c8e19..63e7e38d518 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java
@@ -292,17 +292,19 @@ public static UUID getLatestPathSnapshotId(String
volumeName, String bucketName,
return snapshotChainManager.getLatestPathSnapshotId(snapshotPath);
}
- public static boolean validatePreviousSnapshotId(SnapshotInfo snapshotInfo,
+ // Validates the previous path snapshotId for given a snapshotInfo. In case
snapshotInfo is
+ // null, the snapshotInfo would be considered as AOS and previous snapshot
becomes the latest snapshot in the global
+ // snapshot chain. Would throw OMException if validation fails otherwise
function would pass.
+ public static void validatePreviousSnapshotId(SnapshotInfo snapshotInfo,
SnapshotChainManager
snapshotChainManager,
UUID
expectedPreviousSnapshotId) throws IOException {
UUID previousSnapshotId = snapshotInfo == null ?
snapshotChainManager.getLatestGlobalSnapshotId() :
SnapshotUtils.getPreviousSnapshotId(snapshotInfo,
snapshotChainManager);
if (!Objects.equals(expectedPreviousSnapshotId, previousSnapshotId)) {
- LOG.warn("Snapshot validation failed. Expected previous snapshotId : " +
- expectedPreviousSnapshotId + " but was " + previousSnapshotId);
- return false;
+ throw new OMException("Snapshot validation failed. Expected previous
snapshotId : " +
+ expectedPreviousSnapshotId + " but was " + previousSnapshotId,
+ OMException.ResultCodes.INVALID_REQUEST);
}
- return true;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]