clarencen/lshift — Issue #296: Spurious NonUniqueResultException
Author: clarencen
Created: 2011-11-14 22:42:25+00:00
State: open

There is a spurious error when deleting a downstream entity:

@@@
2010-10-13 21:16:19,033 DEBUG [qtp46675819-14] n.l.d.k.f.Changes [Changes.scala:36] Received change event: DownstreamChangeEvent(b,id1,2010-10-13T21:16:19.031+01:00,2010-10-13T21:16:19.031+01:00,null)
2010-10-13 21:16:19,036 DEBUG [qtp46675819-14] n.l.d.k.m.LocalEventMatcher [LocalEventMatcher.scala:41] Received event DownstreamPairChangeEvent(VersionID(WEB-1,id1),2010-10-13T21:16:19.031+01:00,2010-10-13T21:16:19.031+01:00,null)
2010-10-13 21:16:19,039 WARN [qtp46675819-14] n.l.d.k.d.HibernateVersionCorrelationStore [HibernateQueryUtils.scala:73] Non unique result for: currentCorrelation
2010-10-13 21:16:19,040 DEBUG [qtp46675819-14] n.l.d.k.d.HibernateVersionCorrelationStore [HibernateQueryUtils.scala:74] Key: [key], Value: [WEB-1]
2010-10-13 21:16:19,040 DEBUG [qtp46675819-14] n.l.d.k.d.HibernateVersionCorrelationStore [HibernateQueryUtils.scala:74] Key: [id], Value: [id1]
2010-10-13 21:16:19,044 DEBUG [qtp46675819-14] n.l.d.k.d.HibernateVersionCorrelationStore [HibernateQueryUtils.scala:75] Logging stack trace for non unique result
org.hibernate.NonUniqueResultException: query did not return a unique result: 2
at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
at net.lshift.diffa.kernel.util.HibernateQueryUtils$class.singleQueryOpt(HibernateQueryUtils.scala:66) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.differencing.HibernateVersionCorrelationStore.singleQueryOpt(HibernateVersionCorrelationStore.scala:32) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.differencing.HibernateVersionCorrelationStore.net$lshift$diffa$kernel$differencing$HibernateVersionCorrelationStore$$queryCurrentCorrelation(HibernateVersionCorrelationStore.scala:160) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.differencing.HibernateVersionCorrelationStore$$anonfun$clearDownstreamVersion$1.apply(HibernateVersionCorrelationStore.scala:114) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.differencing.HibernateVersionCorrelationStore$$anonfun$clearDownstreamVersion$1.apply(HibernateVersionCorrelationStore.scala:113) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.util.SessionHelper.withSession(SessionHelper.scala:29) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.differencing.HibernateVersionCorrelationStore.clearDownstreamVersion(HibernateVersionCorrelationStore.scala:113) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.differencing.BaseSynchingVersionPolicy.onChange(BaseSynchingVersionPolicy.scala:43) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.frontend.Changes$$anonfun$onChange$1.apply(Changes.scala:61) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.kernel.frontend.Changes$$anonfun$onChange$1.apply(Changes.scala:38) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:57) [scala-library-2.8.0.jar:na]
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:43) [scala-library-2.8.0.jar:na]
at net.lshift.diffa.kernel.frontend.Changes.onChange(Changes.scala:38) [diffa-kernel-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.messaging.json.ChangesHandler$$anonfun$2.apply(ChangesHandler.scala:48) [diffa-json-messaging-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.messaging.json.ChangesHandler$$anonfun$2.apply(ChangesHandler.scala:34) [diffa-json-messaging-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.messaging.json.AbstractJSONHandler$$anonfun$defineOnewayRpc$1.apply(AbstractJSONHandler.scala:94) [diffa-json-messaging-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.messaging.json.AbstractJSONHandler$$anonfun$defineOnewayRpc$1.apply(AbstractJSONHandler.scala:92) [diffa-json-messaging-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.messaging.json.AbstractJSONHandler.handleRequest(AbstractJSONHandler.scala:44) [diffa-json-messaging-1.0-SNAPSHOT.jar:na]
at net.lshift.diffa.agent.http.FrontendRequestHandler.handleRequest(FrontendRequestHandler.scala:36) [classes/:na]
@@@

Steps to reproduce:

1. Start a fresh agent (with demo app)
2. Click on test scenario 1
3. Delete the downstream entity with the key id1