Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-7090

IpNetToMedia Table: Manage duplicated ip address

    Details

      Description

      I'm getting these error in hibernate.log:

      FYI: "ERRO: duplicar valor da chave viola a restri??o de unicidade "pk_atinterface" means "ERROR: duplicating the key value violates the restriction "pk_atinterface""

      2014-10-26 15:33:59,426 WARN [Scheduler-Thread-2-of-5] JDBCExceptionReporter: SQL Error: 0, SQLState: 23505
      2014-10-26 15:33:59,426 ERROR [Scheduler-Thread-2-of-5] JDBCExceptionReporter: ERRO: duplicar valor da chave viola a restri??o de unicidade "pk_atinterface"
      Detail: Chave (nodeid, ipaddr, atphysaddr)=(15, 10.9.0.1, 001ebd44416b) j? existe.
      2014-10-26 15:33:59,426 ERROR [Scheduler-Thread-2-of-5] AbstractFlushingEventListener: Could not synchronize database state with session
      org.hibernate.exception.ConstraintViolationException: could not update: org.opennms.netmgt.model.OnmsAtInterface#44731
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2453)
      at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
      at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
      at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
      at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1589)
      at sun.reflect.GeneratedMethodAccessor552.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1282)
      at com.sun.proxy.$Proxy87.list(Unknown Source)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
      at org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate$7.doInHibernate(AbstractDaoHibernate.java:369)
      at org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate$7.doInHibernate(AbstractDaoHibernate.java:364)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
      at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343)
      at org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate.findMatching(AbstractDaoHibernate.java:372)
      at org.opennms.netmgt.dao.hibernate.AtInterfaceDaoHibernate.findByNodeAndAddress(AtInterfaceDaoHibernate.java:164)
      at org.opennms.netmgt.dao.hibernate.AtInterfaceDaoHibernate$1.query(AtInterfaceDaoHibernate.java:178)
      at org.opennms.netmgt.dao.hibernate.AtInterfaceDaoHibernate$1.query(AtInterfaceDaoHibernate.java:174)
      at org.opennms.netmgt.dao.support.UpsertTemplate.doUpsert(UpsertTemplate.java:157)
      at org.opennms.netmgt.dao.support.UpsertTemplate.access$000(UpsertTemplate.java:123)
      at org.opennms.netmgt.dao.support.UpsertTemplate$1.doInTransaction(UpsertTemplate.java:147)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
      at org.opennms.netmgt.dao.support.UpsertTemplate.execute(UpsertTemplate.java:143)
      at org.opennms.netmgt.dao.hibernate.AtInterfaceDaoHibernate.saveAtInterface(AtInterfaceDaoHibernate.java:174)
      at org.opennms.netmgt.linkd.AbstractQueryManager.processIpNetToMediaTable(AbstractQueryManager.java:196)
      at org.opennms.netmgt.linkd.HibernateEventWriter.storeSnmpCollection(HibernateEventWriter.java:224)
      at org.opennms.netmgt.linkd.HibernateEventWriter$$FastClassByCGLIB$$3a4c15a2.invoke(<generated>)
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
      at org.opennms.netmgt.linkd.HibernateEventWriter$$EnhancerByCGLIB$$abb225b5.storeSnmpCollection(<generated>)
      at org.opennms.netmgt.linkd.Linkd.updateNodeSnmpCollection(Linkd.java:757)
      at org.opennms.netmgt.linkd.SnmpCollection.runCollection(SnmpCollection.java:681)
      at org.opennms.netmgt.linkd.SnmpCollection.run(SnmpCollection.java:390)
      at org.opennms.netmgt.linkd.scheduler.Scheduler$1.run(Scheduler.java:203)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:626)
      at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:107)
      at java.lang.Thread.run(Thread.java:804)

      Searching in the table, I noticed that there is already an atinterface for it. In fact, there is multiple entries!

      id | nodeid | ipaddr | atphysaddr | status | sourcenodeid | ifindex | lastpolltime
      ----------------------------------------------------------+------------------------
      44731 | 15 | 10.9.0.1 | 001ebd444140 | N | 51 | 2 | 2010-11-24 14:03:26.513
      91332 | 15 | 10.9.0.1 | 001ebd44415f | N | 15 | 1000 | 2012-12-02 06:59:38.226
      112773 | 15 | 10.9.0.1 | 001ebd444168 | N | 15 | 1000 | 2013-05-25 08:53:05.874
      131189 | 15 | 10.9.0.1 | 001ebd444169 | N | 15 | 1000 | 2013-09-24 18:00:05.241
      135124 | 15 | 10.9.0.1 | 001ebd44416b | N | 197 | 65539 | 2014-01-26 19:21:13.831

      The current mac matches the last line. I just don't know why the sourceid is 197, a simple windows server node, and not 15 as the others. Also the ifindex is 1000, not 65539.

      Why this happened? And how can I clean up my database?

        Attachments

          Activity

            People

            • Assignee:
              rssntn67 Antonio Russo
              Reporter:
              luizluca@gmail.com Luiz Angelo Daros de Luca
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: