Skip to content

streamline error handling in BufferReader and LogicalReplicationParser#61

Closed
isdaniel wants to merge 3 commits intomainfrom
chore/streamline-error-handling-hotpath-improvement
Closed

streamline error handling in BufferReader and LogicalReplicationParser#61
isdaniel wants to merge 3 commits intomainfrom
chore/streamline-error-handling-hotpath-improvement

Conversation

@isdaniel
Copy link
Copy Markdown
Owner

as title

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 97.87234% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.74%. Comparing base (c8044ac) to head (3619106).

Files with missing lines Patch % Lines
src/lsn.rs 96.29% 2 Missing ⚠️
src/stream.rs 97.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
+ Coverage   93.68%   93.74%   +0.06%     
==========================================
  Files          10       10              
  Lines       14260    14364     +104     
==========================================
+ Hits        13359    13466     +107     
+ Misses        901      898       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several performance optimizations to the replication stream and LSN tracking logic. Key changes include refactoring error handling into cold functions, inlining critical methods, and reducing vDSO syscall overhead by throttling connection health checks. Additionally, WAL message header parsing was optimized to bypass BufferReader, and atomic LSN updates were adjusted for efficiency. Review feedback suggests using Acquire ordering for initial atomic loads to minimize retries on weak memory models, evaluating the impact of health check throttling on low-throughput connections, and utilizing Buf methods for more readable header parsing.

Comment thread src/lsn.rs Outdated
Comment thread src/stream.rs
Comment thread src/stream.rs Outdated
…arser

Co-authored-by: Copilot <copilot@github.com>
@isdaniel
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several performance optimizations to the replication stream and LSN tracking logic. Key changes include refactoring error paths into #[cold] functions to improve hot-path performance, optimizing atomic operations in SharedLsnFeedback through Relaxed loads and improved CAS loops, and amortizing the cost of health check syscalls. Additionally, WAL message processing was optimized by decoding headers directly from byte slices. Comprehensive tests were added to verify the new CAS retry logic, health check gating, and error message formats. I have no feedback to provide.

@isdaniel
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several performance optimizations and refactorings. It replaces BufferReader usage in WAL message processing with direct slice indexing to reduce overhead, adds a gated health check mechanism to minimize vDSO syscalls on the hot path, and refines LSN tracking logic in SharedLsnFeedback to improve concurrency handling. Additionally, error handling is improved by moving error generation to cold, non-inlined functions, and comprehensive tests are added to verify these changes. I have no feedback to provide.

@isdaniel isdaniel closed this Apr 29, 2026
@isdaniel isdaniel deleted the chore/streamline-error-handling-hotpath-improvement branch April 29, 2026 14:18
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.

1 participant