Skip to content

Commit

Permalink
Bug 35575377 - Build: intermittent failure in ViewDistProcessorTests.…
Browse files Browse the repository at this point in the history
…updateAfterExpiry()

- removed implicit release() call from testSkipKeySerialization()
#nobug80
(auto-submit 101702 after successfully running remote remote.full)
Job ID: job.9.20230712172648.7288
(auto-submit integ 101707 main -> coherence-ce/main after successfully running remote remote.full)
Job ID: job.9.20230712185022.9852

[git-p4: depot-paths = "//dev/coherence-ce/main/": change = 101713]
  • Loading branch information
fryp committed Jul 12, 2023
1 parent 6b7e587 commit ec0296e
Showing 1 changed file with 47 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public void updateBeforeExpiry()
{
NamedCache cache = getNamedCache();
cache.clear();
Eventually.assertDeferred(cache::isEmpty, is(true));

cache.put("key", "value");
InvocableMap.EntryProcessor processor =
Expand All @@ -163,6 +164,7 @@ public void updateAfterExpiry()
{
NamedCache cache = getNamedCache();
cache.clear();
Eventually.assertDeferred(cache::isEmpty, is(true));

cache.put("key", "value");
InvocableMap.EntryProcessor processor =
Expand Down Expand Up @@ -367,68 +369,69 @@ public void testSkipKeySerialization()
{
// NOTE: this test presumes a single storage-enabled cluster member that
// is this test to reference count deserialization
try (NamedCache cache = getNamedCache())
{
cache.clear();
Eventually.assertDeferred(cache::size, is(0));
NamedCache cache = getNamedCache();
cache.clear();
Eventually.assertDeferred(cache::size, is(0));

if (!Config.getBoolean("coherence.distributed.localstorage", true) ||
cache.getCacheService().getInfo().getServiceMembers().size() > 1)
{
return; // skip test
}
if (!Config.getBoolean("coherence.distributed.localstorage", true) ||
cache.getCacheService().getInfo().getServiceMembers().size() > 1)
{
return; // skip test
}

Logger.out("[testSkipKeySerialization] cache instance: " + cache);
Logger.info("[testSkipKeySerialization] cache instance: " + cache.getClass().getName());

final int SIZE = 100;
Set<SerializationCountingKey> setKeys = new HashSet<>(SIZE / 2);
final int SIZE = 100;
Set<SerializationCountingKey> setKeys = new HashSet<>(SIZE / 2);

for (int i = 0; i < SIZE; i++)
for (int i = 0; i < SIZE; i++)
{
SerializationCountingKey key = new SerializationCountingKey("foo-" + i);
if ((i & 1) == 0)
{
SerializationCountingKey key = new SerializationCountingKey("foo-" + i);
if ((i & 1) == 0)
{
setKeys.add(key);
}

cache.put(key, "bar-" + i);
setKeys.add(key);
}

SafeService safeService = (SafeService) cache.getCacheService();
PartitionedCache distService = (PartitionedCache) safeService.getService();
Eventually.assertDeferred(() -> distService.getOwnershipEnabledMembers().size(), is(1));
waitForBalanced(cache.getCacheService());
Eventually.assertDeferred(cache::size, is(SIZE));
Eventually.assertDeferred(() -> distService.isDistributionStable(), is(true));
cache.put(key, "bar-" + i);
}

SerializationCountingKey.reset();
Eventually.assertDeferred(SerializationCountingKey.DESERIALIZATION_COUNTER::get, is(0));
Eventually.assertDeferred(SerializationCountingKey.SERIALIZATION_COUNTER::get, is(0));
SafeService safeService = (SafeService) cache.getCacheService();
PartitionedCache distService = (PartitionedCache) safeService.getService();
Eventually.assertDeferred(() -> distService.getOwnershipEnabledMembers().size(), is(1));
waitForBalanced(cache.getCacheService());
Eventually.assertDeferred(cache::size, is(SIZE));
Eventually.assertDeferred(() -> distService.isDistributionStable(), is(true));

Map mapResults = cache.invokeAll(setKeys, new OptimizedGetAllProcessor());
Eventually.assertDeferred(mapResults::size, is(setKeys.size()));
SerializationCountingKey.reset();
Eventually.assertDeferred(SerializationCountingKey.DESERIALIZATION_COUNTER::get, is(0));
Eventually.assertDeferred(SerializationCountingKey.SERIALIZATION_COUNTER::get, is(0));

// we do not expect any deserialization as the processor adds binary
// keys and there is no reason for PC to deserialize the key
int cExpected = cache instanceof ContinuousQueryCache
? setKeys.size() : 0;
Map mapResults = cache.invokeAll(setKeys, new OptimizedGetAllProcessor());
Eventually.assertDeferred(mapResults::size, is(setKeys.size()));

assertEquals("Deserialization should not occur for cache: " + cache,
cExpected, SerializationCountingKey.DESERIALIZATION_COUNTER.get());
// we do not expect any deserialization as the processor adds binary
// keys and there is no reason for PC to deserialize the key
int cExpected = cache instanceof ContinuousQueryCache
? setKeys.size() : 0;

// force the key to be deserialized
for (Map.Entry entry : (Set<Map.Entry>) mapResults.entrySet())
{
entry.getKey();
}
assertEquals("Deserialization should not occur for cache: " + cache,
cExpected, SerializationCountingKey.DESERIALIZATION_COUNTER.get());

assertEquals("Deserialization should not occur for cache: " + cache,
cExpected + setKeys.size(), SerializationCountingKey.DESERIALIZATION_COUNTER.get());
// force the key to be deserialized
for (Map.Entry entry : (Set<Map.Entry>) mapResults.entrySet())
{
entry.getKey();
}

assertEquals("Deserialization should not occur for cache: " + cache,
cExpected + setKeys.size(), SerializationCountingKey.DESERIALIZATION_COUNTER.get());

SerializationCountingKey.reset();
Eventually.assertDeferred(SerializationCountingKey.DESERIALIZATION_COUNTER::get, is(0));
Eventually.assertDeferred(SerializationCountingKey.SERIALIZATION_COUNTER::get, is(0));

cache.clear();
Eventually.assertDeferred(cache::isEmpty, is(true));
}

// ----- inner classes --------------------------------------------------
Expand Down

0 comments on commit ec0296e

Please sign in to comment.