fix: mirror prepared statement mode in session pooling#827
fix: mirror prepared statement mode in session pooling#827levkk merged 4 commits intopgdogdev:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Nice find. I knew we should of added php tests :) It's even in the repo, just not running in CI. Could you just run |
|
Removed the Dockerfile changes. Fixed the fmt. |
That would be amazing, if you have a moment. We have php somewhere in the repo already (I think Laravel), feel free to delete that, it's not used. |
|
Added a php mirror test and fixed and enabled the ruby mirror test which was not enabled in CI. |
|
Very cool. Thank you! |
This might be a two bug layer. First, it's might be an issue with DEALLOCATE sent as a simple query that doesn't get rewritten, which causes a transaction failure and messes up the whole mirroring.
But I'm using pgdog in session mode with mirroring to test performance to see if I can switch the database to a cheaper one so I'm not affected by the DEALLOCATE bug on the source. What I noticed is that the mirror traffic gets this error:
I also included a fix to speed up the dockerfile build with caches since I iterated on the dockerfile with the fix.
I also have a repro with a docker-compose and a simple php app here: https://github.com/costi/pgdog-pdo-repro
The flow is like this:
ConfigAndUsers::prepared_statements()disables prepared statements in session mode:The mirror path was not using that effective value. It constructed its prepared-statement state with the raw default/configured level instead.
So with:
the source/client path effectively ran with
Disabled, while the mirror path still ran withExtended.That caused the mirror path to rewrite extended-protocol prepared statement names to
__pgdog_*, while the source path kept the original PDO names likepdo_stmt_00000001.Later, PDO sent simple SQL cleanup:
__pgdog_*name, so PostgreSQL correctly errored: