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

testRoleRenamingMidSession fails while using Connection Manager #21505

Closed
yugabyte-ci opened this issue Mar 15, 2024 · 0 comments
Closed

testRoleRenamingMidSession fails while using Connection Manager #21505

yugabyte-ci opened this issue Mar 15, 2024 · 0 comments
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/high High Priority

Comments

@yugabyte-ci
Copy link
Contributor

yugabyte-ci commented Mar 15, 2024

Jira Link: DB-10389

@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/high High Priority labels Mar 15, 2024
rahulb-yb added a commit that referenced this issue May 6, 2024
…ection Manager

Summary:
YSQL Connection Manager tracks GUC variables that were modified on a logical connection by maintaining a list of modified variables (as per ParameterStatus packets received). The `role` GUC variable can be modified through SET/RESET statements, but roles can also be renamed as such: `ALTER ROLE role_1 RENAME TO role_2`. Since Connection Manager would have `role_1` being stored as the role name, this leads to incorrect behaviour while roles are renamed mid-session.

To resolve this issue, we can track the role GUC variable using its OID instead. List of changes made to facilitate this provision:
- Whenever `role` ParameterStatus is being sent by the backend, additionally send a `role_oid` ParameterStatus packet (sent via custom RoleOidParameterStatus packet)
- Whenever the backend process receives a query like: `SET role_oid = 12345`, map the OID received to its role name (if valid, else throw invalid OID error) and accordingly set the `role` GUC variable
- Ignore tracking of `role` ParameterStatus packets on Connection Manager, simply forward them to client
- Whenever ConnectionManager receives a RoleOidParameterStatus packet, process it to store relevant details and deliberately skip relaying of the packet to client

Jira: DB-10389

Test Plan: ./yb_build.sh --enable-ysql-conn-mgr-test --java-test org.yb.pgsql.TestPgAuthorization#testRoleRenamingMidSession

Reviewers: mkumar, nkumar, jason

Reviewed By: nkumar

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D34316
svarnau pushed a commit that referenced this issue May 25, 2024
…ection Manager

Summary:
YSQL Connection Manager tracks GUC variables that were modified on a logical connection by maintaining a list of modified variables (as per ParameterStatus packets received). The `role` GUC variable can be modified through SET/RESET statements, but roles can also be renamed as such: `ALTER ROLE role_1 RENAME TO role_2`. Since Connection Manager would have `role_1` being stored as the role name, this leads to incorrect behaviour while roles are renamed mid-session.

To resolve this issue, we can track the role GUC variable using its OID instead. List of changes made to facilitate this provision:
- Whenever `role` ParameterStatus is being sent by the backend, additionally send a `role_oid` ParameterStatus packet (sent via custom RoleOidParameterStatus packet)
- Whenever the backend process receives a query like: `SET role_oid = 12345`, map the OID received to its role name (if valid, else throw invalid OID error) and accordingly set the `role` GUC variable
- Ignore tracking of `role` ParameterStatus packets on Connection Manager, simply forward them to client
- Whenever ConnectionManager receives a RoleOidParameterStatus packet, process it to store relevant details and deliberately skip relaying of the packet to client

Jira: DB-10389

Test Plan: ./yb_build.sh --enable-ysql-conn-mgr-test --java-test org.yb.pgsql.TestPgAuthorization#testRoleRenamingMidSession

Reviewers: mkumar, nkumar, jason

Reviewed By: nkumar

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D34316
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/high High Priority
Projects
None yet
Development

No branches or pull requests

2 participants