Skip to content
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

[READY FOR REVIEW] [DO NOT MERGE] fix prepared statement cache invalidation #860

Conversation

ethanpailes
Copy link
Contributor

This patch fixes #841. To fix it we notice
when a statement failed because its cached plan is now
invalid and flush it from our cache. We don't try to get
fancy with retries or anything like that, just return the
error and allow the application to handle it.

The flushing of statements is deferred to the end of transactions
because all statements executed after an error in a transaction
will just result in errors. If we are not in a transaction, we
flush eagerly.

I had to make some changes to to the jackc/pgconn package as well
as this package, so I've retargeted this this repo on
ethanpailes/pgconn for the time being. This PR is not really in a
mergable state until those PRs merge and I rip out 2f31e98, but I
would say it is ready for review (just review the most recent commit).

One question I have is whether anything else needs to be done around
batch SQL, so guidance there would be appreciated.

Fixes #841

The fix I'm working on for jackc#841 requires changes
to pgconn as well, so I'm regargeting on my own fork to unblock
myself. I'll rip out this patch before it gets merged upstream.
This patch can also be ripped out if jackc/pgconn#54
gets merged.
This patch fixes jackc#841. To fix it we notice
when a statement failed because its cached plan is now
invalid and flush it from our cache. We don't try to get
fancy with retries or anything like that, just return the
error and allow the application to handle it.

The flushing of statements is deferred to the end of transactions
because all statements executed after an error in a transaction
will just result in errors. If we are not in a transaction, we
flush eagerly.

I had to make [some][1] [changes][2] to to the jackc/pgconn package as well
as this package, so I've retargeted this this repo on
ethanpailes/pgconn for the time being. This PR is not really in a
mergable state until those PRs merge and I rip out 2f31e98, but I
would say it is ready for review (just review the most recent commit).

One question I have is whether anything else needs to be done around
batch SQL, so guidance there would be appreciated.

Fixes jackc#841

[1]: jackc/pgconn#54
[2]: jackc/pgconn#55
@ethanpailes
Copy link
Contributor Author

Closing in favor of #865

@ethanpailes ethanpailes closed this Nov 9, 2020
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.

connection local statement cache does not correctly invalidate
1 participant