Capacity Analytics error messages

book

Article ID: 144505

calendar_today

Updated On:

Products

DX Operational Intelligence

Issue/Introduction

We checked CPA log and we found error:


### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: function resource_consumers(integer, character varying, integer, character varying) does not exist
  Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  Position: 15
### The error may exist in com/ca/cpa/db/mappers/HealthMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from resource_consumers(?,?,?,?)
### Cause: org.postgresql.util.PSQLException: ERROR: function resource_consumers(integer, character varying, integer, character varying) does not exist
  Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  Position: 15


We checked function definition in postgresql with command:

\df+ resource_consumers

it returns:

|                          Argument data types                          |
| thresholdtype integer, tenantid character varying, intervalid integer |


Function have 3 arguments but the query is using 4 arguments.

It seems like database schema is inconsistent.

Environment

Release : 1.3.2

Component : CA DOI AO PLATFORM COMPONENTS

Resolution

login to cpa POD 

find the *resource_consumers.sql files.

find . -name="*resource_consumers.sql" -print

identify the *resource_consumers.sql that has following FUNCTION (normally this file exists under 1.3.1 directory):

CREATE OR REPLACE FUNCTION resource_consumers(....)

We need to execute the resource_consumers FUNCTION with 4 arguments.

login to postgres POD 

create a file called resource123.sql in postgres POD.

copy the complete FUNCTION from *resource_consumers.sql to resource123.sql
CREATE OR REPLACE FUNCTION resource_consumers(....) till the end of file.

run the psql command to create the FUNCTION in database
psql -U aopuser -d cpa -a -f resource123.sql