Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples.samples.autocommit_test: test_enable_autocommit_mode failed #282

Closed
flaky-bot bot opened this issue Mar 20, 2021 · 3 comments
Closed

samples.samples.autocommit_test: test_enable_autocommit_mode failed #282

flaky-bot bot opened this issue Mar 20, 2021 · 3 comments
Labels
api: spanner Issues related to the googleapis/python-spanner API. flakybot: flaky Tells the Flaky Bot not to close or comment on this issue. flakybot: issue An issue filed by the Flaky Bot. Should not be added manually. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. samples Issues that are directly related to samples. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@flaky-bot
Copy link

flaky-bot bot commented Mar 20, 2021

Note: #254 was also for this test, but it was closed more than 10 days ago. So, I didn't mark it flaky.


commit: e990ff7
buildURL: Build Status, Sponge
status: failed

Test output
self = 
sql = "INSERT INTO Singers (SingerId, FirstName, LastName) VALUES\n            (12, 'Melissa', 'Garcia'),\n            (13, 'Russell', 'Morales'),\n            (14, 'Jacqueline', 'Long'),\n            (15, 'Dylan', 'Shaw')"
args = None
def execute(self, sql, args=None):
    """Prepares and executes a Spanner database operation.

    :type sql: str
    :param sql: A SQL query statement.

    :type args: list
    :param args: Additional parameters to supplement the SQL query.
    """
    if not self.connection:
        raise ProgrammingError("Cursor is not connected to the database")

    self._raise_if_closed()

    self._result_set = None

    # Classify whether this is a read-only SQL statement.
    try:
        classification = parse_utils.classify_stmt(sql)
        if classification == parse_utils.STMT_DDL:
            self.connection._ddl_statements.append(sql)
            return

        # For every other operation, we've got to ensure that
        # any prior DDL statements were run.
        # self._run_prior_DDL_statements()
      self.connection.run_prior_DDL_statements()

../../google/cloud/spanner_dbapi/cursor.py:190:


self = <google.cloud.spanner_dbapi.connection.Connection object at 0x7fd2d9df0dd8>

def run_prior_DDL_statements(self):
    self._raise_if_closed()

    if self._ddl_statements:
        ddl_statements = self._ddl_statements
        self._ddl_statements = []
      return self.database.update_ddl(ddl_statements).result()

../../google/cloud/spanner_dbapi/connection.py:281:


self = <google.api_core.operation.Operation object at 0x7fd2d9cd4898>
timeout = None, retry = <google.api_core.retry.Retry object at 0x7fd2da160e80>

def result(self, timeout=None, retry=DEFAULT_RETRY):
    """Get the result of the operation, blocking if necessary.

    Args:
        timeout (int):
            How long (in seconds) to wait for the operation to complete.
            If None, wait indefinitely.

    Returns:
        google.protobuf.Message: The Operation's result.

    Raises:
        google.api_core.GoogleAPICallError: If the operation errors or if
            the timeout is reached before the operation completes.
    """
    kwargs = {} if retry is DEFAULT_RETRY else {"retry": retry}
    self._blocking_poll(timeout=timeout, **kwargs)

    if self._exception is not None:
        # pylint: disable=raising-bad-type
        # Pylint doesn't recognize that this is valid in this case.
      raise self._exception

E google.api_core.exceptions.FailedPrecondition: 400 Duplicate name in schema: Singers.

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:134: FailedPrecondition

During handling of the above exception, another exception occurred:

capsys = <_pytest.capture.CaptureFixture object at 0x7fd2d9d8aba8>
database = <google.cloud.spanner_v1.database.Database object at 0x7fd2d9d5b5f8>

@RetryErrors(exception=Aborted, max_tries=2)
def test_enable_autocommit_mode(capsys, database):
    connection = connect(INSTANCE_ID, DATABASE_ID)
    cursor = connection.cursor()

    with mock.patch(
        "google.cloud.spanner_dbapi.connection.Cursor", return_value=cursor,
    ):
      autocommit.enable_autocommit_mode(INSTANCE_ID, DATABASE_ID)

