Vladsz83 commented on code in PR #13577:
URL: https://github.com/apache/ignite/pull/13577#discussion_r4102727905


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotDeleteRequest.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.snapshot;
+
+import java.io.File;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.UUID;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageFactory;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Cluster snapshot delete distributed process request.
+ *
+ * @see SnapshotDeleteProcess
+ */
+public class SnapshotDeleteRequest implements Message {
+    /** Request ID. */
+    @Order(0)
+    UUID reqId;
+
+    /** Snapshot name. */
+    @Order(1)
+    String snpName;
+
+    /** Snapshot directory path. */
+    @Order(2)
+    @Nullable String snpPath;
+
+    /** Resolved absolute path. Transient */
+    @GridToStringExclude
+    @Nullable File resolvedPath;
+
+    /** Default constructor for {@link MessageFactory}. */
+    public SnapshotDeleteRequest() {
+        // No-op.
+    }
+
+    /**
+     * @param reqId Request ID.
+     * @param snpName Snapshot name.
+     * @param snpPath Snapshot directory path.
+     */
+    SnapshotDeleteRequest(UUID reqId, String snpName, @Nullable String 
snpPath) {
+        this.reqId = reqId;
+        this.snpName = snpName.trim();
+        this.snpPath = snpPath;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        SnapshotDeleteRequest other = (SnapshotDeleteRequest)o;
+
+        return snpName.equalsIgnoreCase(other.snpName) && 
Objects.equals(resolvedPath, other.resolvedPath);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        // Lower-cased to prevent concurrent snapshot operation ff the name 
typed with diffent cases.

Review Comment:
   Filesystems may not recognize case. 'testSnapshot' and 'TESTSNAPSHOT' might 
be the same real path. We shold prevent concurrent operations with the same 
paths. 



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

Reply via email to