You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "gitHubYi (via GitHub)" <gi...@apache.org> on 2024/11/04 03:07:06 UTC

[I] update没有更新任何数据,prepareUndoLog时报错”images can not be null“ [incubator-seata]

gitHubYi opened a new issue, #6976:
URL: https://github.com/apache/incubator-seata/issues/6976

   请问如果我去掉这个校验是否会有其他影响?我现在使用的是1.8版本,项目上线,改下sql来不及了
   ![image](https://github.com/user-attachments/assets/12c25ffa-e69c-4e21-9486-64b9f62f54f2)
   
   
   - JDK version(e.g. `java -version`):1.8
   - Seata client/server version:  1.8/1.8
   - Database version: mysql5.7


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] update没有更新任何数据,prepareUndoLog时报错”images can not be null“ [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6976:
URL: https://github.com/apache/incubator-seata/issues/6976#issuecomment-2453859682

   一样的,可以改为如果都为空就return


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] update没有更新任何数据,prepareUndoLog时报错”images can not be null“ [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6976:
URL: https://github.com/apache/incubator-seata/issues/6976#issuecomment-2453756915

   理论上直接return,保持跟BaseTransactionalExecutor#prepareUndoLog相同逻辑没什么问题
   In theory, return directly, keep the same logic as BaseTransactionalExecutor #prepareUndoLog, no problem


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] update没有更新任何数据,prepareUndoLog时报错”images can not be null“ [incubator-seata]

Posted by "gitHubYi (via GitHub)" <gi...@apache.org>.
gitHubYi commented on issue #6976:
URL: https://github.com/apache/incubator-seata/issues/6976#issuecomment-2453774107

   > 你这个是多语句更新?比如update....;update....;delete.... https://github.com/apache/incubator-seata/blob/v1.8.0/rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
   > 
   > ```
   >     protected void prepareUndoLog(TableRecords beforeImage, TableRecords afterImage) throws SQLException {
   >         if (beforeImage.getRows().isEmpty() && afterImage.getRows().isEmpty()) {
   >             return;
   >         }
   >         if (SQLType.UPDATE == sqlRecognizer.getSQLType()) {
   >             if (beforeImage.getRows().size() != afterImage.getRows().size()) {
   >                 throw new ShouldNeverHappenException("Before image size is not equaled to after image size, probably because you updated the primary keys.");
   >             }
   >         }
   >         ConnectionProxy connectionProxy = statementProxy.getConnectionProxy();
   > 
   >         TableRecords lockKeyRecords = sqlRecognizer.getSQLType() == SQLType.DELETE ? beforeImage : afterImage;
   >         String lockKeys = buildLockKey(lockKeyRecords);
   >         if (null != lockKeys) {
   >             connectionProxy.appendLockKey(lockKeys);
   > 
   >             SQLUndoLog sqlUndoLog = buildUndoItem(beforeImage, afterImage);
   >             connectionProxy.appendUndoLog(sqlUndoLog);
   >         }
   >     }
   > ```
   
   是update join语句
   ![image](https://github.com/user-attachments/assets/eeddb2d6-2dd1-45b3-9a3c-06c53ddde495)
   ![image](https://github.com/user-attachments/assets/dfde9b47-5c93-4a35-9933-ce2d62e2981a)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] update没有更新任何数据,prepareUndoLog时报错”images can not be null“ [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on issue #6976:
URL: https://github.com/apache/incubator-seata/issues/6976#issuecomment-2453753569

   你这个是多语句更新?比如update....;update....;delete....
   https://github.com/apache/incubator-seata/blob/v1.8.0/rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
   ```
       protected void prepareUndoLog(TableRecords beforeImage, TableRecords afterImage) throws SQLException {
           if (beforeImage.getRows().isEmpty() && afterImage.getRows().isEmpty()) {
               return;
           }
           if (SQLType.UPDATE == sqlRecognizer.getSQLType()) {
               if (beforeImage.getRows().size() != afterImage.getRows().size()) {
                   throw new ShouldNeverHappenException("Before image size is not equaled to after image size, probably because you updated the primary keys.");
               }
           }
           ConnectionProxy connectionProxy = statementProxy.getConnectionProxy();
   
           TableRecords lockKeyRecords = sqlRecognizer.getSQLType() == SQLType.DELETE ? beforeImage : afterImage;
           String lockKeys = buildLockKey(lockKeyRecords);
           if (null != lockKeys) {
               connectionProxy.appendLockKey(lockKeys);
   
               SQLUndoLog sqlUndoLog = buildUndoItem(beforeImage, afterImage);
               connectionProxy.appendUndoLog(sqlUndoLog);
           }
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] update没有更新任何数据,prepareUndoLog时报错”images can not be null“ [incubator-seata]

Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes closed issue #6976: update没有更新任何数据,prepareUndoLog时报错”images can not be null“
URL: https://github.com/apache/incubator-seata/issues/6976


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org