ym0506 commented on issue #38717:
URL: 
https://github.com/apache/shardingsphere/issues/38717#issuecomment-4558615542

   Hi, I took a look at the current code path. My hypothesis is that the 
failure happens because Proxy requests generated keys from the backend for 
MySQL INSERT statements even when the auto-increment column value was 
explicitly supplied by the client. For this case, the backend MySQL driver may 
expose -3 as the unsigned 64-bit value 18446744073709551613, and Proxy then 
tries to read it as a Java long after the row has already been committed.
   
   The fix I want to try is to gate RETURN_GENERATED_KEYS / getGeneratedKeys() 
for InsertStatementContext: if GeneratedKeyContext is present but isGenerated() 
is false, the generated-key column was explicitly supplied, so Proxy should not 
request/read backend generated keys for that insert. I’ll also add regression 
coverage for an explicit negative value in a signed AUTO_INCREMENT column under 
a rule-managed table.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to