[JBoss JIRA] (ISPN-8319) Restore mechanism to manipulate Weigher implementation used by Caffeine
by Paul Ferraro (JIRA)
[ https://issues.jboss.org/browse/ISPN-8319?page=com.atlassian.jira.plugin.... ]
Paul Ferraro commented on ISPN-8319:
------------------------------------
... or manually evicts it (via Cache.evict(...)).
> Restore mechanism to manipulate Weigher implementation used by Caffeine
> -----------------------------------------------------------------------
>
> Key: ISPN-8319
> URL: https://issues.jboss.org/browse/ISPN-8319
> Project: Infinispan
> Issue Type: Enhancement
> Components: Eviction
> Affects Versions: 9.1.0.Final
> Reporter: Paul Ferraro
>
> Infinispan 9.1 allows a user to manipulate the Weigher implementation used by Caffeine to by configuring a cache with a custom DataContainer that uses a specific EntrySizeCalculator implementation. However, the DataContainerConfiguration object is deprecated, suggesting that a future release will no longer expose a mechanism for doing this. Such a mechanism is necessary to allow users to exempt specific cache entries (while allowing others) from eviction.
> One proposal is to allow users to specify an EntrySizeCalculator via the MemoryConfigurationBuilder.
> e.g.
> {code:java}
> public interface EntrySizeCalculatorProvider {
> <K, V> EntrySizeCalculator<K, V> getEntrySizeCalculator();
> }
> {code}
> MemoryConfigurationBuilder.java:
> {code:java}
> public MemoryConfigurationBuilder.entrySizeCalculatorProvider(EntrySizeCalculatorProvider provider) {
> // ...
> }
> {code}
> Additionally, we can reinterpret EvictionType as a specific EntrySizeCalculatorProvider implementation.
> e.g. MemoryConfigurationBuilder.java:
> {code:java}
> private static final Map<EvictionType, EntrySizeCalculatorProvider> PROVIDERS = new EnumMap<>(EvictionType.class);
> static {
> PROVIDERS.put(EvictionType.COUNT, new EntrySizeCalculatorProvider() {
> public <K, V> EntrySizeCalculator<K, V> getEntrySizeCalculator() {
> return (key, value) -> 1L;
> }
> });
> PROVIDERS.put(EvictionType.MEMORY, new EntrySizeCalculatorProvider() {
> public <K, V> EntrySizeCalculator<K, V> getEntrySizeCalculator() {
> return new WrappedByteArraySizeCalculator<>(new PrimitiveEntrySizeCalculator());
> }
> });
> }
> MemoryConfigurationBuilder evictionType(EvictionType type) {
> this.entrySizeCalculatorProvider(PROVIDERS.get(type));
> return this;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 6 months
[JBoss JIRA] (ISPN-8319) Restore mechanism to manipulate Weigher implementation used by Caffeine
by William Burns (JIRA)
[ https://issues.jboss.org/browse/ISPN-8319?page=com.atlassian.jira.plugin.... ]
William Burns commented on ISPN-8319:
-------------------------------------
Talking with Paul, it seems the underlying use case is to have an entry that is not part of the eviction processing ensuring it will always stay in the cache until the user removes it (or expiration).
> Restore mechanism to manipulate Weigher implementation used by Caffeine
> -----------------------------------------------------------------------
>
> Key: ISPN-8319
> URL: https://issues.jboss.org/browse/ISPN-8319
> Project: Infinispan
> Issue Type: Enhancement
> Components: Eviction
> Affects Versions: 9.1.0.Final
> Reporter: Paul Ferraro
>
> Infinispan 9.1 allows a user to manipulate the Weigher implementation used by Caffeine to by configuring a cache with a custom DataContainer that uses a specific EntrySizeCalculator implementation. However, the DataContainerConfiguration object is deprecated, suggesting that a future release will no longer expose a mechanism for doing this. Such a mechanism is necessary to allow users to exempt specific cache entries (while allowing others) from eviction.
> One proposal is to allow users to specify an EntrySizeCalculator via the MemoryConfigurationBuilder.
> e.g.
> {code:java}
> public interface EntrySizeCalculatorProvider {
> <K, V> EntrySizeCalculator<K, V> getEntrySizeCalculator();
> }
> {code}
> MemoryConfigurationBuilder.java:
> {code:java}
> public MemoryConfigurationBuilder.entrySizeCalculatorProvider(EntrySizeCalculatorProvider provider) {
> // ...
> }
> {code}
> Additionally, we can reinterpret EvictionType as a specific EntrySizeCalculatorProvider implementation.
> e.g. MemoryConfigurationBuilder.java:
> {code:java}
> private static final Map<EvictionType, EntrySizeCalculatorProvider> PROVIDERS = new EnumMap<>(EvictionType.class);
> static {
> PROVIDERS.put(EvictionType.COUNT, new EntrySizeCalculatorProvider() {
> public <K, V> EntrySizeCalculator<K, V> getEntrySizeCalculator() {
> return (key, value) -> 1L;
> }
> });
> PROVIDERS.put(EvictionType.MEMORY, new EntrySizeCalculatorProvider() {
> public <K, V> EntrySizeCalculator<K, V> getEntrySizeCalculator() {
> return new WrappedByteArraySizeCalculator<>(new PrimitiveEntrySizeCalculator());
> }
> });
> }
> MemoryConfigurationBuilder evictionType(EvictionType type) {
> this.entrySizeCalculatorProvider(PROVIDERS.get(type));
> return this;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 6 months
[JBoss JIRA] (ISPN-8325) MemoryConfiguration.isEvictionEnabled() returns false if size = 0
by Paul Ferraro (JIRA)
Paul Ferraro created ISPN-8325:
----------------------------------
Summary: MemoryConfiguration.isEvictionEnabled() returns false if size = 0
Key: ISPN-8325
URL: https://issues.jboss.org/browse/ISPN-8325
Project: Infinispan
Issue Type: Bug
Components: Configuration, Eviction
Affects Versions: 9.1.1.Final
Reporter: Paul Ferraro
Priority: Critical
The documentation for MemoryConfiguration explicitly states that eviction is disabled if size < 0, however, this method returns false if size = 0.
Configuring MemoryConfigurationBuilder with size(0L) causes evict(...) to log a confusing WARN message:
WARN: ISPN000419: Eviction of an entry invoked without an explicit eviction strategy for cache foo
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 6 months
[JBoss JIRA] (ISPN-8323) Cache.evict(...) throws NPE if entry was already evicted
by Paul Ferraro (JIRA)
Paul Ferraro created ISPN-8323:
----------------------------------
Summary: Cache.evict(...) throws NPE if entry was already evicted
Key: ISPN-8323
URL: https://issues.jboss.org/browse/ISPN-8323
Project: Infinispan
Issue Type: Bug
Components: Eviction
Affects Versions: 9.1.1.Final
Reporter: Paul Ferraro
Priority: Critical
Attachments: Test.java
Attached reproducer throws:
ERROR: ISPN000136: Error executing command EvictCommand, writing keys [1]
java.lang.NullPointerException
at java.util.HashMap.merge(HashMap.java:1224)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.Collections$2.tryAdvance(Collections.java:4717)
at java.util.Collections$2.forEachRemaining(Collections.java:4725)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.infinispan.notifications.cachelistener.CacheNotifierImpl.notifyCacheEntriesEvicted(CacheNotifierImpl.java:509)
at org.infinispan.commands.write.EvictCommand.notify(EvictCommand.java:56)
at org.infinispan.notifications.cachelistener.NotifyHelper.entryCommitted(NotifyHelper.java:25)
at org.infinispan.interceptors.locking.ClusteringDependentLogic$LocalLogic.commitSingleEntry(ClusteringDependentLogic.java:332)
at org.infinispan.interceptors.locking.ClusteringDependentLogic$AbstractClusteringDependentLogic.commitEntry(ClusteringDependentLogic.java:183)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitContextEntry(EntryWrappingInterceptor.java:578)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitEntryIfNeeded(EntryWrappingInterceptor.java:801)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitContextEntries(EntryWrappingInterceptor.java:555)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.applyChanges(EntryWrappingInterceptor.java:611)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.lambda$setSkipRemoteGetsAndInvokeNextForDataCommand$7(EntryWrappingInterceptor.java:667)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextThenAccept(BaseAsyncInterceptor.java:109)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:664)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitRemoveCommand(EntryWrappingInterceptor.java:360)
at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitEvictCommand(EntryWrappingInterceptor.java:398)
at org.infinispan.commands.write.EvictCommand.acceptVisitor(EvictCommand.java:34)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext(BaseAsyncInterceptor.java:58)
at org.infinispan.interceptors.DDAsyncInterceptor.handleDefault(DDAsyncInterceptor.java:54)
at org.infinispan.interceptors.DDAsyncInterceptor.visitEvictCommand(DDAsyncInterceptor.java:95)
at org.infinispan.commands.write.EvictCommand.acceptVisitor(EvictCommand.java:34)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext(BaseAsyncInterceptor.java:58)
at org.infinispan.interceptors.impl.CacheMgmtInterceptor.visitEvictCommand(CacheMgmtInterceptor.java:74)
at org.infinispan.commands.write.EvictCommand.acceptVisitor(EvictCommand.java:34)
at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndExceptionally(BaseAsyncInterceptor.java:127)
at org.infinispan.interceptors.impl.InvocationContextInterceptor.visitCommand(InvocationContextInterceptor.java:96)
at org.infinispan.interceptors.impl.AsyncInterceptorChainImpl.invoke(AsyncInterceptorChainImpl.java:248)
at org.infinispan.cache.impl.CacheImpl.evict(CacheImpl.java:863)
at org.infinispan.cache.impl.CacheImpl.evict(CacheImpl.java:853)
at org.infinispan.cache.impl.AbstractDelegatingCache.evict(AbstractDelegatingCache.java:64)
at org.infinispan.cache.impl.EncoderCache.evict(EncoderCache.java:234)
at org.wildfly.clustering.infinispan.spi.persistence.Test.evict(Test.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 6 months
[JBoss JIRA] (ISPN-8322) Cache.evict(...) ignores Flag.SKIP_LISTENER_NOTIFICATION
by Paul Ferraro (JIRA)
Paul Ferraro created ISPN-8322:
----------------------------------
Summary: Cache.evict(...) ignores Flag.SKIP_LISTENER_NOTIFICATION
Key: ISPN-8322
URL: https://issues.jboss.org/browse/ISPN-8322
Project: Infinispan
Issue Type: Bug
Components: Eviction
Affects Versions: 9.1.1.Final
Reporter: Paul Ferraro
Priority: Critical
Attachments: Test.java
cache.getAdvancedCache().withFlags(Flag.SKIP_LISTENER_NOTIFICATION).evict(...) should never directly trigger a CacheEntriesEvicted event. See attached reproducer.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 6 months
[JBoss JIRA] (ISPN-8321) Deadlock in hibernate-cache tests
by Gustavo Fernandes (JIRA)
[ https://issues.jboss.org/browse/ISPN-8321?page=com.atlassian.jira.plugin.... ]
Gustavo Fernandes updated ISPN-8321:
------------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
> Deadlock in hibernate-cache tests
> ---------------------------------
>
> Key: ISPN-8321
> URL: https://issues.jboss.org/browse/ISPN-8321
> Project: Infinispan
> Issue Type: Bug
> Components: Hibernate Cache
> Affects Versions: 9.1.0.Final
> Reporter: Gustavo Fernandes
> Assignee: Galder Zamarreño
> Labels: testsuite_stability
> Attachments: deadlock.txt
>
>
> {noformat}
> Found one Java-level deadlock:
> =============================
> "TestDisconnectHandler-1":
> waiting to lock monitor 0x00007fdff40036f8 (object 0x00000007359182d0, a org.jgroups.protocols.pbcast.Merger),
> which is held by "jgroups-4,EntityCollectionInvalidationTest-NodeF-59512"
> "jgroups-4,EntityCollectionInvalidationTest-NodeF-59512":
> waiting for ownable synchronizer 0x0000000735645138, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
> which is held by "TestDisconnectHandler-1"
> Java stack information for the threads listed above:
> ===================================================
> "TestDisconnectHandler-1":
> at org.jgroups.protocols.pbcast.Merger.cancelMerge(Merger.java:431)
> - waiting to lock <0x00000007359182d0> (a org.jgroups.protocols.pbcast.Merger)
> at org.jgroups.protocols.pbcast.CoordGmsImpl.init(CoordGmsImpl.java:34)
> at org.jgroups.protocols.pbcast.GMS.becomeCoordinator(GMS.java:407)
> at org.jgroups.protocols.pbcast.ParticipantGmsImpl.handleMembershipChange(ParticipantGmsImpl.java:114)
> at org.jgroups.protocols.pbcast.GMS.process(GMS.java:1296)
> at org.jgroups.protocols.pbcast.GMS$$Lambda$95/1582906120.accept(Unknown Source)
> at org.jgroups.protocols.pbcast.ViewHandler.process(ViewHandler.java:173)
> at org.jgroups.protocols.pbcast.ViewHandler.add(ViewHandler.java:111)
> at org.jgroups.protocols.pbcast.GMS.up(GMS.java:841)
> at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:233)
> at org.jgroups.stack.Protocol.up(Protocol.java:302)
> at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:591)
> at org.jgroups.stack.Protocol.up(Protocol.java:302)
> at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:245)
> at org.infinispan.test.hibernate.cache.util.TestDisconnectHandler.lambda$down$0(TestDisconnectHandler.java:63)
> at org.infinispan.test.hibernate.cache.util.TestDisconnectHandler$$Lambda$392/1960261368.run(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> "jgroups-4,EntityCollectionInvalidationTest-NodeF-59512":
> at sun.misc.Unsafe.park(Native Method)
> - parking to wait for <0x0000000735645138> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
> at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
> at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
> at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
> at org.jgroups.protocols.pbcast.ViewHandler.resume(ViewHandler.java:140)
> at org.jgroups.protocols.pbcast.Merger.cancelMerge(Merger.java:435)
> - locked <0x00000007359182d0> (a org.jgroups.protocols.pbcast.Merger)
> at org.jgroups.protocols.pbcast.CoordGmsImpl.init(CoordGmsImpl.java:34)
> at org.jgroups.protocols.pbcast.GMS.becomeCoordinator(GMS.java:407)
> at org.jgroups.protocols.pbcast.GMS.installView(GMS.java:688)
> - locked <0x0000000735918798> (a org.jgroups.Membership)
> - locked <0x0000000735643d68> (a org.jgroups.protocols.pbcast.GMS)
> at org.jgroups.protocols.pbcast.ParticipantGmsImpl.handleViewChange(ParticipantGmsImpl.java:135)
> at org.jgroups.protocols.pbcast.GMS.up(GMS.java:918)
> at org.jgroups.stack.Protocol.up(Protocol.java:336)
> at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:293)
> at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:428)
> at org.jgroups.protocols.pbcast.NAKACK2.deliverBatch(NAKACK2.java:962)
> at org.jgroups.protocols.pbcast.NAKACK2.removeAndDeliver(NAKACK2.java:896)
> at org.jgroups.protocols.pbcast.NAKACK2.handleMessages(NAKACK2.java:870)
> at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:690)
> at org.jgroups.protocols.FD.up(FD.java:280)
> at org.jgroups.stack.Protocol.up(Protocol.java:344)
> at org.jgroups.stack.Protocol.up(Protocol.java:344)
> at org.jgroups.stack.Protocol.up(Protocol.java:344)
> at org.jgroups.protocols.TP.passBatchUp(TP.java:1255)
> at org.jgroups.util.MaxOneThreadPerSender$BatchHandlerLoop.passBatchUp(MaxOneThreadPerSender.java:284)
> at org.jgroups.util.SubmitToThreadPool$BatchHandler.run(SubmitToThreadPool.java:136)
> at org.jgroups.util.MaxOneThreadPerSender$BatchHandlerLoop.run(MaxOneThreadPerSender.java:273)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 6 months