autocommit_test.py:62:


autocommit.py:36: in enable_autocommit_mode
(15, 'Dylan', 'Shaw')"""


self = <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7fd2d9cb0d68>
sql = "INSERT INTO Singers (SingerId, FirstName, LastName) VALUES\n (12, 'Melissa', 'Garcia'),\n (13, 'Russell', 'Morales'),\n (14, 'Jacqueline', 'Long'),\n (15, 'Dylan', 'Shaw')"
args = None

def execute(self, sql, args=None):
    """Prepares and executes a Spanner database operation.

    :type sql: str
    :param sql: A SQL query statement.

    :type args: list
    :param args: Additional parameters to supplement the SQL query.
    """
    if not self.connection:
        raise ProgrammingError("Cursor is not connected to the database")

    self._raise_if_closed()

    self._result_set = None

    # Classify whether this is a read-only SQL statement.
    try:
        classification = parse_utils.classify_stmt(sql)
        if classification == parse_utils.STMT_DDL:
            self.connection._ddl_statements.append(sql)
            return

        # For every other operation, we've got to ensure that
        # any prior DDL statements were run.
        # self._run_prior_DDL_statements()
        self.connection.run_prior_DDL_statements()

        if not self.connection.autocommit:
            if classification == parse_utils.STMT_UPDATING:
                sql = parse_utils.ensure_where_clause(sql)

            if classification != parse_utils.STMT_INSERT:
                sql, args = sql_pyformat_args_to_spanner(sql, args or None)

            statement = Statement(
                sql,
                args,
                get_param_types(args or None)
                if classification != parse_utils.STMT_INSERT
                else {},
                ResultsChecksum(),
                classification == parse_utils.STMT_INSERT,
            )
            (self._result_set, self._checksum,) = self.connection.run_statement(
                statement
            )
            self._itr = PeekIterator(self._result_set)
            return

        if classification == parse_utils.STMT_NON_UPDATING:
            self._handle_DQL(sql, args or None)
        elif classification == parse_utils.STMT_INSERT:
            _helpers.handle_insert(self.connection, sql, args or None)
        else:
            self.connection.database.run_in_transaction(
                self._do_execute_update, sql, args or None
            )
    except (AlreadyExists, FailedPrecondition) as e:
      raise IntegrityError(e.details if hasattr(e, "details") else e)

E google.cloud.spanner_dbapi.exceptions.IntegrityError: 400 Duplicate name in schema: Singers.

../../google/cloud/spanner_dbapi/cursor.py:223: IntegrityError

@flaky-bot flaky-bot bot added flakybot: issue An issue filed by the Flaky Bot. Should not be added manually. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 20, 2021
@product-auto-label product-auto-label bot added api: spanner Issues related to the googleapis/python-spanner API. samples Issues that are directly related to samples. labels Mar 20, 2021
@flaky-bot
Copy link
Author

flaky-bot bot commented Mar 20, 2021

Looks like this issue is flaky. 😟

I'm going to leave this open and stop commenting.

A human should fix and close this.


When run at the same commit (e990ff7), this test passed in one build (Build Status, Sponge) and failed in another build (Build Status, Sponge).

@flaky-bot flaky-bot bot added the flakybot: flaky Tells the Flaky Bot not to close or comment on this issue. label Mar 20, 2021
@larkee
Copy link
Contributor

larkee commented Mar 23, 2021

Was fixed in #255 however a release has not been done since then. The release later this week should resolve this flake.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Mar 27, 2021
@larkee
Copy link
Contributor

larkee commented Mar 29, 2021

Now that #263 has been merged, this should be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. flakybot: flaky Tells the Flaky Bot not to close or comment on this issue. flakybot: issue An issue filed by the Flaky Bot. Should not be added manually. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. samples Issues that are directly related to samples. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants