Skip to content

buffered WAL reads + structured I/O errors#4

Merged
vnvo merged 6 commits intomainfrom
buff-read
Mar 27, 2026
Merged

buffered WAL reads + structured I/O errors#4
vnvo merged 6 commits intomainfrom
buff-read

Conversation

@vnvo
Copy link
Copy Markdown
Owner

@vnvo vnvo commented Mar 27, 2026

Summary

  • Buffered WAL reads: Wrap the replication stream in a 128KB BufReader inside run_on_stream, batching multiple WAL messages into fewer recv() syscalls. Reduces syscall overhead significantly during backlog drain scenarios.
  • Structured I/O errors (breaking): PgWireError::Io now wraps Arc<std::io::Error> instead of String, preserving ErrorKind so consumers can match on .kind() (e.g. UnexpectedEof, ConnectionReset) instead of brittle substring matching. Clone is retained via Arc.

Closes #3 and #2 .

Breaking changes

  • PgWireError::Io(String) -> PgWireError::Io(Arc<std::io::Error>) - pattern matches and manual construction sites need updating.

Test plan

  • 81 unit tests pass
  • 9 integration tests pass
  • 16 doc-tests pass

vnvo added 6 commits March 27, 2026 03:31
Batch multiple WAL messages into fewer recv() syscalls by wrapping
the stream in a tokio::io::BufReader inside run_on_stream.
Change PgWireError::Io from String to Arc<std::io::Error> so consumers
can match on ErrorKind instead of brittle substring matching.
Resolves RUSTSEC-2025-0134 (unmaintained crate). The PemObject trait
from rustls-pki-types replaces all rustls-pemfile usage and removes
~70 lines of boilerplate key loading code.
Resolves RUSTSEC-2026-0066 (astral-tokio-tar) and RUSTSEC-2025-0134
(rustls-pemfile via bollard) from transitive dev-dependencies.
@vnvo vnvo merged commit a5f3817 into main Mar 27, 2026
4 checks passed
@vnvo vnvo deleted the buff-read branch March 27, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buffered WAL read optimization

1 participant