Skip to content

MDEV-22992 Refactor VIO into layered transports and filters - #5584

Open
vaintroub wants to merge 1 commit into
mainfrom
main-MDEV-22992
Open

MDEV-22992 Refactor VIO into layered transports and filters#5584
vaintroub wants to merge 1 commit into
mainfrom
main-MDEV-22992

Conversation

@vaintroub

Copy link
Copy Markdown
Member

Replace the function-pointer VIO implementation with an abstract C++ interface while retaining the procedural C entry points.

Implement socket and named-pipe transports and composable filters for client read-ahead, Windows thread-pool prefetch, and TLS. OpenSSL uses a custom BIO, while wolfSSL uses callbacks that perform I/O through the VIO below the TLS filter. This keeps waits and timeouts in the transport layer.

Keep sockets nonblocking and implement timed I/O with transport waits. Named pipes use overlapped I/O for timeout-aware waits and report blocking waits through the same scheduler callbacks as sockets. Semi-sync temporarily changes the real VIO read timeout instead of copying VIO state.

Hide transport and TLS implementation state behind accessors. Expose the TLS handle opaquely and update callers that previously accessed VIO fields directly. Compile the VIO implementations as C++ and retain PSI memory accounting for VIO allocations.

Adapt Windows thread-pool pre-read to a Prefetched_vio filter inserted above the transport so both plain and TLS connections consume prefetched bytes through the same layered VIO path.

@vaintroub
vaintroub requested review from vuvova and a lite review from Copilot August 21, 2026 15:01
Copilot stopped reviewing on behalf of vaintroub due to an error August 21, 2026 15:22
@vaintroub
vaintroub requested a lite review from Copilot and removed request for Copilot August 24, 2026 18:42
Copilot stopped reviewing on behalf of vaintroub due to an error August 24, 2026 19:03
@vaintroub
vaintroub force-pushed the main-MDEV-22992 branch 3 times, most recently from 626d759 to 6912e7f Compare August 24, 2026 21:40
Replace the function-pointer VIO implementation with an abstract C++
interface while retaining the procedural C entry points.

Implement socket and named-pipe transports and composable filters for
client read-ahead, Windows thread-pool prefetch, and TLS. OpenSSL uses a
custom BIO, while wolfSSL uses callbacks that perform I/O through the VIO
below the TLS filter. This keeps waits and timeouts in the transport layer.

Keep sockets nonblocking and implement timed I/O with transport waits.
Named pipes use overlapped I/O for timeout-aware waits and report blocking
waits through the same scheduler callbacks as sockets. Semi-sync
temporarily changes the real VIO read timeout instead of copying VIO state.

Hide transport and TLS implementation state behind accessors. Expose the
TLS handle opaquely and update callers that previously accessed VIO fields
directly. Compile the VIO implementations as C++ and retain PSI memory
accounting for VIO allocations.

Adapt Windows thread-pool pre-read to a Prefetched_vio filter inserted
above the transport so both plain and TLS connections consume prefetched
bytes through the same layered VIO path.

Cleaned header files so that vio header no longer include OpenSSL or
WolfSSL headers.

Removed some legacy functionality

- vio_close() with its double-close guards appeared hard to maintain in
class hierarchy, and had been unnecessary for the last 15 years.
Associated things that are also gone :  preprocessor definition
SIGNAL_WITH_VIO_CLOSE (always defined), VIO_STATE_CLOSED.
VIO_CLOSED type, which was used as sentinel, renamed to VIO_TYPE_INVALID.
- vio_io_wait() used in a single place, replaces by read with timeout.
- vio_reset() to create SSL, replaced by vio_wrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants