This repository was archived by the owner on Mar 31, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Aborted errors not being retried in DBAPI #342
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the googleapis/python-spanner API.Issues related to the googleapis/python-spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
From the SQLAlchemy CircleCI:
Traceback (most recent call last):
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/testing/suite/test_dialect.py", line 200, in test_turn_autocommit_off_via_default_iso_level
self._test_conn_autocommits(conn, False)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/testing/suite/test_dialect.py", line 175, in _test_conn_autocommits
conn.execute(self.tables.some_table.delete())
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
self._handle_dbapi_exception(
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1514, in _handle_dbapi_exception
util.raise_(exc_info[1], with_traceback=exc_info[2])
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
cursor.execute(statement, parameters)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/cloud/spanner_dbapi/cursor.py", line 209, in execute
self._itr = PeekIterator(self._result_set)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/cloud/spanner_dbapi/utils.py", line 38, in __init__
head = next(itr_src)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/cloud/spanner_v1/streamed.py", line 149, in __iter__
self._consume_next()
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/cloud/spanner_v1/streamed.py", line 121, in _consume_next
response = six.next(self._response_iterator)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/cloud/spanner_v1/snapshot.py", line 58, in _restart_on_unavailable
iterator = method(request=request)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/cloud/spanner_v1/services/spanner/client.py", line 899, in execute_streaming_sql
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/api_core/timeout.py", line 102, in func_with_timeout
return func(*args, **kwargs)
File "/home/circleci/project/.nox/compliance_test/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 168, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.Aborted: 409 Transaction aborted. Database schema probably changed during transaction, retry may succeed.
DBAPI only retries Aborted errors in the fetch functions. However, the Aborted error is being raised in execute() by the PeekIterator. I think the PeekIterator implementation needs to be updated to prevent iterating before the fetch functions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the googleapis/python-spanner API.Issues related to the googleapis/python-spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.