[ https://issues.apache.org/jira/browse/IGNITE-8550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16764141#comment-16764141 ]
Stanislav Lukyanov commented on IGNITE-8550: -------------------------------------------- [~smoldachev] I'm OK with this style of the change, but we need to allow 0, 1 and 2, and not allow other values, so the check would be {code} if (updCnt < 0 || updCnt > 2) U.warn(log, "Unexpected return value for update opetation [table=" + em.fullTableName() + ", entry=" + entry + ", updCnt=" + updCnt + "]"); {code} And I would even like a little hack with checking the dialect here. It's smelly but it's simple. {code} if (dialect instanceof MySQLDialect) { if (updCnt < 0 || updCnt > 2) U.warn(log, "Unexpected return value for update opetation [table=" + em.fullTableName() + ", entry=" + entry + ", updCnt=" + updCnt + "]"); } else { if (updCnt != 1) U.warn(log, "Unexpected return value for update opetation [table=" + em.fullTableName() + ", entry=" + entry + ", updCnt=" + updCnt + "]"); } {code} Also we need a proper comment with a link to this issue that explains why the code is like his. > CacheAbstractJdbcStore expects merge to always return 1 but MySQL may also > return 2 or 0 > ---------------------------------------------------------------------------------------- > > Key: IGNITE-8550 > URL: https://issues.apache.org/jira/browse/IGNITE-8550 > Project: Ignite > Issue Type: Bug > Components: cache > Reporter: Stanislav Lukyanov > Assignee: Moldachev Sergey > Priority: Minor > Labels: newbie > Fix For: 2.8 > > Time Spent: 10m > Remaining Estimate: 0h > > CacheAbstractJdbcStore.write attempts to execute a merge update if it is > available, and expects the merge to always return 1 (as the number of updated > entries is always 1). > However, MySQL's `INSERT ... ON DUPLICATE KEY UPDATE` > (https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) may return > 0 or 2, depending on what was updated: > {quote}With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if > the row is inserted as a new row, 2 if an existing row is updated, and 0 if > an existing row is set to its current values.{quote} > Because of that, CacheAbstractJdbcStore may report a false warning. > Need to consider either removing the warning or special-case the MySQL > dialect to allow to return values other than 1. -- This message was sent by Atlassian JIRA (v7.6.3#76005)