Ticket #2364 (closed defect: invalid)

Opened 5 years ago

Last modified 4 years ago

osmosis does not truncate and crashes on index

Reported by: stephankn Owned by: brett@…
Priority: major Milestone:
Component: osmosis Version:
Keywords: Cc: stephankn

Description

I have a small dataset to update. A new import is faster than a update. I use the following line to first truncate the DB then re-import the data.

Osmosis fails in about every third call with the following exception. For some reason the database seams not to be correctly truncated and the index having duplicate values.

Happens with 0.31.2 as well as with the latest version from svn. Environment: PostgreSQL 8.3, Java 1.6.0_16, running Windows Vista x64.

call osmosis --truncate-pgsql database=db user=pg --fast-read-xml-0.6 file=f.osm --buffer --write-pgsql user=pg database=db
09.10.2009 07:28:18 org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SCHWERWIEGEND: Thread for task 3-buffer failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to execute statement.
        at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.executeStatement(DatabaseContext.java:106)
        at org.openstreetmap.osmosis.core.pgsql.v0_6.PostgreSqlWriter.complete(PostgreSqlWriter.java:862)
        at org.openstreetmap.osmosis.core.buffer.v0_6.EntityBuffer.run(EntityBuffer.java:77)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: ERROR: could not create unique index "pk_users"
  Detail: Table contains duplicated values.
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
        at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.executeStatement(DatabaseContext.java:103)
        ... 3 more
09.10.2009 07:28:18 org.openstreetmap.osmosis.core.Osmosis main
SCHWERWIEGEND: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
        at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
        at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85)
        at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30)
        

Change History

comment:1 Changed 4 years ago by brett@…

  • Status changed from new to closed
  • Resolution set to invalid

Both the --truncate-pgsql and the --write-pgsql will run in parallel which will cause race conditions. Osmosis must be run twice, once for --truncate-pgsql, and once for --write-pgsql.

comment:2 Changed 4 years ago by brett@…

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:3 Changed 4 years ago by brett@…

  • Status changed from reopened to closed
  • Resolution set to invalid

Didn't mean to re-open defect. Closing it again.

Note: See TracTickets for help on using tickets.