jojochuang commented on code in PR #8157:
URL: https://github.com/apache/ozone/pull/8157#discussion_r2057045464


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -849,6 +858,40 @@ private void validateSnapshotsExistAndActive(final String 
volumeName,
     checkSnapshotActive(toSnapInfo, false);
   }
 
+  public void snapshotLimitCheck() throws IOException, OMException {
+    OmMetadataManagerImpl omMetadataManager = (OmMetadataManagerImpl) 
ozoneManager.getMetadataManager();
+    SnapshotChainManager snapshotChainManager = 
omMetadataManager.getSnapshotChainManager();
+    int currentSnapshotNum = 
snapshotChainManager.getGlobalSnapshotChain().size();
+    int oldCount = inFlightSnapshotCount.get();
+    int newCount = inFlightSnapshotCount.updateAndGet(count -> {

Review Comment:
   agreed this section is prone to race conditions.
   
   Semaphore would be a more appropriate solution, but it will be require a 
larger rewrite.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -172,6 +175,9 @@ public final class OmSnapshotManager implements 
AutoCloseable {
   // Soft limit of the snapshot cache size.
   private final int softCacheSize;
 
+  private int fsSnapshotMaxLimit;
+  private final AtomicInteger inFlightSnapshotCount = new AtomicInteger(0);

Review Comment:
   I'm new to this. What does inFlightSnapshotCount count?



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