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


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotChainManager.java:
##########
@@ -71,7 +71,27 @@ public SnapshotChainManager(OMMetadataManager 
metadataManager) {
   private void addSnapshotGlobal(UUID snapshotID,
                                  UUID prevGlobalID) throws IOException {
     // On add snapshot, set previous snapshot entry nextSnapshotID = snapshotID
+    if (globalSnapshotChain.containsKey(snapshotID)) {
+      throw new IllegalStateException(String.format(
+          "Snapshot chain corruption. Snapshot with snapshotId: %s is " +
+              "already present in the the chain.", snapshotID));
+    }
+    if (globalSnapshotChain.size() > 0 && prevGlobalID == null) {
+      throw new IllegalStateException(String.format("Snapshot chain " +
+          "corruption. Adding snapshot %s as head node while there are %d in " 
+

Review Comment:
   nit: `...there are %d snapshot/s in...` or nodes whatever you feel like.



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