Symptoms

  1. Task Execute operation 'archive_reports' with ID ... on resource ... failed with:

    An unexpected error has occurred.
    
  2. azure.log on Azure Application Endpoint host contains error like:

        Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "consumption_records" violates foreign key constraint "fk_tenant_consumption_queue_consumption_record_id" on table "consumption_queue"
          Detail: Key (id)=(129306420) is still referenced from table "consumption_queue".
                at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
                at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
                at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
                at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
                at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
                at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
                at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
                at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204) [hibernate-core-5.0.10.Final.jar:5.0.10.Final]
                ... 17 more
    
  3. PostgreSQL log contains the following output:

    < 2018-02-18 21:17:35.139 CST > STATEMENT:  DELETE FROM consumption_records WHERE aggregate = 'n' AND azure_report_id = $1
    < 2018-02-18 21:17:36.471 CST > ERROR:  update or delete on table "consumption_records" violates foreign key constraint "fk_tenant_consumption_queue_consumption_record_id" on table "consumption_queue"
    < 2018-02-18 21:17:36.471 CST > DETAIL:  Key (id)=(129306420) is still referenced from table "consumption_queue".
    

Cause

There could be several reasons:

1. Software-related issue #APSA-19621 Hanged items in consumption queue.

2. Usage synchronization for Azure subscription is failing for more than 3 month leaving unprocessed entries in consumption_queue table.

3. Usage synchronization process is not initiated at all for Azure subscription for more than 3 months due to software-related issue #OA-8102.


Resolution

Contact CloudBlue Technical Support in order to fix the issue.

Internal content

Link on internal Article