You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "denis-chudov (via GitHub)" <gi...@apache.org> on 2023/05/02 12:59:52 UTC

[GitHub] [ignite-3] denis-chudov commented on a diff in pull request #2003: IGNITE-19390 Handling lease deny message in placement driver side

denis-chudov commented on code in PR #2003:
URL: https://github.com/apache/ignite-3/pull/2003#discussion_r1182424225


##########
modules/placement-driver-api/src/main/java/org/apache/ignite/internal/placementdriver/message/PlacementDriverActorMessage.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.placementdriver.message;
+
+import org.apache.ignite.internal.replicator.ReplicationGroupId;
+import org.apache.ignite.network.NetworkMessage;
+import org.apache.ignite.network.annotations.Marshallable;
+
+/**
+ * Message which is sent from the replica side to an actor node.
+ */
+public interface PlacementDriverActorMessage extends NetworkMessage {
+    /**
+     * Gets a replication group id.
+     *
+     * @return Replication group id.
+     */
+    @Marshallable
+    ReplicationGroupId groupId();
+}

Review Comment:
   It doesnt differ from `PlacementDriverReplicaMessage`. Maybe unite both interfaces into one? 



##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/leases/Lease.java:
##########
@@ -95,7 +111,20 @@ public Lease acceptLease(HybridTimestamp to) {
                 + "leaseholder=" + leaseholder
                 + ", expirationTime=" + expirationTime + ']';
 
-        return new Lease(leaseholder, startTime, to, true);
+        return new Lease(leaseholder, startTime, to, true, true);
+    }
+
+    /**
+     * Denies the lease.
+     *
+     * @return Denied lease.
+     */
+    public Lease denyLease() {
+        assert accepted : "The lease is not accepted ["
+                + "leaseholder=" + leaseholder
+                + ", expirationTime=" + expirationTime + ']';
+
+        return new Lease(leaseholder, startTime, expirationTime, false, true);

Review Comment:
   Why denied lease is counted as accepted? Looks counter-intuitive.
   Is it a kludge to avoid considering lease agreement in lease updater cycle? Because if lease is not accepted, we look at the agreement, there is either accepted one, and we should publish lease, or UNDEFINED one, which is ready and not accepted, then we calculate the next lease holder with null redirect candidate, and thus get the same candidate which was denied. 
   
   In the document, I proposed the interface for leaseholder balancer, which accepts a set of nodes which should be ignored for candidate selection, in other words, this is a set of denied nodes. Why wouldn't we save this set of nodes to denied lease and pass it to nextLeaseHolder method? This will make the process of selecting new candidate after lease denial more clear and predictable.
   
   Anyway, I think at least denied lease should not be accepted, and updater cycle should take it into account before switching to agreement processing.
   
   Also, the lease denial should be logged.



-- 
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: notifications-unsubscribe@ignite.apache.org

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