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