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


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java:
##########
@@ -104,6 +104,8 @@ public OMSnapshotCreateRequest(OMRequest omRequest) {
   @RequireSnapshotFeatureState(true)
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
     final OMRequest omRequest = super.preExecute(ozoneManager);
+    // verify snapshot limit
+    ozoneManager.getOmSnapshotManager().snapshotLimitCheck();

Review Comment:
   With `inFlightSnapshotCount` approach, it should be moved just before the 
request is submitted to Ratis at line 125.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -849,6 +856,25 @@ private void validateSnapshotsExistAndActive(final String 
volumeName,
     checkSnapshotActive(toSnapInfo, false);
   }
 
+  public void validateSnapshotLimit() throws IOException {

Review Comment:
   This approach has an issue. `preExecute` runs only on a single node (the 
leader node, if I recall correctly), whereas `validateAndUpdateCache` runs on 
all nodes. If we decrement in `validateAndUpdateCache`, other nodes will keep 
decrementing without a corresponding increment, causing the value to go 
negative. Additionally, if leadership changes, it could result in exceeding the 
allowed limit.
   
   IMO, we can simplify this by relying on the `SnapshotChain` count, which 
will act as a soft limit initially and eventually become a hard limit. I doubt 
that `applyingTransaction` is slower than the write request rate to the extent 
that it would create a backlog of snapshot creation requests.



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