Database client-server reattachment to preserve server session state
A database client may establish a database session with a database server, including a session state, for a first TCP network connection through a first reverse proxy. A reattachment token is sent to the database client, and a database operation request is received from the database client through the first reverse proxy. Before or during execution of the database operation request (including any updates to the session state) an indication is received that the first reverse proxy will be terminated after a reattachment window. The server instructs the database client to perform a session reattachment and receives, from the database client, a session reattachment request, including the reattachment token, for a second TCP network connection through a second reverse proxy. The server verifies the reattachment token and resumes the database session with the database client, including the updated session state, for the second TCP network connection.
1 . A system associated with a cloud computing database infrastructure, comprising:
a database client, including:
a computer processor, and
a computer memory storing instructions that, when executed by the computer processor, cause the database client to:
establish a database session with a database server for a first Transmission Control Protocol (“TCP”) network connection through a first reverse proxy,
receive a reattachment token from the database server through the first reverse proxy,
transmit a database operation request to the database server through the first reverse proxy,
during or after execution of the database operation request, including any updates to a session state, receive, through the first reverse proxy, an instruction to perform a session reattachment from the database server,
establish a second TCP network connection with the database server through a second reverse proxy,
transmit a session reattachment request including the reattachment token through the second reverse proxy, and
move the database session from the first TCP network connection to the second TCP network connection.
2 . The system of claim 1 , wherein the session state includes at least one of: (i) local temporary tables, (ii) open result cursors, (iii) currently executing queries, and (iv) transactions.
3 . The system of claim 1 , further comprising:
the database server to:
establish the database session with the database client, including the session state, for the first TCP network connection through the first reverse proxy,
transmit the reattachment token to the database client through the first reverse proxy,
receive the database operation request from the database client through the first reverse proxy,
before or during execution of the database operation request, including any updates to the session state, receive an indication from the cloud computing database infrastructure that the first reverse proxy will be terminated after a reattachment window,
instruct, through the first reverse proxy, the database client to perform the session reattachment,
receive, from the database client, the session reattachment request, including the reattachment token, for the second TCP network connection through the second reverse proxy,
verify the reattachment token, and
resume the database session with the database client, including the updated session state, for the second TCP network connection.
4 . The system of claim 3 , wherein the database server decides to perform a reattach after response based on a periodic check.
5 . The system of claim 4 , wherein the reattach after response comprises an original request that has been completed and a full response is sent back to the database client before the database client starts the reattach.
6 . The system of claim 3 , wherein the database server decides to perform a reattach during execution based on a periodic check.
7 . The system of claim 6 , wherein the reattach during execution comprises an original request that is still running when the database server instructs the database client to do the reattach.
8 . The system of claim 3 , wherein the first reverse proxy is terminated because of at least one of: (i) a cloud configuration change, (ii) service maintenance, and (iii) elasticity operations in a cloud edge layer.
9 . The system of claim 3 , wherein the second TCP network connection is established at least one of: (i) before the first TCP network connection is dropped, and (ii) after the first TCP network connection is dropped.
10 . The system of claim 3 , wherein the session reattachment is associated with a distributed protocol flow for a logical connection between an application with multiple physical connections to multiple database server nodes.
11 . A system associated with a cloud computing database infrastructure, comprising:
a database server, including:
a computer processor, and
a computer memory storing instructions that, when executed by the computer processor, cause the database server to:
establish a database session with a database client, including a session state, for a first Transmission Control Protocol (“TCP”) network connection through a first reverse proxy,
transmit a reattachment token to the database client through the first reverse proxy,
receive a database operation request from the database client through the first reverse proxy,
before or during execution of the database operation request, including any updates to the session state, receive an indication from the cloud computing database infrastructure that the first reverse proxy will be terminated after a reattachment window,
instruct, through the first reverse proxy, the database client to perform a session reattachment,
receive, from the database client, a session reattachment request, including the reattachment token, for a second TCP network connection through a second reverse proxy,
verify the reattachment token, and
resume the database session with the database client, including the updated session state, for the second TCP network connection.
12 . The system of claim 11 , wherein the database server decides to perform a reattach after request based on a periodic check.
13 . The system of claim 11 , wherein the database server decides to perform a reattach during execution based on a periodic check.
14 . The system of claim 11 , wherein the first reverse proxy is terminated because of at least one of: (i) a cloud configuration change, (ii) service maintenance, and (iii) elasticity operations in a cloud edge layer.
15 . The system of claim 11 , wherein the second TCP network connection is established at least one of: (i) before the first TCP network connection is dropped, and (ii) after the first TCP network connection is dropped.
16 . The system of claim 11 , wherein the session reattachment is associated with a distributed protocol flow for a logical connection between an application with multiple physical connections to multiple database server nodes.
17 . A computer-implemented method associated with a cloud computing database infrastructure, comprising:
establishing, by a computer processor of a database server, a database session with a database client, including a session state, for a first Transmission Control Protocol (“TCP”) network connection through a first reverse proxy;
transmitting a reattachment token to the database client through the first reverse proxy;
receiving a database operation request from the database client through the first reverse proxy;
before or during execution of the database operation request, including any updates to the session state, receiving an indication from the cloud computing database infrastructure that the first reverse proxy will be terminated after a reattachment window;
instructing, through the first reverse proxy, the database client to perform a session reattachment;
receiving, from the database client, a session reattachment request, including the reattachment token, for a second TCP network connection through a second reverse proxy;
verifying the reattachment token; and
resuming the database session with the database client, including the updated session state, for the second TCP network connection.
18 . The computer-implemented method of claim 17 , wherein the session state includes at least one of: (i) local temporary tables, (ii) open result cursors, (iii) currently executing queries, and (iv) transactions.
19 . The computer-implemented method of claim 17 , wherein the database server decides to perform a reattach based on a periodic check, and a reattach after request comprises an original request that has been completed and a full response is sent back to the database client before the database client starts the reattach.
20 . The computer-implemented method of claim 17 , wherein the database server decides to perform a reattach during execution based on a periodic check, and the reattach during execution comprises an original request that is still running when the database server instructs the database client to do the reattach during execution.