hemantk-12 commented on code in PR #8157:
URL: https://github.com/apache/ozone/pull/8157#discussion_r2017775944


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java:
##########
@@ -147,6 +147,14 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, Execut
     OzoneManagerProtocolProtos.UserInfo userInfo = 
getOmRequest().getUserInfo();
     String key = snapshotInfo.getTableKey();
     try {
+      // Check snapshot limit
+      int maxSnapshots = ozoneManager.getFsSnapshotMaxLimit();
+      if (omMetrics.getNumSnapshotActive() >= maxSnapshots) {
+        throw new OMException(
+            String.format("Snapshot limit of %d reached. Cannot create more 
snapshots.", maxSnapshots),
+            OMException.ResultCodes.INVALID_SNAPSHOT_ERROR);

Review Comment:
   1. Can you please create a new ResultCode `TOO_MANY_SNAPSHOTS`?
   2. We should move this check to preExecute() similar to 
[buckets](https://github.com/apache/ozone/blob/770d3e62144267d2970f19ad29916186bec2b085/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java#L97).
 



-- 
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]

Reply via email to