Uploaded image for project: 'Cost Management'
  1. Cost Management
  2. COST-2710

Current Transaction Aborted preventing provider deletes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • 2022Q2
    • None
    • None
    • None
    • False
    • None
    • False

      Sentry Link: https://coreos.slack.com/archives/C024BNW4HT8/p1654614421666029

      Logs:

      [2022-06-07 15:04:09,838: INFO/ForkPoolWorker-70] PROVIDER test_cost_gcp_static_1 (782da70d-c5c5-46cf-90dd-ca973688b81d) CASCADE DELETE -- SCHEMA acct6089719
      [2022-06-07 15:06:50,892] ERROR b1245f58-d865-4fcb-b401-e5a784c4de02 Task failed: current transaction is aborted, commands ignored until end of transaction block
      Traceback (most recent call last):
      File "/opt/koku/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 82, in _execute
      return self.cursor.execute(sql)
      psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block
      

      After debugging, we need to handle exceptions and connections better within the execute_delete_sql function.

      def execute_delete_sql(query):
          """Execute sql directly, returns cursor."""
          sql, params = get_delete_sql(query)
          try:
              return execute_compiled_sql(sql, params=params)
          except Exception as e:
              LOG.debug(f"The following exception occurred \{e}")
              return 0
      

              hproctor HAP Proctor (Inactive)
              myersco Cody Myers
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: