-
Bug
-
Resolution: Done
-
Blocker
-
None
-
None
-
5
-
False
-
-
False
-
-
Splunk : index=rh_rhsm namespace=rhsm-stage host="swatch-contracts-service-*" subs_product_ids_fk
Looks like regression from - https://github.com/RedHatInsights/rhsm-subscriptions/pull/3506
Reproducer :
Environment : stage
Org IDs -
- 17685411
- 11789772
API :
500 Server Error: POST request: Internal Server Error for url: https://mtls.internal.cloud.stage.redhat.com/api/swatch-contracts/internal/rpc/sync/contracts/17685411?is_pre_cleanup=False
Traceback :
exception: could not execute statement [ERROR: update or delete on table "subscription" violates foreign key constraint "subs_product_ids_fk" on table "subscription_product_ids" Detail: Key (subscription_id, start_date)=(14348371, 2024-02-19 05:00:00+00) is still referenced from table "subscription_product_ids".] [delete from subscription where start_date=? and subscription_id=?] message: 2024-07-15 11:56:29,847 ERROR [com.red.swa.con.res.DefaultExceptionMapper] (executor-thread-2729) Request '/api/swatch-contracts/internal/rpc/sync/contracts/17685411' failed with error 'could not execute statement [ERROR: update or delete on table "subscription" violates foreign key constraint "subs_product_ids_fk" on table "subscription_product_ids" Detail: Key (subscription_id, start_date)=(14348371, 2024-02-19 05:00:00+00) is still referenced from table "subscription_product_ids".] [delete from subscription where start_date=? and subscription_id=?]': org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR: update or delete on table "subscription" violates foreign key constraint "subs_product_ids_fk" on table "subscription_product_ids" Detail: Key (subscription_id, start_date)=(14348371, 2024-02-19 05:00:00+00) is still referenced from table "subscription_product_ids".] [delete from subscription where start_date=? and subscription_id=?] at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:97) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:58) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197) at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.performNonBatchedMutation(AbstractMutationExecutor.java:108) at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:40) at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:52) at org.hibernate.persister.entity.mutation.AbstractDeleteCoordinator.doStaticDelete(AbstractDeleteCoordinator.java:279) at org.hibernate.persister.entity.mutation.AbstractDeleteCoordinator.coordinateDelete(AbstractDeleteCoordinator.java:87) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2979) at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:131) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:632) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:499) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:363) at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:61) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127) at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1366) at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.lambda$new$3(ConcreteSqmSelectQueryPlan.java:164) at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:362) at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performScroll(ConcreteSqmSelectQueryPlan.java:311) at org.hibernate.query.sqm.internal.QuerySqmImpl.doScroll(QuerySqmImpl.java:593) at org.hibernate.query.spi.AbstractSelectionQuery.scroll(AbstractSelectionQuery.java:531) at org.hibernate.query.spi.AbstractSelectionQuery.stream(AbstractSelectionQuery.java:548) at org.hibernate.query.spi.AbstractSelectionQuery.getResultStream(AbstractSelectionQuery.java:542) at com.redhat.swatch.panache.PanacheSpecificationSupport.stream(PanacheSpecificationSupport.java:60) at com.redhat.swatch.contract.repository.ContractRepository.findContracts(ContractRepository.java:40) at com.redhat.swatch.contract.repository.ContractRepository_ClientProxy.findContracts(Unknown Source) at com.redhat.swatch.contract.service.ContractService.findExistingContractRecords(ContractService.java:592) at com.redhat.swatch.contract.service.ContractService.upsertPartnerContracts(ContractService.java:262) at com.redhat.swatch.contract.service.ContractService_Subclass.upsertPartnerContracts$$superforward(Unknown Source) at com.redhat.swatch.contract.service.ContractService_Subclass$$function$$7.apply(Unknown Source) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInCallerTx(TransactionalInterceptorBase.java:335) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:40) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:61) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42) at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30) at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27) at com.redhat.swatch.contract.service.ContractService_Subclass.upsertPartnerContracts(Unknown Source) at com.redhat.swatch.contract.service.ContractService.tryUpsertPartnerContract(ContractService.java:487) at com.redhat.swatch.contract.service.ContractService.syncContractByOrgId(ContractService.java:436) at com.redhat.swatch.contract.service.ContractService_Subclass.syncContractByOrgId$$superforward(Unknown Source) at com.redhat.swatch.contract.service.ContractService_Subclass$$function$$5.apply(Unknown Source) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:136) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:107) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:61) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32) at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42) at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30) at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27) at com.redhat.swatch.contract.service.ContractService_Subclass.syncContractByOrgId(Unknown Source) at com.redhat.swatch.contract.service.ContractService_ClientProxy.syncContractByOrgId(Unknown Source) at com.redhat.swatch.contract.resource.ContractsTestingResource.syncContractsByOrg(ContractsTestingResource.java:134) at com.redhat.swatch.contract.resource.ContractsTestingResource_Subclass.syncContractsByOrg$$superforward(Unknown Source) at com.redhat.swatch.contract.resource.ContractsTestingResource_Subclass$$function$$15.apply(Unknown Source) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73) at io.quarkus.arc.impl.AroundInvokeInvocationContext$NextAroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:97) at io.quarkus.security.runtime.interceptor.SecurityHandler.handle(SecurityHandler.java:27) at io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor.intercept(RolesAllowedInterceptor.java:29) at io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:70) at io.quarkus.arc.impl.AroundInvokeInvocationContext$NextAroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:97) at io.quarkus.security.runtime.interceptor.SecurityHandler.handle(SecurityHandler.java:47) at io.quarkus.security.runtime.interceptor.DenyAllInterceptor.intercept(DenyAllInterceptor.java:30) at io.quarkus.security.runtime.interceptor.DenyAllInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:70) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62) at io.quarkus.resteasy.reactive.server.runtime.StandardSecurityCheckInterceptor.intercept(StandardSecurityCheckInterceptor.java:44) at io.quarkus.resteasy.reactive.server.runtime.StandardSecurityCheckInterceptor_RolesAllowedInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42) at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30) at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27) at com.redhat.swatch.contract.resource.ContractsTestingResource_Subclass.syncContractsByOrg(Unknown Source) at com.redhat.swatch.contract.resource.ContractsTestingResource_ClientProxy.syncContractsByOrg(Unknown Source) at com.redhat.swatch.contract.openapi.resource.DefaultApi$quarkusrestinvoker$syncContractsByOrg_39def669b16756e3fe71887ac5e8ff73cd78d075.invoke(Unknown Source) at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29) at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147) at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:599) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "subscription" violates foreign key constraint "subs_product_ids_fk" on table "subscription_product_ids" Detail: Key (subscription_id, start_date)=(14348371, 2024-02-19 05:00:00+00) is still referenced from table "subscription_product_ids". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:194) at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:155) at io.agroal.pool.wrapper.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:90) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:194) ... 91 more