DonalEvans commented on a change in pull request #5845:
URL: https://github.com/apache/geode/pull/5845#discussion_r542575827



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
##########
@@ -1354,6 +1355,7 @@ private void 
peekEventsFromIncompleteTransactions(List<GatewaySenderEventImpl> b
       return;
     }
 
+    boolean areAllEventsForTransactionsInBatch = true;

Review comment:
       The name of this variable is too similar to the already existing 
`areAllEventsForTransactionInBatch`, which is confusing. Please rename one or 
both of them to make it clearer what they are keeping track of.

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderStats.java
##########
@@ -240,6 +246,9 @@ protected static StatisticsType createType(final 
StatisticsTypeFactory f, final
             f.createIntCounter(BATCHES_REDISTRIBUTED,
                 "Number of batches of events removed from the event queue and 
resent.",
                 "operations", false),
+            f.createIntCounter(BATCHES_WITH_INCOMPLETE_TRANSACTIONS,
+                "Number of batches of events sent with incomplete 
transactions.",
+                "operations", false),

Review comment:
       The `createIntCounter()` method is deprecated. As per the javadocs on 
the method, `createLongCounter()` should be used instead.

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
##########
@@ -486,6 +486,7 @@ private void 
peekEventsFromIncompleteTransactions(List<AsyncEvent<?, ?>> batch,
       return;
     }
 
+    boolean areAllEventsForTransactionsInBatch = true;

Review comment:
       The name of this variable is too similar to the already existing 
areAllEventsForTransactionInBatch, which is confusing. Please rename one or 
both of them to make it clearer what they are keeping track of.

##########
File path: 
geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
##########
@@ -467,8 +467,66 @@ public void 
testPRParallelPropagationWithGroupTransactionEventsSendsBatchesWithC
     assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + 
v7List.get(5));
     // events not queued conflated:
     assertEquals(0, v4List.get(7) + v5List.get(7) + v6List.get(7) + 
v7List.get(7));
+    // batches with incomplete transactions
+    assertEquals(0, (int) v4List.get(13));
+
+  }
+
+  @Test
+  public void 
testPRParallelPropagationWithGroupTransactionEventsWithIncompleteTransactions() 
{
+    Integer lnPort = vm0.invoke(() -> 
WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, 
lnPort));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+
+    int dispThreads = 2;
+    createSenderInVm(lnPort, vm4, dispThreads);
+
+    createReceiverPR(vm2, 0);
+
+    createSenderPRInVM(0, vm4);
+
+    startSenderInVMs("ln", vm4);
+
+    // Adding events in transactions
+    final Map<Object, Object> keyValue = new HashMap<>();
+    int entries = 30;
+    for (int i = 0; i < entries; i++) {
+      keyValue.put(i, i);
+    }
+
+    int entriesPerTransaction = 3;
+    vm4.invoke(
+        () -> WANTestBase.doPutsInsideTransactions(testName, keyValue, 
entriesPerTransaction));
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(testName, entries));
+
+    ArrayList<Integer> v4List =
+        (ArrayList<Integer>) vm4.invoke(() -> WANTestBase.getSenderStats("ln", 
0));
+
+    int batches = 4;

Review comment:
       It's not clear to me where this value is coming from. How do we know 
that we expect 4 batches with incomplete transactions here?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to