sanpwc commented on code in PR #3831:
URL: https://github.com/apache/ignite-3/pull/3831#discussion_r1618234551


##########
modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java:
##########
@@ -276,17 +291,21 @@ protected TxManager clientTxManager() {
 
     /** {@inheritDoc} */
     protected TxManager txManager(TableViewInternal t) {
+        TxManager manager = txTestCluster.txManagers().get(primaryNode(t));

Review Comment:
   Please add assertNotNull for primaryNode(t) result. Formally it's valid to 
have null as getPrimaryReplica result, but likely it's not the case within 
given tests.



##########
modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java:
##########
@@ -477,6 +503,70 @@ private InternalTransaction deleteUpsertAll() {
         return tx;
     }
 
+    private void checkIfNull(Tuple res1, Function<Transaction, Tuple> 
retryFunc) {
+        if (res1 != null) {
+            return;
+        }
+
+        logger().error("Found null value after upsertAll.");
+
+        printDebugInfo();
+
+        var resExplicit = igniteTransactions.runInTransaction(retryFunc);
+
+        logger().info("Same explicit call resulted in {} value", resExplicit);
+
+        fail("Found null value after upsertAll.");
+    }
+
+    private void printDebugInfo() {
+        logger().info("Primary node for accounts table is [nodeName={}]", 
primaryNode(accounts));
+        logger().info("Cluster times:");
+        long latestTime = 
IgniteTestUtils.getFieldValue(txTestCluster.clientClock(), 
HybridClockImpl.class, "latestTime");
+        logger().info("Client clock [time={}]", 
HybridTimestamp.hybridTimestamp(latestTime));
+
+        txTestCluster.clocks().forEach((name, hybridClock) -> {
+                    long time = IgniteTestUtils.getFieldValue(hybridClock, 
HybridClockImpl.class, "latestTime");
+                    logger().info(
+                            "Cluster clock [cluster_name={}, time={}]",
+                            name,
+                            HybridTimestamp.hybridTimestamp(time)
+                    );
+                }
+        );
+        logger().info("Replica info:");
+        txTestCluster.replicaManagers().forEach((name, replicaManager) -> {
+
+            ConcurrentHashMap<ReplicationGroupId, CompletableFuture<Replica>> 
replicas =
+                    IgniteTestUtils.getFieldValue(replicaManager, 
ReplicaManager.class, "replicas");
+            replicas.forEach((replicationGroupId, replicaCompletableFuture) ->
+                    printReplicaInfo(name, replicationGroupId, 
replicaCompletableFuture)
+            );
+        });
+    }
+
+    private void printReplicaInfo(String name, ReplicationGroupId 
replicationGroupId, CompletableFuture<Replica> replicaCompletableFuture) {
+        Replica replica;
+        try {
+            replica = replicaCompletableFuture.get();
+        } catch (InterruptedException | ExecutionException e) {
+            throw new RuntimeException(e);
+        }
+
+        PartitionReplicaListener listener = 
IgniteTestUtils.getFieldValue(replica, Replica.class, "listener");
+        TestMvPartitionStorage storage = 
IgniteTestUtils.getFieldValue(listener, PartitionReplicaListener.class, 
"mvDataStorage");

Review Comment:
   Let's also print txnStateStorage records. It'll be useful in order to 
understand how writeIntent was resolved if any.



##########
modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java:
##########
@@ -477,6 +503,70 @@ private InternalTransaction deleteUpsertAll() {
         return tx;
     }
 
+    private void checkIfNull(Tuple res1, Function<Transaction, Tuple> 
retryFunc) {
+        if (res1 != null) {
+            return;
+        }
+
+        logger().error("Found null value after upsertAll.");
+
+        printDebugInfo();
+
+        var resExplicit = igniteTransactions.runInTransaction(retryFunc);
+
+        logger().info("Same explicit call resulted in {} value", resExplicit);
+
+        fail("Found null value after upsertAll.");
+    }
+
+    private void printDebugInfo() {
+        logger().info("Primary node for accounts table is [nodeName={}]", 
primaryNode(accounts));
+        logger().info("Cluster times:");
+        long latestTime = 
IgniteTestUtils.getFieldValue(txTestCluster.clientClock(), 
HybridClockImpl.class, "latestTime");
+        logger().info("Client clock [time={}]", 
HybridTimestamp.hybridTimestamp(latestTime));
+
+        txTestCluster.clocks().forEach((name, hybridClock) -> {
+                    long time = IgniteTestUtils.getFieldValue(hybridClock, 
HybridClockImpl.class, "latestTime");
+                    logger().info(
+                            "Cluster clock [cluster_name={}, time={}]",

Review Comment:
   It's rather node_name and not the cluster one. Besides that we usually do 
not use underscore in variable names in logs. Anyway, who cares, it's a tmp log 
that'll be removed as soon as we will fix the problem.



##########
modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java:
##########
@@ -383,7 +402,7 @@ public void 
testRepeatedCommitRollbackAfterUpdateWithException() throws Exceptio
     }
 
     @Test
-    public void testRepeatedCommitRollbackAfterRollbackWithException() throws 
Exception {
+    public void testRepeatedCommitRollbackAfterRollbackWithException() {

Review Comment:
   Let's also cover testDeleteUpsertAllRollback. It's the test with highest 
failure rate.



-- 
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-unsubscr...@ignite.apache.org

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

Reply via email to