← Back to team overview

dhis2-devs team mailing list archive

Re: [issue] Metadata Import fails when modifying a tracker program and tracker program stage

 

Hi Archana

I'm not able to reproduce this issue. Could you provide a bit more info?
steps to reproduce.

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Thu, Nov 10, 2016 at 12:52 PM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> Hi Archana
>
> Ok, looking into it now..
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Thu, Nov 10, 2016 at 12:39 PM, Archana Chillala <
> archanac@xxxxxxxxxxxxxxxx> wrote:
>
>> Hi Morten,
>>
>> Thanks for the fix. We're now able to import *Program Stage *of a
>> Tracker program after modifying it.
>>
>> But, the issue still exists while importing a modified *Tracker program.*
>>
>> Please find the log trace attached herewith.
>>
>>
>> *Cheers,*
>>
>> Archana Chillala
>> Application Developer
>> Email archanac@xxxxxxxxxxxxxxxx
>> Telephone +91 9100960533 <+91+9100960533>
>> [image: ThoughtWorks]
>> <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>
>>
>> On Wed, Nov 9, 2016 at 10:14 AM, Morten Olav Hansen <morten@xxxxxxxxx>
>> wrote:
>>
>>> This should be fixed in latest 225/master (2.24 was not affected)
>>>
>>> --
>>> Morten Olav Hansen
>>> Senior Engineer, DHIS 2
>>> University of Oslo
>>> http://www.dhis2.org
>>>
>>> On Wed, Nov 9, 2016 at 10:14 AM, Morten Olav Hansen <morten@xxxxxxxxx>
>>> wrote:
>>>
>>>> Hi Archana
>>>>
>>>> I'm looking into this now.
>>>>
>>>> --
>>>> Morten Olav Hansen
>>>> Senior Engineer, DHIS 2
>>>> University of Oslo
>>>> http://www.dhis2.org
>>>>
>>>> On Fri, Nov 4, 2016 at 4:07 PM, Archana Chillala <
>>>> archanac@xxxxxxxxxxxxxxxx> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> We are using the latest version of DHIS 2.25 (build - 5e16867). We
>>>>> have two instances of DHIS and are trying to sync metadata from one
>>>>> instance to the other. Sync is failing for the following cases.
>>>>>
>>>>>
>>>>> *Modifying a Tracker program (i.e. program “with registration”)  *
>>>>>
>>>>> * INFO  2016-11-02 16:36:27,877 (admin) Creating 1 object(s) of type
>>>>> ProgramTrackedEntityAttribute (DefaultObjectBundleService.java
>>>>> [http-bio-8080-exec-7])
>>>>> * *WARN  2016-11-02 16:36:27,902 SQL Error: 0, SQLState: 23505
>>>>> (SqlExceptionHelper.java [http-bio-8080-exec-7])*
>>>>> ** ERROR 2016-11-02 16:36:27,903 ERROR: duplicate key value violates
>>>>> unique constraint "programtrackedentityattribute_unique_key"*
>>>>> *  Detail: Key (programid, trackedentityattributeid)=(80, 74) already
>>>>> exists. (SqlExceptionHelper.java [http-bio-8080-exec-7])*
>>>>> ** ERROR 2016-11-02 16:36:27,916 Exception occurred while trying to
>>>>> import the metadata. could not execute statement
>>>>> (MetadataSyncImportHandler.java [http-bio-8080-exec-7])*
>>>>> *org.hibernate.exception.ConstraintViolationException: could not
>>>>> execute statement*
>>>>> at org.hibernate.exception.internal.SQLStateConversionDelegate.
>>>>> convert(SQLStateConversionDelegate.java:112)
>>>>> at org.hibernate.exception.internal.StandardSQLExceptionConvert
>>>>> er.convert(StandardSQLExceptionConverter.java:42)
>>>>> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(Sql
>>>>> ExceptionHelper.java:111)
>>>>> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(Sql
>>>>> ExceptionHelper.java:97)
>>>>> at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.execu
>>>>> teUpdate(ResultSetReturnImpl.java:207)
>>>>> at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.ad
>>>>> dToBatch(NonBatchingBatch.java:45)
>>>>> at org.hibernate.persister.entity.AbstractEntityPersister.inser
>>>>> t(AbstractEntityPersister.java:2921)
>>>>> at org.hibernate.persister.entity.AbstractEntityPersister.inser
>>>>> t(AbstractEntityPersister.java:3421)
>>>>> at org.hibernate.action.internal.EntityInsertAction.execute(Ent
>>>>> ityInsertAction.java:89)
>>>>> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQu
>>>>> eue.java:560)
>>>>> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQu
>>>>> eue.java:434)
>>>>> at org.hibernate.event.internal.AbstractFlushingEventListener.p
>>>>> erformExecutions(AbstractFlushingEventListener.java:337)
>>>>> at org.hibernate.event.internal.DefaultFlushEventListener.onFlu
>>>>> sh(DefaultFlushEventListener.java:39)
>>>>> at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
>>>>> at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundle
>>>>> Service.commit(DefaultObjectBundleService.java:160)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key
>>>>> value violates unique constraint "programtrackedentityattribute
>>>>> _unique_key"
>>>>>   Detail: Key (programid, trackedentityattributeid)=(80, 74) already
>>>>> exists.
>>>>> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorRespons
>>>>> e(QueryExecutorImpl.java:2284)
>>>>> at org.postgresql.core.v3.QueryExecutorImpl.processResults(Quer
>>>>> yExecutorImpl.java:2003)
>>>>> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecut
>>>>> orImpl.java:200)
>>>>> at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
>>>>> at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgP
>>>>> reparedStatement.java:161)
>>>>> at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPrep
>>>>> aredStatement.java:133)
>>>>> at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUp
>>>>> date(NewProxyPreparedStatement.java:105)
>>>>> at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.execu
>>>>> teUpdate(ResultSetReturnImpl.java:204)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *Modifying the program stage of a Tracker program (i.e. program “with
>>>>> registration”)*
>>>>>
>>>>> * INFO  2016-11-02 16:55:26,050 (admin) Updating 1 object(s) of type
>>>>> ProgramStage (DefaultObjectBundleService.java [http-bio-8080-exec-10])
>>>>> * INFO  2016-11-02 16:55:26,065 (admin) Updating 2 object(s) of type
>>>>> ProgramStageDataElement (DefaultObjectBundleService.java
>>>>> [http-bio-8080-exec-10])
>>>>> * *ERROR 2016-11-02 16:55:26,073 Exception occurred while trying to
>>>>> import the metadata. Batch update returned unexpected row count from update
>>>>> [0]; actual row count: 0; expected: 1 (MetadataSyncImportHandler.java
>>>>> [http-bio-8080-exec-10])*
>>>>> *org.hibernate.StaleStateException: Batch update returned unexpected
>>>>> row count from update [0]; actual row count: 0; expected: 1*
>>>>> at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatche
>>>>> d(Expectations.java:67)
>>>>> at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutco
>>>>> me(Expectations.java:54)
>>>>> at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.ad
>>>>> dToBatch(NonBatchingBatch.java:46)
>>>>> at org.hibernate.persister.entity.AbstractEntityPersister.updat
>>>>> e(AbstractEntityPersister.java:3106)
>>>>> at org.hibernate.persister.entity.AbstractEntityPersister.updat
>>>>> eOrInsert(AbstractEntityPersister.java:2985)
>>>>> at org.hibernate.persister.entity.AbstractEntityPersister.updat
>>>>> e(AbstractEntityPersister.java:3365)
>>>>> at org.hibernate.action.internal.EntityUpdateAction.execute(Ent
>>>>> ityUpdateAction.java:145)
>>>>> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQu
>>>>> eue.java:560)
>>>>> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQu
>>>>> eue.java:434)
>>>>> at org.hibernate.event.internal.AbstractFlushingEventListener.p
>>>>> erformExecutions(AbstractFlushingEventListener.java:337)
>>>>> at org.hibernate.event.internal.DefaultFlushEventListener.onFlu
>>>>> sh(DefaultFlushEventListener.java:39)
>>>>> at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
>>>>> at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundle
>>>>> Service.commit(DefaultObjectBundleService.java:160)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>>>> ssorImpl.java:62)
>>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>>>> thodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>>>> at org.springframework.aop.support.AopUtils.invokeJoinpointUsin
>>>>> gReflection(AopUtils.java:302)
>>>>> at org.springframework.aop.framework.ReflectiveMethodInvocation
>>>>> .invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>>>>> at org.springframework.aop.framework.ReflectiveMethodInvocation
>>>>> .proceed(ReflectiveMethodInvocation.java:157)
>>>>> at org.springframework.transaction.interceptor.TransactionInter
>>>>> ceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>>>>> at org.springframework.transaction.interceptor.TransactionAspec
>>>>> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
>>>>> at org.springframework.transaction.interceptor.TransactionInter
>>>>> ceptor.invoke(TransactionInterceptor.java:96)
>>>>> at org.springframework.aop.framework.ReflectiveMethodInvocation
>>>>> .proceed(ReflectiveMethodInvocation.java:179)
>>>>> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
>>>>> JdkDynamicAopProxy.java:208)
>>>>> at com.sun.proxy.$Proxy186.commit(Unknown Source)
>>>>>
>>>>>
>>>>> Could you please help fix the issues.
>>>>>
>>>>>
>>>>> *Cheers,*
>>>>>
>>>>> Archana Chillala
>>>>> Application Developer
>>>>> Email archanac@xxxxxxxxxxxxxxxx
>>>>> Telephone +91 9100960533 <+91+9100960533>
>>>>> [image: ThoughtWorks]
>>>>> <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>
>>>
>>
>

Follow ups

References