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

Reset db context at the time TDS resets the connection #2979

Merged

Conversation

KushaalShroff
Copy link
Contributor

@KushaalShroff KushaalShroff commented Sep 26, 2024

T-SQL Behaviour suggests that if we connect to database db1 and if during the session we have changed the database context to db2 then at the time of reset connection, the server must reset the connection to db1. Earlier we were not resetting the database context to that of the database used to login, in the above example db1, this lead to clients being handed a stale connection.
To Fix this we reset the database context to that from the loginInfo which was maintained at time of login. Changes were also made to avoid sending the environment change token for the implicit "USE DB" being run at time of reset.

Issues Resolved
BABEL-5256

Signed off by: Kushaal Shroff [email protected]

KushaalShroff and others added 3 commits September 26, 2024 12:29
…-postgresql#2971)

T-SQL Behaviour suggests that if we connect to database db1 and if during the session we have changed the database context to db2 then at the time of reset connection, the server must reset the connection to db1. Earlier we were not resetting the database context to that of the database used to login, in the above example db1, this lead to clients being handed a stale connection.
To Fix this we reset the database context to that from the loginInfo which was maintained at time of login. Changes were also made to avoid sending the environment change token for the implicit "USE DB" being run at time of reset.

Issues Resolved
BABEL-5256

Signed off by: Kushaal Shroff <[email protected]>
@KushaalShroff KushaalShroff merged commit 5c6df44 into babelfish-for-postgresql:BABEL_2_X_DEV Sep 26, 2024
30 checks passed
@KushaalShroff KushaalShroff deleted the resetdb_2 branch September 26, 2024 15:28
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.

2 participants