Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] DB Store duplicate key violation
[CDO] DB Store duplicate key violation [message #760587] Sat, 03 December 2011 09:04 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hello,

I get the exception below on the DBStore with PostgreSQL. It's clear the reference being written
tries to overwrite an existing entry, which is not allowed.

Any ideas how this could be solved?

org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "metrics_metricsource_statistics_list_idx0"

java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '1', '4575') was aborted. Call getNextException to see the cause.

Thank You,
Christophe
Re: [CDO] DB Store duplicate key violation [message #760589 is a reply to message #760587] Sat, 03 December 2011 09:11 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 03.12.2011 10:04, schrieb Christophe Bouhier:
> Hello,
> I get the exception below on the DBStore with PostgreSQL. It's clear the reference being written
> tries to overwrite an existing entry, which is not allowed.
>
> Any ideas how this could be solved?
> org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint
> "metrics_metricsource_statistics_list_idx0"
>
> java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx,
> cdo_value) VALUES('254', '1', '4575') was aborted. Call getNextException to see the cause.
No stack trace available?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] DB Store duplicate key violation [message #760590 is a reply to message #760589] Sat, 03 December 2011 09:18 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Yes, there are:
I notice the index to be written is the last index in the DB (See attached screenshot)

[ERROR] java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more

!ENTRY org.eclipse.emf.cdo.server 4 0 2011-12-03 10:17:20.384
!MESSAGE java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
!STACK 0
org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more
COMMIT HANDLER: transaction source unknown (comment not set) for transaction for commit=org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo@647b3b24
[ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more


!ENTRY org.eclipse.emf.cdo.net4j 4 0 2011-12-03 10:17:20.386
!MESSAGE Rollback in DBStore: org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more

IMPORTER COMMIT FAILED
java.lang.IllegalStateException: org.eclipse.emf.cdo.util.CommitException: Rollback in DBStore: org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more

at com.netxforge.netxstudio.data.cdo.CDODataProvider.commitTransaction(CDODataProvider.java:589)
at com.netxforge.netxstudio.server.ServerCDODataProvider.commitTransaction(ServerCDODataProvider.java:41)
at com.netxforge.netxstudio.data.importer.AbstractMetricValuesImporter.process(AbstractMetricValuesImporter.java:325)
at com.netxforge.netxstudio.server.metrics.MetricSourceJobImplementation.run(MetricSourceJobImplementation.java:71)
at com.netxforge.netxstudio.server.job.NetxForgeJob.execute(NetxForgeJob.java:93)
at org.quartz.core.JobRunShell.run(JobRunShell.java:206)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:548)
Caused by: org.eclipse.emf.cdo.util.CommitException: Rollback in DBStore: org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO metrics_MetricSource_statistics_list (cdo_source, cdo_idx, cdo_value) VALUES('254', '9', '4627') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more

at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:94)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1058)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1078)
at com.netxforge.netxstudio.data.cdo.CDODataProvider.commitTransaction(CDODataProvider.java:585)
... 6 more
Re: [CDO] DB Store duplicate key violation [message #760592 is a reply to message #760590] Sat, 03 December 2011 09:34 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
This is getting interresting, these objects are created on the server side and triggered by scheduled jobs (using quartz).

When the server runs, everying is OK, and the error doesn't occur. When we launch the RCP client, and fill a JFace viewer with this list (Through Databinding) the
problem starts to appear, on the next job being exucted which writes to this list.


Re: [CDO] DB Store duplicate key violation [message #760608 is a reply to message #760592] Sat, 03 December 2011 13:08 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 307
Registered: July 2009
Location: Germany
Senior Member
Hi Christophe,

can you reproduce this with a different database (H2, MySQL, Derby?).
The problem with PostgreSQL is that I would not attribute it as entirely
mature. We have a few failing tests for this DB in our test suite and I
did not have the time and resources to really test the Postgres stuff
thoroughly.
But if you can reproduce the problem in a minimal test case, pleas file
a Bugzilla and add the test case so we can look into it.

Cheers,
Stefan





Am 03.12.11 10:34, schrieb Christophe Bouhier:
> This is getting interresting, these objects are created on the server
> side and triggered by scheduled jobs (using quartz).
> When the server runs, everying is OK, and the error doesn't occur. When
> we launch the RCP client, and fill a JFace viewer with this list
> (Through Databinding) the problem starts to appear, on the next job
> being exucted which writes to this list.
>
>
Re: [CDO] DB Store duplicate key violation [message #760612 is a reply to message #760587] Sat, 03 December 2011 13:50 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
I have debugged the problem a bit further and it is now clear that a parallel action which tries
to write to the collection is not getting the latest CDORevision of the parent object, hence the wrong collection index. (Not in sync with the revision number in the DB). Is this a caching issue? Can I force an update somehow?
Re: [CDO] DB Store duplicate key violation [message #760615 is a reply to message #760608] Sat, 03 December 2011 14:02 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Stefan,

Thank you for your response. I am not using Mysql, H2 etc.. so I can't answer this right now.
I am very interested to learn more about the failing tests on PostgreSQL. Can you tell me where I can find those testcases? I would like to see if it somehow resembles my problem.

I am not sure I can reproduce this issue in a Unit test, but I will give it a try, the issue s that two parallel server jobs are writing the same list, and it is very clear now that the 2nd process is not getting the correct CDORevision. (Each process using their own CDO sessions).


best rgds Christophe Bouhier
Re: [CDO] DB Store duplicate key violation [message #760650 is a reply to message #760615] Sat, 03 December 2011 21:17 Go to previous messageGo to next message
Eclipse UserFriend
Maybe it have to do something with the transaction isolation level in postgres?
(And the fact that postgresql actually executes concurrent queries concurrently.)
Search for "postgresql transaction isolation".
Re: [CDO] DB Store duplicate key violation [message #760652 is a reply to message #760615] Sat, 03 December 2011 21:32 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 307
Registered: July 2009
Location: Germany
Senior Member
Hi Christophe,

regarding the failing PSQL tests, have a look at the
DISABLED_xxx-classes located in the org.eclipse.emf.cdo.tests.db
package. Most of these classes contain a line like this one:

skipConfig(AllTestsDBPsql.Psql.INSTANCE);

which excludes the PSQL DB configuration from the testsuite, because the
testcase is failing. There should be numerous bugs in Bugzilla referring
to the respective test case fails...


Cheers,
Stefan


Am 03.12.11 15:02, schrieb Christophe Bouhier:
> Hi Stefan,
> Thank you for your response. I am not using Mysql, H2 etc.. so I can't
> answer this right now. I am very interested to learn more about the
> failing tests on PostgreSQL. Can you tell me where I can find those
> testcases? I would like to see if it somehow resembles my problem.
> I am not sure I can reproduce this issue in a Unit test, but I will give
> it a try, the issue s that two parallel server jobs are writing the same
> list, and it is very clear now that the 2nd process is not getting the
> correct CDORevision. (Each process using their own CDO sessions).
>
> best rgds Christophe Bouhier
>
Re: [CDO] DB Store duplicate key violation [message #760655 is a reply to message #760612] Sat, 03 December 2011 21:42 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 307
Registered: July 2009
Location: Germany
Senior Member
Hi again :-)

Am 03.12.11 14:50, schrieb Christophe Bouhier:
> I have debugged the problem a bit further and it is now clear that a
> parallel action which tries to write to the collection is not getting
> the latest CDORevision of the parent object, hence the wrong collection
> index. (Not in sync with the revision number in the DB). Is this a
> caching issue? Can I force an update somehow?

Is the wrong index created on the server side or the client side?
IOW, do two clients add to the same collection at the same time and
maybe they want to insert an item at the same location?

If the wrong index is created on the client side, using a lock on the
respective object could help at least as a workaround. On the other
hand, before writing an object, we check if the version has been
increased in between.

Thinking about it, maybe "mag" is right. Can you tell me what the
transaction isolation level is in your Postgres installation? Maybe you
can experiment with it and set it to "READ_UNCOMMITTED" and see if the
error persists? (Not that READ_UNCOMMITTED is a good setting, but it
would help to circle the problem).

Cheers,
Stefan
Re: [CDO] DB Store duplicate key violation [message #760702 is a reply to message #760655] Sun, 04 December 2011 13:23 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Stefan,

Thank you for your hints.
On a one by one response.

1) I have switched to MySQL, to see if the issue would occur as well. I immediately reproduced the problem on
DBStore with mysql as well. So it seems, the problem is not specific to the DB choice, but it is in our code or the way we execute threaded CDO clients. In one way comforting, but on the hand no solution yet.

2) On your question, where the index is created, I have no clue, what I understand, the index is a column in the table for this object, so I would expect it read on the server and returned to the client? What I see is that the wrong CDORevision is returned from the server, which holds the wrong collection index (Object is in state CLEAN ). I would actually like to trace the server side as well, but I am not sure where to add a breakpoint for an incoming request.

Both processes "could" indeed be addressing the same object and the collection in parallel, I have tried to add locking, but could reproduce the problem, with locking included. Locking is new to me, here is a snippet, not sure it's correct.


CDOTransaction cdoTransaction = this.getDataProvider().getTransaction();
List<MetricSource> newArrayList = Lists.newArrayList(src);
try {
cdoTransaction.lockObjects(newArrayList, LockType.WRITE, 1000);
CDORevision cdoRevision = src.cdoRevision();
if(cdoRevision != null){
System.out.println("IMPORTER: object revision=" + cdoRevision.getVersion());
}

// Make sure we get the latest index.
EList<MappingStatistic> statistics = src.getStatistics();
statistics.add(mappingStatistic);

} catch (InterruptedException e) {
e.printStackTrace();
}finally{
cdoTransaction.unlockObjects(newArrayList,LockType.WRITE);
}

3) On the "transaction isolation level" ok, this is new to me, I have looked it up in
postgresql.conf, the parameter is commented out.
#default_transaction_isolation = 'read committed' I will try this param, and see what happens. But if the problem also occurs on mysql?



Same exception on Mysql:

[ERROR] java.sql.BatchUpdateException: Duplicate entry '254-1' for key 'metrics_MetricSource_statistics_list_idx0'
org.eclipse.net4j.db.DBException: java.sql.BatchUpdateException: Duplicate entry '254-1' for key 'metrics_MetricSource_statistics_list_idx0'
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:530)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.processDelta(NonAuditListTableMapping.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.visit(HorizontalNonAuditClassMapping.java:592)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.accept(CDOListFeatureDeltaImpl.java:422)
at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.accept(CDORevisionDeltaImpl.java:301)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping$FeatureDeltaWriter.process(HorizontalNonAuditClassMapping.java:551)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeRevisionDelta(HorizontalNonAuditClassMapping.java:474)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDelta(DBStoreAccessor.java:548)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisionDeltas(DBStoreAccessor.java:533)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:95)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:149)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:425)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42)
at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.sql.BatchUpdateException: Duplicate entry '254-1' for key 'metrics_MetricSource_statistics_list_idx0'
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2028)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1451)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.NonAuditListTableMapping.writeResultToDatabase(NonAuditListTableMapping.java:505)
... 27 more

Previous Topic:EMF validation on save
Next Topic:Deferring Notifications of a Compound Command
Goto Forum:
  


Current Time: Wed Apr 24 21:26:53 GMT 2024

Powered by FUDForum. Page generated in 0.04142 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top