Running an APM CE (CEM) scheduled report generates database error messages in the Introscope Enterprise Manager log.

Document ID : KB000048055
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

After running APM CE daily scheduled reports each morning, there are database errors in the Introscope logs (including key constraint errors.) The messages in the log look like the following:

2/10/14 06:00:03.238 AM EST [ERROR] [QuartzScheduler_Worker-8] [org.quartz.core.JobRunShell] Job DEFAULT.jobDetailBean threw an unhandled Exception: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'pruneData' on target class [class com.wily.apm.model.pruning.DataPruner] failed; nested exception is org.springframework.dao.DataIntegrityViolationException: CallableStatementCallback; SQL [{? = call prune_apm_data(?, ?)}]; ERROR: update or delete on table "apm_vertex" violates foreign key constraint "apm_parent_id_fkey" on table "apm_vertex" Detail: Key (id)=(801) is still referenced from table "apm_vertex"

Solution:

Before proceeding, make a backup copy of the APM database (APMDB).

Run each of the following queries one at a time. After each command completion. check the output to make sure it is a success

SQL Commands to run (in order):

ALTER TABLE apm_vertex DROP CONSTRAINT apm_parent_id_fkey;

DELETE FROM apm_vertex where id=' 801'; Note: This number changes based on the value in the above error message.

ALTER TABLE apm_vertex ADD CONSTRAINT apm_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES apm_vertex (id) MATCH SIMPLE;