refactor: use BackendPid instead of BackendKeyData where secret is not required#1025
Draft
meskill wants to merge 3 commits into
Draft
refactor: use BackendPid instead of BackendKeyData where secret is not required#1025meskill wants to merge 3 commits into
meskill wants to merge 3 commits into
Conversation
a12f655 to
6e8a433
Compare
levkk
reviewed
May 29, 2026
| copy_out: usize, | ||
| copy_data: usize, | ||
| first_backend_data: Option<BackendKeyData>, | ||
| first_backend_data: Option<BackendPid>, |
Collaborator
There was a problem hiding this comment.
This is extremely unlikely, but the backend PIDs could collide (same PID, different servers). The secret kinda makes sure that cannot practically happen.
6e8a433 to
c7711f7
Compare
Contributor
|
Found 1 test failure on Blacksmith runners: Failure
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the codebase by using BackendKeyData (contains a connection secret) only where the secret is required, while all other places will use BackendPid (wrapper around u32) to refer the connection or store it. The BackendKeyData becomes complex type without copy and hash and it should be cloned where needed instead and it makes visible the non-free operation of 256 bytes array copying.
The performance benefits are not huge and I had to tweak the pgbench configuration with options
-t 10000 -c 100to see the difference around the commit #2f70a7a70cc8eceefe577f994e89b5e943e0724d that added the support for the extended secret.Benchmark comparisions
The performance difference is there. Integration test for cancellation has been added and some around refactoring have done.