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


##########
modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItOperationRetryTest.java:
##########
@@ -104,8 +110,47 @@ public void testLockExceptionRetry() {
         assertEquals("new value", view.get(null, Tuple.create().set("key", 
1)).value("val"));
     }
 
-    private IgniteImpl findNodeByName(String leaseholder) {
-        return findNode(0, initialNodes(), n -> leaseholder.equals(n.name()));
+    @Test
+    public void retryImplicitTransactionsTest() throws InterruptedException {
+        IgniteImpl node0 = unwrapIgniteImpl(node(0));
+
+        ZonePartitionId partitionGroupId = extractPartitionGroupId(node0, 
ZONE_NAME, PART_ID);
+
+        String leaseholderNodeName = waitAndGetPrimaryReplica(node0, 
partitionGroupId).getLeaseholder();
+
+        IgniteImpl leaseholderNode = findNodeByName(leaseholderNodeName);
+
+        IgniteImpl transactionCoordinatorNode = 
findNonLeaseholderNode(leaseholderNode);
+
+        IgniteImpl futureLeaseholderNode = findNodeByFilter(n -> {
+            String nodeName = n.name();
+
+            return !(nodeName.equals(leaseholderNode.name()) || 
nodeName.equals(transactionCoordinatorNode.name()));
+        });
+
+        DefaultMessagingService messagingService = (DefaultMessagingService) 
leaseholderNode.clusterService().messagingService();
+        messagingService.dropMessages((nodeName, msg) -> msg instanceof 
PrimaryReplicaRequest);

Review Comment:
   `dropMessages` drops outcoming messages, not incoming.
   The test will pass even if you comment the new error codes you added. And it 
will always fail if you replace `leaseholderNode` with 
`transactionCoordinatorNode` because you never release the messages.
   
   What I would expect:
   - you do 
`transactionCoordinatorNode.clusterService().messagingService().dropMessages...`
 adding some latch to predicate;
   - coordinator gets primary replica and tries to send the message there, the 
latch is released, the message is blocked;
   - you change primary replica;
   - then you release the message, it reaches the old primary replica but 
returns error as expected;
   - retry actually happens.



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