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

Using prepared statements with C# app makes Connection Manager fail #22407

Open
yugabyte-ci opened this issue May 15, 2024 · 0 comments
Open
Assignees
Labels
area/ecosystem Label for all ecosystem related projects jira-originated kind/new-feature This is a request for a completely new feature priority/highest Highest priority issue

Comments

@yugabyte-ci
Copy link
Contributor

yugabyte-ci commented May 15, 2024

When an app written in C# uses unnamed prepared statements to execute basic DDL and DML queries via Connection Manager, a wire protocol related error shows up:

exception : YBNpgsql.NpgsqlException (0x80004005): Received backend message ReadyForQuery while expecting ParseCompleteMessage. Please file a bug.

This seems to be a regression introduced by the commit that helps better support unnamed prepared statements in Connection Manager

Simple workarounds include:

  • Using named prepared statements
  • Using the simple query protocol

Jira Link: DB-11310

@yugabyte-ci yugabyte-ci added area/ecosystem Label for all ecosystem related projects jira-originated kind/new-feature This is a request for a completely new feature priority/highest Highest priority issue labels May 15, 2024
rahulb-yb pushed a commit that referenced this issue May 29, 2024
… Connection Manager is enabled

Summary:
In D32989, the functionality was added to avoid "naming" unnamed prepared statements to avoid potential cached plan mismatch related errors. Odyssey used to generate its own ParseComplete packet and forward it to the client while actually ignoring the server-sent ParseComplete packet. Following the change mentioned, due to a change in workflow, when dealing with unnamed prepared statements, we not only ignore the server-sent ParseComplete packet, but also do not generate a ParseCompete packet to send back to the client. This causes some issues in drivers (such as the C# npgsql driver) that depend upon the exact order of packets that arrive to function correctly.

This patch fixes the described issue by checking if we dealt with an unnamed prepared statement previously, before choosing to ignore relaying of the server-sent ParseComplete packet.
- If an unnamed prepared statement was previously parsed, we construct and send back a ParseComplete packet (change introduced by this diff)
- If a named prepared statement was previously parsed, Odyssey's internal mechanism generates a ParseComplete packet to send back to the client while ignoring the server-sent ParseComplete packet

Jira: DB-11310

Test Plan:
Jenkins: all tests

Manually verify using a simple C# app that issues DDL and DML queries (CREATE TABLE, INSERT, SELECT), using prepared statements.
Also ensure that all YSQL Connection Manager tests are passing on detective.

Reviewers: mkumar, nkumar

Reviewed By: nkumar

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D35099
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ecosystem Label for all ecosystem related projects jira-originated kind/new-feature This is a request for a completely new feature priority/highest Highest priority issue
Projects
None yet
Development

No branches or pull requests

2 participants