You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "hemantk-12 (via GitHub)" <gi...@apache.org> on 2023/06/15 18:32:23 UTC

[GitHub] [ozone] hemantk-12 commented on a diff in pull request #4909: HDDS-8832. [Snapshot] Synchronized add snapshotInfo to snapshot chain and snapshot cache

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


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotChainManager.java:
##########
@@ -48,6 +47,10 @@
 public class SnapshotChainManager {
   private static final Logger LOG =
       LoggerFactory.getLogger(SnapshotChainManager.class);
+  // Dummy lock to synchronize addSnapshot and deleteSnapshot.
+  // This lock is also used by OMSnapshotCreateRequest to make sure that
+  // snapshot gets added to chain only if addition to cache is successfully.
+  public static final Object LOCK = new Object();

Review Comment:
   This lock is also used by `OMSnapshotCreateRequest`.
   I tried to explain it https://github.com/apache/ozone/pull/4909/files#diff-36b9bd9ebbbb4522cfe1ed312e68ea2ac91e9934a92d146ebb52a96644978e49R229-R231 and https://github.com/apache/ozone/pull/4909/files#diff-36b9bd9ebbbb4522cfe1ed312e68ea2ac91e9934a92d146ebb52a96644978e49R205-R220.
   
   I couldn't think of better idea. Even if I synchronize snapshot creation separately in `OMSnapshotCreateRequest`, it won't be sufficient. Because [deleteSnapshot](https://github.com/apache/ozone/blob/master/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotChainManager.java#L272) of  `SnapshotChainManager` can be called by `OMSnapshotPurgeResponse`. Which will leave us in similar situation like https://github.com/apache/ozone/pull/4909/files#diff-36b9bd9ebbbb4522cfe1ed312e68ea2ac91e9934a92d146ebb52a96644978e49R210-R220 if snapshot gets purge at the same time new gets created.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org