Use same PrestoRequest instance to execute queries within the same transaction.
When an HTTP gateway is used to balance queries across multiple Presto
coordinators, queries within the same transaction must go to the same
coordinator. An HTTP cookie can support this behavior such as Set-Cookie: Presto-Gateway-Sticky={host}:{port};Version=1. The cookie is persisted by the
requests.Session object referenced by PrestoRequest._http_session. Hence
All queries should be sent with the same session data.
The behavior introduced by 30c1735 was not working because the Presto-Gateway-Sticky cookie was not in the Response object. It was already persisted in the requests.Session object.
I manually tested the execution of queries within the same transaction and will add an integration tests that will require a Presto HTTP gateway:
Use same
PrestoRequest
instance to execute queries within the same transaction.When an HTTP gateway is used to balance queries across multiple Presto coordinators, queries within the same transaction must go to the same coordinator. An HTTP cookie can support this behavior such as
Set-Cookie: Presto-Gateway-Sticky={host}:{port};Version=1
. The cookie is persisted by therequests.Session
object referenced byPrestoRequest._http_session
. Hence All queries should be sent with the same session data.The behavior introduced by 30c1735 was not working because the
Presto-Gateway-Sticky
cookie was not in theResponse
object. It was already persisted in therequests.Session
object.I manually tested the execution of queries within the same transaction and will add an integration tests that will require a Presto HTTP gateway: