Apache Ignite。使用CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT初始化缓存。

huangapple go评论70阅读模式
英文:

Apache Ignite. Initialize Cache with CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT

问题

我使用配置创建了一个缓存,其中配置为CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT,并且具有被重写的CacheStore。

org.apache.ignite.cache.store.CacheStoreAdapter#loadCache

当我尝试调用loadCache时,我会收到一个异常:

java.lang.UnsupportedOperationException: 在启用MVCC时,不支持事务缓存上的加载操作。

但我不明白为什么,如果我可以在此缓存上调用putAll(),有什么区别?

据我理解,我应该将初始化逻辑放在其他地方,但这似乎是一个权宜之计。也许这是一种错误的方法,因为这不是徒劳的ignite块的行为?

英文:

I create cache with configuration, which has CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT and CacheStore, that overrided

org.apache.ignite.cache.store.CacheStoreAdapter#loadCache

When I try call loadCache I get an exception:

java.lang.UnsupportedOperationException: Load operations are not supported on transactional caches when MVCC is enabled.

But I don't understand why, if I can call putAll() on this cache, what is the difference?

As I understand I should placed initialize logic in other place, but it's looks like a crutch. And maybe it's a wrong way, because not a vain ignite block that behavior?

答案1

得分: 1

长话短说:不要使用 TRANSACTIONAL_SNAPSHOT。如果你需要事务,请使用 TRANSACTIONAL

目前,MVCC 处于“beta 质量”。

英文:

Long story short: don’t use TRANSACTIONAL_SNAPSHOT. If you need transactions, use TRANSACTIONAL.

Currently, MVCC is “beta quality.”

答案2

得分: 0

loadCache的工作方式有所不同,因为它只会填充所有节点上的本地数据(主节点和备份节点)。putAll只会通过网络发送数据。在操作完成时,loadCache才是一致的,而这与TRANSACTIONAL_SNAPSHOT的工作方式不同。

英文:

loadCache works differently since it will only populate local data (both primary and backup) on all nodes. putAll will only send data over the network. loadCache is only consistent when operation is complete, which is not how TRANSACTIONAL_SNAPSHOT works.

huangapple
  • 本文由 发表于 2020年10月20日 03:58:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/64434352.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定