You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6fafa31
Browse filesBrowse the repository at this point in the historyBrowse files
[fix](fe) Fix prepared statement streaming, forwarding and cursor framing (apache#69314)
### What problem does this PR solve?
Problem Summary:
- `COM_STMT_SEND_LONG_DATA` incorrectly returns an error packet, leaving
streaming clients out of sync. Accept parameter chunks without replying,
defer upload errors until EXECUTE, preserve binary bytes, and clear
upload state on EXECUTE/RESET/CLOSE.
- Reusing server-side prepared statements through a non-master FE can
fail with `NoSuchElementException: No value present`: the driver omits
unchanged parameter types, while the master prepares each forwarded
execution independently. Include cached types, the NULL bitmap and
complete values in forwarded EXECUTE payloads.
- Forwarded PREPARE can use a stale statement context when planning
placeholders. Use the parser's current prepare-stage context.
- Empty results with `useCursorFetch=true` can hang or leave unread
packets when client connection attributes are disabled or rewritten.
Return a valid empty cursor, complete FETCH with `LAST_ROW_SENT`, retain
cursor state on the client-facing FE, and preserve existing framing for
older FEs. Nonempty results continue to use buffered delivery; nonempty
cursor pagination is not added.
- Normalized streamed values can remain attached to idle pooled
connections after statement close/reset. Release the command-only
execution buffer after response finalization and forwarding complete.
### Release note
- Fix streamed parameters, repeated prepared-statement forwarding and
empty cursor results in the MySQL protocol, and reduce retained
parameter-buffer memory on idle connections.
### Check List (For Author)
- Test:
- [x] Unit Test: 32 focused long-data, protocol adapter and forwarding
tests passed on the final source, including the new buffer-lifecycle
test.
- [x] Regression test: `prepared_stmt_p0/send_long_data` and
`prepared_stmt_p0/cursor_fetch_empty_result` passed during
implementation.
- [x] Manual test: raw-protocol upload/cursor lifecycle and connection
reuse; rewritten client-attribute proxy reproduction passed after the
fix.
- [x] Checkstyle: zero violations in the latest modified Java files.
- Behavior changed:
- [x] Yes. Long-data uploads no longer produce responses; forwarded
parameters are self-contained; empty cursors finish through FETCH;
completed commands release execution buffers.
- Does this need documentation?
- [x] No.
0 commit comments