Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#22849] YSQL: Correctly handle reset phase timeout errors in YSQL Co…
…nnection Manager Summary: **Problem Statement:** While a logical client detaches from its corresponding server connection, Connection Manager fires certain RESET queries before allowing the server connection to return back to the pool of usable connections for other logical clients to use. The upstream code has made it such that if these RESET queries take longer than 1 second to execute and return cumulatively, then odyssey breaks the connection and forwards its own error to the client with the message `Resource temporarily unavailable`. It is to be noted that there were no errors while executing the client's workload, and that this is an error formed by the Connection Manager layer itself. **Solution/Changes Made:** Since there were technically no errors due to the client's workload, it makes no sense to forward any error to the logical client - we can instead silently close the server connection when it is found that we hit the reset timeout during the reset phase. Additionally, increase the reset timeout in this diff as the client's workload is already pipelined and is not dependent on the server's reset phase completing. It will help save some cycles internally if we can re-use the same server connection. We modify a function, `od_backend_query` to return a different status when the reset timeout is hit, which can be used for any "reset" query that is fired at the time of detaching the logical and physical connection. Some examples of this can be seen with the help of a small excerpt from the conn mgr template file, picked up from pool config settings: ``` pool_discard no pool_rollback yes ``` Each of these values correspond to what should be done to the server connection with respect to "resetting" the context on it as per the user's wish - `discard` fires a "discard all" query - `rollback` fires a "rollback" if it is found that the server is in an active transaction before firing reset statements - By default, we fire a query that contains "reset all" "reset role" and "reset session authorization" All of the above scenarios use the same function being modified to return a different status depending on the reset type Jira: DB-11746 Test Plan: Jenkins: enable connection manager, all tests Reviewers: skumar, asrinivasan Reviewed By: asrinivasan Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D35564
- Loading branch information