CalvinKirs opened a new pull request, #67520:
URL: https://github.com/apache/doris/pull/67520

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Problem Summary:
   
   After CLIENT_DEPRECATE_EOF support was enabled by #61050 and backported by 
#61062, Connector/J 8.x with useCursorFetch=true can hang when a 
server-prepared statement returns an empty result set.
   
   Connector/J versions before 9.5 consume the first OK packet after column 
definitions while probing whether a requested server cursor was created. Doris 
does not create a server cursor. With CLIENT_DEPRECATE_EOF negotiated, an empty 
result has no metadata terminator, so its only result-set end packet is 
consumed by the cursor probe and the client waits indefinitely for another 
packet.
   
   This also explains the observed version difference: releases that do not 
advertise CLIENT_DEPRECATE_EOF still send the metadata EOF, so the final 
result-set marker remains available.
   
   ### What is changed?
   
   - Parse CURSOR_TYPE_READ_ONLY from COM_STMT_EXECUTE.
   - Preserve the cursor-fetch request when execution is forwarded between FEs.
   - For affected Connector/J versions (8.x and 9.0 through 9.4) that negotiate 
CLIENT_DEPRECATE_EOF, send a compatibility metadata terminator so the real 
final marker is not consumed.
   - Keep Connector/J 9.5+ and other clients on the standard 
CLIENT_DEPRECATE_EOF path.
   - Add unit and regression coverage for empty and non-empty cursor-fetch 
results.
   
   ### Release note
   
   Fix empty prepared-statement results hanging with MySQL Connector/J 8.x when 
cursor fetching is enabled.
   
   ### Check List (For Author)
   
   - Test:
       - Unit Test: 
StmtExecutorTest#testCursorFetchMetadataTerminatorDependsOnConnectorJVersion
       - Regression test: prepared_stmt_p0/test_cursor_fetch_empty_result
       - Manual test: official Connector/J 8.2.0 and 9.5.0 with empty and 
non-empty results, with useCursorFetch enabled and disabled
       - Build: ./build.sh --fe
   - Behavior changed: Yes. A compatibility metadata terminator is sent only 
for affected Connector/J cursor requests when CLIENT_DEPRECATE_EOF is 
negotiated.
   - Does this need documentation: No


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