Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.9.92
-
Fix Version/s: None
-
Component/s: Enhanced Linkd / Linkd
-
Security Level: Default (Default Security Scheme)
-
Labels:
Description
I recently closed bug NMS-4005 but there was one remaining issue in that bug that we should look into. linkd appears to be trying to perform an INSERT instead of an UPDATE for an entry in the ipRouteInterface table. I think that Matt's "upsert" database pattern might be useful in this case. The following stack trace is copied out of NMS-4005:
org.springframework.dao.DataIntegrityViolationException: could not insert: [org.opennms.netmgt.model.OnmsIpRouteInterface]; SQL [insert into ipRouteInterface (lastPollTime, nodeId, routeDest, routeIfIndex, routeMask, routeMetric1, routeMetric2, routeMetric3, routeMetric4, routeMetric5, routeNextHop, routeProto, routeType, status, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [pk_iprouteinterface]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.opennms.netmgt.model.OnmsIpRouteInterface]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:637)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:737)
at org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate.saveOrUpdate(AbstractDaoHibernate.java:425)
at org.opennms.netmgt.linkd.HibernateEventWriter.saveIpRouteInterface(HibernateEventWriter.java:503)
at org.opennms.netmgt.linkd.AbstractQueryManager.processRouteTable(AbstractQueryManager.java:420)
at org.opennms.netmgt.linkd.HibernateEventWriter.storeSnmpCollection(HibernateEventWriter.java:199)
at org.opennms.netmgt.linkd.Linkd.updateNodeSnmpCollection(Linkd.java:570)
at org.opennms.netmgt.linkd.SnmpCollection.run(SnmpCollection.java:516)
at org.opennms.netmgt.linkd.scheduler.Scheduler$1.run(Scheduler.java:301)
at org.opennms.core.concurrent.RunnableConsumerThreadPool$FiberThreadImpl.run(RunnableConsumerThreadPool.java:420)
at java.lang.Thread.run(Thread.java:662)