Skip to content

Reimplement prepared statements with LRU cache and statement deduplication #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
06f7ea5
Initial commit
zainkabani Oct 13, 2023
1cd957e
Cleanup and add stats
zainkabani Oct 13, 2023
af6c2ea
Use an arc instead of full clones to store the parse packets
zainkabani Oct 13, 2023
2247f86
Use mutex instead
zainkabani Oct 13, 2023
d4d88c4
Merge branch 'main' into zain/reimplment-prepared-statements-with-glo…
zainkabani Oct 13, 2023
d2927d0
fmt
zainkabani Oct 13, 2023
fb23e33
clippy
zainkabani Oct 13, 2023
2fb3d4a
fmt
zainkabani Oct 13, 2023
a59aa63
fix?
zainkabani Oct 13, 2023
e2963e9
fix?
zainkabani Oct 13, 2023
8111582
fmt
zainkabani Oct 13, 2023
6e85fb2
typo
zainkabani Oct 13, 2023
46c8f9e
Update docs
zainkabani Oct 14, 2023
9a80b47
Refactor custom protocol
zainkabani Oct 14, 2023
19d8478
fmt
zainkabani Oct 14, 2023
a07874a
move custom protocol handling to before parsing
zainkabani Oct 14, 2023
bf5a39c
Support describe
zainkabani Oct 14, 2023
6a87a68
Add LRU for server side statement cache
zainkabani Oct 14, 2023
b528b95
rename variable
zainkabani Oct 15, 2023
0177af8
Refactoring
zainkabani Oct 15, 2023
cd7942b
Move docs
zainkabani Oct 15, 2023
6205548
Fix test
zainkabani Oct 15, 2023
9cd675e
fix
zainkabani Oct 15, 2023
89e2651
Update tests
zainkabani Oct 16, 2023
d37514f
trigger build
zainkabani Oct 16, 2023
bcce2d5
Add more tests
zainkabani Oct 16, 2023
63aa0c7
Reorder handling sync
zainkabani Oct 17, 2023
e392607
Support when a named describe is sent along with Parse (go pgx) and e…
zainkabani Oct 17, 2023
53880f2
don't talk to client if not needed when client sends Parse
zainkabani Oct 17, 2023
2842c85
fmt :(
zainkabani Oct 17, 2023
5604546
refactor tests
zainkabani Oct 17, 2023
6a1d7f6
nit
zainkabani Oct 17, 2023
a5d4bcf
Reduce hashing
zainkabani Oct 19, 2023
dd021c2
Reducing work done to decode describe and parse messages
zainkabani Oct 19, 2023
116a681
minor refactor
zainkabani Oct 19, 2023
72826e6
Merge branch 'main' into zain/reimplment-prepared-statements-with-glo…
zainkabani Oct 20, 2023
cfe8e9f
Merge branch 'main' into zain/reimplment-prepared-statements-with-glo…
zainkabani Oct 20, 2023
b27c918
Rewrite extended and prepared protocol message handling to better sup…
zainkabani Oct 21, 2023
d107bbe
An attempt to better handle if there are DDL changes that might break…
zainkabani Oct 21, 2023
21b9cde
fix
zainkabani Oct 21, 2023
d791f06
Minor stats fixed and cleanup
zainkabani Oct 21, 2023
a57550d
Cosmetic fixes (#64)
levkk Oct 23, 2023
db70499
Change server drop for statement cache error to a `deallocate all`
zainkabani Oct 23, 2023
7fa1147
Updated comments and added new idea for handling DDL changes impactin…
zainkabani Oct 23, 2023
005029d
fix test?
zainkabani Oct 23, 2023
6928d31
Revert test change
zainkabani Oct 23, 2023
b889b4b
trigger build, flakey test
zainkabani Oct 23, 2023
0dd5e88
Avoid potential race conditions by changing get_or_insert to promote …
zainkabani Oct 24, 2023
962090a
remove ps enabled variable on the server in favor of using an option
zainkabani Oct 24, 2023
80aa607
Add close to the Extended Protocol buffer
zainkabani Oct 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
zainkabani committed Oct 13, 2023
commit 2fb3d4af23b267bacb0344b9ff9c5c16803303ef
4 changes: 1 addition & 3 deletions src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ impl PreparedStatementCache {
/// Pass the hash to this so that we can do the compute before acquiring the lock
pub fn get_or_insert(&mut self, parse: Parse, hash: u64) -> Arc<Parse> {
match self.cache.get(&hash) {
Some(rewritten_parse) => {
rewritten_parse.clone()
}
Some(rewritten_parse) => rewritten_parse.clone(),
None => {
let new_parse = Arc::new(parse.rewrite());
let evicted = self.cache.push(hash, new_parse.clone());
Expand Down