英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论