Horreum icon indicating copy to clipboard operation
Horreum copied to clipboard

can not delete test missing data notification

Open jhutar opened this issue 1 year ago • 3 comments

Describe the bug

I can not delete test missing data notification

I have this: image

To Reproduce

  1. Go to https://horreum.corp.redhat.com/test/254#missingdata
  2. Click Delete -> Delete -> Save

I get this error back:

Failed to delete missing data rule weekly run

{
  "details": "Error id 2d249d08-b239-42f2-b393-9ae4e5890b09-27",
  "stack": ""
}

Version

Current in Prod

OS

Fedora release 39 (Thirty Nine)

Browser

firefox-122.0-5.fc39.x86_64

jhutar avatar Feb 21 '24 11:02 jhutar

Server side log:

2024-02-21 11:49:11,566 b2db38f35172 quarkus-run.jar[7] ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-5309) HTTP Request to /api/alerting/missingdatarule/5047029 failed, error id: 2d249d08-b239-42f2-b393-9ae4e5890b09-27: org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR: update or delete on table "missingdata_rule" violates foreign key constraint "rr_rule_id" on table "missingdata_ruleresult"
  Detail: Key is still referenced from table "missingdata_ruleresult".] [delete from missingdata_rule where id=?]
	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:95)
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:278)
        ....
	at io.hyperfoil.tools.horreum.svc.AlertingServiceImpl_Subclass.deleteMissingDataRule(Unknown Source)
	at io.hyperfoil.tools.horreum.svc.AlertingServiceImpl_ClientProxy.deleteMissingDataRule(Unknown Source)
	at io.hyperfoil.tools.horreum.api.internal.services.AlertingService$quarkusrestinvoker$deleteMissingDataRule_37d8652630bd3b8a685a5641f9552593777d4630.invoke(Unknown Source)

johnaohara avatar Feb 21 '24 12:02 johnaohara

@jhutar thanks for reporting, looks like we are missing cascading a delete to related data

johnaohara avatar Feb 21 '24 12:02 johnaohara

@johnaohara this seems very odd... In 0.9.4 we added: https://github.com/Hyperfoil/Horreum/blob/master/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/AlertingServiceImpl.java#L1224 and we have a test where we delete a MissingDataRule which has two corresponding MissingDataRuleResults: https://github.com/Hyperfoil/Horreum/blob/57c93598912e4e791eb78bf36380957221e47b4c/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/AlertingServiceTest.java#L461

I'm not sure how to reproduce this (yet)...

stalep avatar Feb 22 '24 07:02 stalep