You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vp...@apache.org on 2023/11/23 10:59:51 UTC

(ignite-3) branch ignite-20918 created (now 56277f7c92)

This is an automated email from the ASF dual-hosted git repository.

vpyatkov pushed a change to branch ignite-20918
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


      at 56277f7c92 WIP

This branch includes the following new commits:

     new 56277f7c92 WIP

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(ignite-3) 01/01: WIP

Posted by vp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vpyatkov pushed a commit to branch ignite-20918
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 56277f7c92327513933aa0d76651aa1954478cee
Author: Vladislav Pyatkov <vl...@gmail.com>
AuthorDate: Thu Nov 23 13:59:11 2023 +0300

    WIP
---
 .../table/distributed/replicator/PartitionReplicaListener.java    | 8 ++++----
 .../replication/PartitionReplicaListenerIndexLockingTest.java     | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java
index 07abb1c326..92958eaa14 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java
@@ -343,7 +343,7 @@ public class PartitionReplicaListener implements ReplicaListener {
     }
 
     private CompletableFuture<Boolean> onPrimaryElected(PrimaryReplicaEventParameters evt, @Nullable Throwable exception) {
-        if (!localNode.name().equals(evt.leaseholder())) {
+        if (!localNode.name().equals(evt.leaseholder()) || !replicationGroupId.equals(evt.groupId())) {
             return completedFuture(false);
         }
 
@@ -3386,9 +3386,9 @@ public class PartitionReplicaListener implements ReplicaListener {
                         long currentEnlistmentConsistencyToken = primaryReplicaMeta.getStartTime().longValue();
 
                         // TODO: https://issues.apache.org/jira/browse/IGNITE-20377
-                        if (expectedTerm != currentEnlistmentConsistencyToken ||
-                                primaryReplicaMeta.getExpirationTime().before(now) ||
-                                !primaryReplicaMeta.getLeaseholderId().equals(localNode.id())) {
+                        if (expectedTerm != currentEnlistmentConsistencyToken
+                                || primaryReplicaMeta.getExpirationTime().before(now)
+                                || !primaryReplicaMeta.getLeaseholderId().equals(localNode.id())) {
                             return failedFuture(new PrimaryReplicaMissException(
                                     localNode.name(),
                                     primaryReplicaMeta.getLeaseholder(),
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/replication/PartitionReplicaListenerIndexLockingTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/replication/PartitionReplicaListenerIndexLockingTest.java
index 95be4b2e27..f7974d1cc0 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/replication/PartitionReplicaListenerIndexLockingTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/replication/PartitionReplicaListenerIndexLockingTest.java
@@ -102,6 +102,8 @@ import org.apache.ignite.internal.util.Lazy;
 import org.apache.ignite.internal.util.Pair;
 import org.apache.ignite.internal.util.PendingComparableValuesTracker;
 import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.network.ClusterNodeImpl;
+import org.apache.ignite.network.NetworkAddress;
 import org.hamcrest.CustomMatcher;
 import org.hamcrest.Matcher;
 import org.junit.jupiter.api.BeforeAll;
@@ -203,7 +205,7 @@ public class PartitionReplicaListenerIndexLockingTest extends IgniteAbstractTest
 
         when(catalogService.table(anyInt(), anyLong())).thenReturn(tableDescriptor);
 
-        ClusterNode localNode = mock(ClusterNode.class);
+        ClusterNode localNode = new ClusterNodeImpl("test-node-id", "test-node", new NetworkAddress("localhost", 1234));
 
         partitionReplicaListener = new PartitionReplicaListener(
                 TEST_MV_PARTITION_STORAGE,