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


##########
modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItOperationRetryTest.java:
##########
@@ -97,15 +112,105 @@ public void testLockExceptionRetry() {
             return false;
         });
 
-        view.upsert(tx2, Tuple.create().set("key", 1).set("val", "new value"));
+        view.upsert(tx2, NEW_RECORD_TUPLE);
 
         tx2.commit();
 
-        assertEquals("new value", view.get(null, Tuple.create().set("key", 
1)).value("val"));
+        assertEquals(NEW_RECORD_VALUE, view.get(null, 
NEW_RECORD_KEY_TUPLE).value("val"));
+    }
+
+    @Test
+    public void retryImplicitTransactionsDueToReplicaMissTest() {
+        ZonePartitionId partitionGroupId = testPartitionGroupId();
+        String leaseholderNodeName = 
waitAndGetPrimaryReplica(partitionGroupId);
+        IgniteImpl transactionCoordinatorNode = 
findNonLeaseholderNode(leaseholderNodeName);
+
+        // When upsert will be triggered then we have to pull the latch down 
and transfer lease to another leaseholder node.
+        CountDownLatch upsertIsTriggeredLatch = new CountDownLatch(1);
+
+        // When the latch is arisen, then in case of RW request to the current 
leaseholder we will wait. When latch is pulled down we
+        // additionally transfer lease and still pass a message, so actually 
the follow doesn't drop any message, but moves lease at
+        // the moment after upsert was triggered.
+        DefaultMessagingService messagingService = (DefaultMessagingService) 
transactionCoordinatorNode.clusterService().messagingService();
+        messagingService.dropMessages((nodeName, msg) -> {
+            boolean isMessageForCurrentLeaseholder = 
nodeName.equals(leaseholderNodeName);
+            boolean isLatchArisen = upsertIsTriggeredLatch.getCount() > 0;

Review Comment:
   the latch should make sure that primary replica for the first attempt is 
chosen, and be counted down only after it's chosen



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