尊敬的 Infinispan 社区
我在 EAP 和 Spring 部署中运行应用程序。将依赖项从 EAP 7.1 迁移到 EAP 7.2 后,我在 spring 模式下收到警告:HHH025030: Transactional caches are not supported. The configuration option will be ignored; please unset
when using transaction tag in infinispan.xml - 同样适用于 local-cache-configuration 或 invalidation-cache-configuration
<local-cache-configuration name="my-region">
<transaction mode="NON_DURABLE_XA" transaction-manager-lookup="org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup"/>
<expiration ... />
<memory>
<object size="..." strategy="LRU" />
</memory>
</local-cache-configuration>
<!-- OR -->
<invalidation-cache-configuration name="my-region">
<locking concurrency-level="32" acquire-timeout="15000"/>
<transaction mode="NON_DURABLE_XA" transaction-manager-lookup="org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup"/>
<expiration ... />
<memory>
<object size="..." strategy="LRU" />
</memory>
</invalidation-cache-configuration>
我发现 ticket 说 EAP 应该删除交易标签,但没有解释原因。
我找到的最接近的解释是在 pull request infinispan!5900 的评论中,它说 v53 drops support for transactional caches completely.
但 Hibernate 5.3.20.Final 或 5.4.28.Final 的文档没有提到任何相关的东西,仍然列出了事务并发策略。
Infinispan 配置不支持事务标签对 hibernate 2LC 有什么影响?
我的用例关心实体的 2LC 缓存是否在 行被提交到数据库后失效(表现得像 SQL 查询,事务级读提交)。如果事务 T1 将版本 V1 中的实体更新为 V2,则事务 T2 应继续使用实体 V1,直到事务 T1 在 DB 中提交。如果事务 T1 回滚,那么触发缓存失效对我来说仍然没问题,因为我不使用复制缓存,而是使用 invalidation-cache。
我使用带有注释 org.hibernate.annotations.Cache(region = "my-region", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
的实体。
在这种情况下我应该使用哪种并发策略以及如何配置 Infinispan 缓存?
CacheConcurrencyStrategy.TRANSACTIONAL 策略是否使用 XA 资源在行提交到数据库后清理缓存。
是否有文档或测试 Infinispan 在使用 hibernate 2LC 的这种极端情况下的行为?
版本:EAP 7.2 / Spring 5.x - hibernate-core:5.3.15.Final-redhat-00001、infinispan-hibernate-cache-v53:9.3.8.Final-redhat-00001
答案 0 :(得分:1)
我不熟悉 Hibernate 2LC 集成。 Infinispan documentation 说(您在链接中有完整的上下文):
Infinispan provides the same consistency guarantees for both transactional and read-write strategies, use of transactions is considered an implementation detail.
对你有帮助吗?