mhansonp commented on code in PR #7608:
URL: https://github.com/apache/geode/pull/7608#discussion_r853583299
##########
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientTestCase.java:
##########
@@ -590,73 +616,92 @@ private void durableFailoverAfterReconnect(int
redundancyLevel) {
}
durableClientVM.invoke(CacheServerTestUtil::disableShufflingOfEndpoints);
- durableClientVM.invoke(() ->
CacheServerTestUtil.createCacheClient(clientPool, regionName,
+ // Create the durable client cache (type = cache)
+ durableClientVM.invoke(() -> createCacheClient(clientPool, regionName,
getClientDistributedSystemProperties(durableClientId,
VERY_LONG_DURABLE_TIMEOUT_SECONDS),
- Boolean.TRUE));
+ true));
+
+ // Register interest in all entries in the region
+ registerInterest(durableClientVM, regionName, true,
InterestResultPolicy.NONE);
// Send clientReady message
- durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") {
+ durableClientVM.invoke("Send clientReady", new CacheSerializableRunnable()
{
@Override
public void run2() throws CacheException {
- CacheServerTestUtil.getCache().readyForEvents();
+ getCache().readyForEvents();
}
});
- registerInterest(durableClientVM, regionName, true,
InterestResultPolicy.NONE);
-
+ // Verify the durable client is connected to the servers.
+ verifyDurableClientPresent(VERY_LONG_DURABLE_TIMEOUT_SECONDS,
durableClientId, server1VM);
+ if (redundancyLevel == 1) {
+ verifyDurableClientPresent(VERY_LONG_DURABLE_TIMEOUT_SECONDS,
durableClientId, server2VM);
+ }
// Start normal publisher client
- publisherClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(
+ publisherClientVM.invoke(() -> createCacheClient(
getClientPool(NetworkUtils.getServerHostName(), server1Port,
server2Port, false),
regionName));
- // Publish some entries
- publishEntries(0, 1);
+ // put key 0
+ publishEntries(publisherClientVM, 0, 1);
- // Verify the durable client received the updates
+ // Verify the durable client received key 0
checkListenerEvents(1, 1, -1, durableClientVM);
- verifyDurableClientPresent(VERY_LONG_DURABLE_TIMEOUT_SECONDS,
durableClientId, server1VM);
+ // Wait to until the HARegionQueue has emptied before disconnecting the
Durable client
+ // to avoid having left over messages that processed, in particular, the
key 0 message
+ waitUntilHARegionQueueSizeIsZero(server1VM);
Review Comment:
Wait for the HA region queues to clear before disconnecting the durable
client we want to process all the messages first, then disconnect, otherwise we
will see them again when the client restarts.
--
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]