nnvscholar-collab opened a new pull request, #7721:
URL: https://github.com/apache/kyuubi/pull/7721

   ### Why are the changes needed?
   
   When a queued `InsertMetadata` retry is replayed by the async retry trigger, 
it can hit a duplicate-key error if the original insert actually succeeded but 
its acknowledgement was lost. `insertMetadata` intentionally fails fast on 
duplicate-key errors, and since the retry loop only caught exceptions around 
the whole `while` block, this exception escaped before the request could be 
removed from the queue — leaving it stuck at the head and blocking all later 
requests for that session indefinitely. This is the same amplification pattern 
reported in #7708 for updates, but for inserts (raised by @pan3793 during 
review of #7709).
   
   This patch verifies the postcondition inside the retry loop specifically: if 
a duplicate-key error occurs while retrying an insert, and a row matching the 
identifier, session type, and create time already exists, it's treated as an 
idempotent success and removed from the queue. The fail-fast behavior of 
`insertMetadata()` itself is unchanged for direct/foreground calls.
   
   Closes #7720.
   
   ### How was this patch tested?
   
   Added a regression test verifying that a queued insert retry which hits a 
duplicate-key error is removed from the queue instead of blocking subsequent 
requests for the same session.
   
   Ran:
   build/mvn test -pl kyuubi-server -am 
-Pspark-provided,flink-provided,hive-provided -Dtest=none 
-DwildcardSuites=org.apache.kyuubi.server.metadata.MetadataManagerSuite
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: Claude


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to