Closed guyco33 closed 1 year ago
@mdesmet @ebyhr Can you PTAL again. This just adds a regression test now (which asserts the broken behaviour) - the fix will be part of #220.
This code can be used to simulate this using dbapi on the #220 branch. This didn't result in any unfinished queries. Now again I don't know enough about the related Trino internals what's the chance of this becoming a flaky test on github CI.
import trino
count_not_finished = 0
trino_connection = trino.dbapi.connect(
host="localhost",
port=8080,
user="admin"
)
for _ in range(0, 10000):
cur = trino_connection.cursor()
cur.execute("SELECT VERSION()")
cur.fetchone()
cur.fetchone() # simulate sqlalchemy scalar_one
if not cur._query.finished:
count_not_finished += 1
print(str(count_not_finished) + " unfinished queries")
In other words we need to be sure that doing 2 fetchone() calls (actually fetching up to 3 requests as long next_uri is not null) is enough to fully consume all results and mark the query as finished.
This has been addressed via #220 now. It has a different test though since the test here is potentially flaky (and also fails some of the existing tests regarding INSERTs).
Fix issue of queries not reaching completed state - see discussion on https://trinodb.slack.com/archives/CGB0QHWSW/p1658934510749439
Adds a test to demonstrate effect of https://github.com/trinodb/trino/pull/13055