gpt4 book ai didi

java - Ignite 和 MySQL - 更新条目数量意外

转载 作者:行者123 更新时间:2023-11-29 10:13:49 25 4
gpt4 key购买 nike

我有缓存

@Bean
CacheConfiguration persistenceCacheConfiguration(
CacheJdbcPojoStoreFactory<Long, SequencesEntity> storeFactory) {
CacheConfiguration<Long, SequencesEntity> configuration = new CacheConfiguration<>(
PERSISTENCE_CACHE_NAME);
configuration.setIndexedTypes(Long.class, SequencesEntity.class);
configuration.setReadThrough(true);
configuration.setWriteThrough(true);
configuration.setCacheStoreFactory(storeFactory);
configuration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
return configuration;
}

我使用 MySQL 数据库。

当我更新缓存中的数据时,Ignite 会执行以下方法和查询:

CacheAbstractJdbcStore.write

查询:

INSERT INTO table (id, stream_name, value) VALUES (1,'my',100000000001) ON DUPLICATE KEY UPDATE stream_name = VALUES(stream_name), value = VALUES(value)    

它返回受影响的 2 行。它是正确的 - https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html

With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if the row is inserted as a new row and 2 if an existing row is updated.

并且 ignite 写入日志 WARN(它是 ignite 源代码):

if (updCnt != 1)
U.warn(log, "Unexpected number of updated entries [table=" + em.fullTableName() +
", entry=" + entry + "expected=1, actual=" + updCnt + "]");

我相信更新记录是正确的行为,并且我不希望在日志中看到警告。我怎样才能避免这种情况?

最佳答案

这看起来像是一个错误。已提交 https://issues.apache.org/jira/browse/IGNITE-8550为了那个原因。除此之外,我只能建议你忽略这个警告。

关于java - Ignite 和 MySQL - 更新条目数量意外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50453761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com